order3000 1.9.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 +121 -2
- package/dist/client.d.cts +98 -3493
- package/dist/client.d.mts +98 -3493
- package/dist/client.mjs +121 -2
- 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 +180 -2
- package/dist/schemas.d.cts +116 -0
- package/dist/schemas.d.mts +116 -0
- package/dist/schemas.mjs +180 -2
- package/package.json +11 -1
package/dist/client.cjs
CHANGED
|
@@ -494,9 +494,47 @@ class AssetsResource extends BaseResource {
|
|
|
494
494
|
if (options.type) {
|
|
495
495
|
queryParams.set("type", options.type);
|
|
496
496
|
}
|
|
497
|
+
return this.request("GET", `?${queryParams.toString()}`);
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Permanently remove a venue asset by id — the storage object, the `assets`
|
|
501
|
+
* row, and every junction link (an `everywhere` delete). The venue-wide
|
|
502
|
+
* counterpart to deleting an asset from a single entity.
|
|
503
|
+
*
|
|
504
|
+
* Proxies the dual-mode `deleteAsset` server action via
|
|
505
|
+
* `DELETE /venues/{venueId}/assets/{assetId}`. The action also publishes
|
|
506
|
+
* `order3000.assets.updated`, so every open asset library for the venue
|
|
507
|
+
* updates live.
|
|
508
|
+
*
|
|
509
|
+
* @param assetId - The globally-unique asset id
|
|
510
|
+
* @returns `{ success, deleted }`
|
|
511
|
+
*/
|
|
512
|
+
async delete(assetId) {
|
|
497
513
|
return this.request(
|
|
498
|
-
"
|
|
499
|
-
|
|
514
|
+
"DELETE",
|
|
515
|
+
`/${encodeURIComponent(assetId)}`
|
|
516
|
+
);
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Edit a venue asset's metadata (tags / caption / alt / active flag / crop)
|
|
520
|
+
* by id. Only the supplied fields are written; per-locale `caption` / `alt`
|
|
521
|
+
* merge into the existing record rather than overwriting it.
|
|
522
|
+
*
|
|
523
|
+
* Proxies the dual-mode `editAsset` server action via
|
|
524
|
+
* `PATCH /venues/{venueId}/assets/{assetId}`. The action also publishes
|
|
525
|
+
* `order3000.assets.updated`, so every open asset library for the venue
|
|
526
|
+
* updates live — the grid refetches and any open EditAssetModal showing this
|
|
527
|
+
* asset re-seeds to reflect the edit.
|
|
528
|
+
*
|
|
529
|
+
* @param assetId - The globally-unique asset id
|
|
530
|
+
* @param input - The fields to change
|
|
531
|
+
* @returns The updated asset row
|
|
532
|
+
*/
|
|
533
|
+
async update(assetId, input) {
|
|
534
|
+
return this.request(
|
|
535
|
+
"PATCH",
|
|
536
|
+
`/${encodeURIComponent(assetId)}`,
|
|
537
|
+
input
|
|
500
538
|
);
|
|
501
539
|
}
|
|
502
540
|
}
|
|
@@ -589,6 +627,33 @@ class BasketsResource extends BaseResource {
|
|
|
589
627
|
}
|
|
590
628
|
}
|
|
591
629
|
|
|
630
|
+
class BeveragesResource extends BaseResource {
|
|
631
|
+
constructor(tokenManager, baseUrl) {
|
|
632
|
+
super(tokenManager, baseUrl, "/beverages");
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Upload an asset image for a beverage. The SDK builds the multipart body
|
|
636
|
+
* internally — pass a Buffer/Uint8Array, the original filename, the MIME type,
|
|
637
|
+
* and optional discovery `tags` (e.g. `['lunch-menu']`). The asset is stored,
|
|
638
|
+
* tagged, and linked to the beverage via `beverage_assets`; returns the new
|
|
639
|
+
* asset and its public URL. The beverage is addressed by its accessor.
|
|
640
|
+
*/
|
|
641
|
+
async uploadAsset(idOrAccessor, file) {
|
|
642
|
+
const form = new FormData();
|
|
643
|
+
form.append(
|
|
644
|
+
"file",
|
|
645
|
+
new Blob([new Uint8Array(file.data)], { type: file.contentType }),
|
|
646
|
+
file.filename
|
|
647
|
+
);
|
|
648
|
+
if (file.tags?.length) form.append("tags", file.tags.join(","));
|
|
649
|
+
return this.requestMultipart(
|
|
650
|
+
"POST",
|
|
651
|
+
`/${encodeURIComponent(idOrAccessor)}/assets`,
|
|
652
|
+
form
|
|
653
|
+
);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
|
|
592
657
|
class CalloutsResource extends BaseResource {
|
|
593
658
|
constructor(tokenManager, baseUrl) {
|
|
594
659
|
super(tokenManager, baseUrl, "/callouts");
|
|
@@ -630,6 +695,56 @@ class CalloutsResource extends BaseResource {
|
|
|
630
695
|
}
|
|
631
696
|
}
|
|
632
697
|
|
|
698
|
+
class DishesResource extends BaseResource {
|
|
699
|
+
constructor(tokenManager, baseUrl) {
|
|
700
|
+
super(tokenManager, baseUrl, "/dishes");
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Fetch a dish by its `accessor` slug (localized name/description, dietary
|
|
704
|
+
* flags, price, assets with public URLs). Pair with `patch` for a safe
|
|
705
|
+
* read-modify-write rename that preserves untouched locales + flags.
|
|
706
|
+
*/
|
|
707
|
+
async get(accessor) {
|
|
708
|
+
return this.request(
|
|
709
|
+
"GET",
|
|
710
|
+
`/${encodeURIComponent(accessor)}`
|
|
711
|
+
);
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Edit a dish by id. `editDish` replaces the fields it receives (localized
|
|
715
|
+
* `name` is required), so callers wanting a partial change should read the
|
|
716
|
+
* dish with `get` first and merge. Returns the updated dish row.
|
|
717
|
+
*/
|
|
718
|
+
async patch(dishId, body) {
|
|
719
|
+
return this.request(
|
|
720
|
+
"PATCH",
|
|
721
|
+
`/${encodeURIComponent(dishId)}`,
|
|
722
|
+
body
|
|
723
|
+
);
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* Upload an asset image for a dish. The SDK builds the multipart body
|
|
727
|
+
* internally — pass a Buffer/Uint8Array, the original filename, the MIME type,
|
|
728
|
+
* and optional discovery `tags` (e.g. `['lunch-menu']`). The asset is stored,
|
|
729
|
+
* tagged, and linked to the dish via `dish_assets`; returns the new asset and
|
|
730
|
+
* its public URL. The dish is addressed by its accessor.
|
|
731
|
+
*/
|
|
732
|
+
async uploadAsset(idOrAccessor, file) {
|
|
733
|
+
const form = new FormData();
|
|
734
|
+
form.append(
|
|
735
|
+
"file",
|
|
736
|
+
new Blob([new Uint8Array(file.data)], { type: file.contentType }),
|
|
737
|
+
file.filename
|
|
738
|
+
);
|
|
739
|
+
if (file.tags?.length) form.append("tags", file.tags.join(","));
|
|
740
|
+
return this.requestMultipart(
|
|
741
|
+
"POST",
|
|
742
|
+
`/${encodeURIComponent(idOrAccessor)}/assets`,
|
|
743
|
+
form
|
|
744
|
+
);
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
|
|
633
748
|
class EventsResource extends BaseResource {
|
|
634
749
|
constructor(tokenManager, baseUrl) {
|
|
635
750
|
super(tokenManager, baseUrl, "/events");
|
|
@@ -1586,7 +1701,9 @@ class O3KClient {
|
|
|
1586
1701
|
__publicField(this, "articles");
|
|
1587
1702
|
__publicField(this, "assets");
|
|
1588
1703
|
__publicField(this, "baskets");
|
|
1704
|
+
__publicField(this, "beverages");
|
|
1589
1705
|
__publicField(this, "callouts");
|
|
1706
|
+
__publicField(this, "dishes");
|
|
1590
1707
|
__publicField(this, "events");
|
|
1591
1708
|
__publicField(this, "menus");
|
|
1592
1709
|
__publicField(this, "orders");
|
|
@@ -1613,7 +1730,9 @@ class O3KClient {
|
|
|
1613
1730
|
this.articles = new ArticlesResource(this.tokenManager, this.baseUrl);
|
|
1614
1731
|
this.assets = new AssetsResource(this.tokenManager, this.baseUrl);
|
|
1615
1732
|
this.baskets = new BasketsResource(this.tokenManager, this.baseUrl);
|
|
1733
|
+
this.beverages = new BeveragesResource(this.tokenManager, this.baseUrl);
|
|
1616
1734
|
this.callouts = new CalloutsResource(this.tokenManager, this.baseUrl);
|
|
1735
|
+
this.dishes = new DishesResource(this.tokenManager, this.baseUrl);
|
|
1617
1736
|
this.events = new EventsResource(this.tokenManager, this.baseUrl);
|
|
1618
1737
|
this.menus = new MenusResource(this.tokenManager, this.baseUrl);
|
|
1619
1738
|
this.orders = new OrdersResource(this.tokenManager, this.baseUrl);
|