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.mjs
CHANGED
|
@@ -493,9 +493,47 @@ class AssetsResource extends BaseResource {
|
|
|
493
493
|
if (options.type) {
|
|
494
494
|
queryParams.set("type", options.type);
|
|
495
495
|
}
|
|
496
|
+
return this.request("GET", `?${queryParams.toString()}`);
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Permanently remove a venue asset by id — the storage object, the `assets`
|
|
500
|
+
* row, and every junction link (an `everywhere` delete). The venue-wide
|
|
501
|
+
* counterpart to deleting an asset from a single entity.
|
|
502
|
+
*
|
|
503
|
+
* Proxies the dual-mode `deleteAsset` server action via
|
|
504
|
+
* `DELETE /venues/{venueId}/assets/{assetId}`. The action also publishes
|
|
505
|
+
* `order3000.assets.updated`, so every open asset library for the venue
|
|
506
|
+
* updates live.
|
|
507
|
+
*
|
|
508
|
+
* @param assetId - The globally-unique asset id
|
|
509
|
+
* @returns `{ success, deleted }`
|
|
510
|
+
*/
|
|
511
|
+
async delete(assetId) {
|
|
496
512
|
return this.request(
|
|
497
|
-
"
|
|
498
|
-
|
|
513
|
+
"DELETE",
|
|
514
|
+
`/${encodeURIComponent(assetId)}`
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Edit a venue asset's metadata (tags / caption / alt / active flag / crop)
|
|
519
|
+
* by id. Only the supplied fields are written; per-locale `caption` / `alt`
|
|
520
|
+
* merge into the existing record rather than overwriting it.
|
|
521
|
+
*
|
|
522
|
+
* Proxies the dual-mode `editAsset` server action via
|
|
523
|
+
* `PATCH /venues/{venueId}/assets/{assetId}`. The action also publishes
|
|
524
|
+
* `order3000.assets.updated`, so every open asset library for the venue
|
|
525
|
+
* updates live — the grid refetches and any open EditAssetModal showing this
|
|
526
|
+
* asset re-seeds to reflect the edit.
|
|
527
|
+
*
|
|
528
|
+
* @param assetId - The globally-unique asset id
|
|
529
|
+
* @param input - The fields to change
|
|
530
|
+
* @returns The updated asset row
|
|
531
|
+
*/
|
|
532
|
+
async update(assetId, input) {
|
|
533
|
+
return this.request(
|
|
534
|
+
"PATCH",
|
|
535
|
+
`/${encodeURIComponent(assetId)}`,
|
|
536
|
+
input
|
|
499
537
|
);
|
|
500
538
|
}
|
|
501
539
|
}
|
|
@@ -588,6 +626,33 @@ class BasketsResource extends BaseResource {
|
|
|
588
626
|
}
|
|
589
627
|
}
|
|
590
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
|
+
|
|
591
656
|
class CalloutsResource extends BaseResource {
|
|
592
657
|
constructor(tokenManager, baseUrl) {
|
|
593
658
|
super(tokenManager, baseUrl, "/callouts");
|
|
@@ -629,6 +694,56 @@ class CalloutsResource extends BaseResource {
|
|
|
629
694
|
}
|
|
630
695
|
}
|
|
631
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
|
+
|
|
632
747
|
class EventsResource extends BaseResource {
|
|
633
748
|
constructor(tokenManager, baseUrl) {
|
|
634
749
|
super(tokenManager, baseUrl, "/events");
|
|
@@ -1585,7 +1700,9 @@ class O3KClient {
|
|
|
1585
1700
|
__publicField(this, "articles");
|
|
1586
1701
|
__publicField(this, "assets");
|
|
1587
1702
|
__publicField(this, "baskets");
|
|
1703
|
+
__publicField(this, "beverages");
|
|
1588
1704
|
__publicField(this, "callouts");
|
|
1705
|
+
__publicField(this, "dishes");
|
|
1589
1706
|
__publicField(this, "events");
|
|
1590
1707
|
__publicField(this, "menus");
|
|
1591
1708
|
__publicField(this, "orders");
|
|
@@ -1612,7 +1729,9 @@ class O3KClient {
|
|
|
1612
1729
|
this.articles = new ArticlesResource(this.tokenManager, this.baseUrl);
|
|
1613
1730
|
this.assets = new AssetsResource(this.tokenManager, this.baseUrl);
|
|
1614
1731
|
this.baskets = new BasketsResource(this.tokenManager, this.baseUrl);
|
|
1732
|
+
this.beverages = new BeveragesResource(this.tokenManager, this.baseUrl);
|
|
1615
1733
|
this.callouts = new CalloutsResource(this.tokenManager, this.baseUrl);
|
|
1734
|
+
this.dishes = new DishesResource(this.tokenManager, this.baseUrl);
|
|
1616
1735
|
this.events = new EventsResource(this.tokenManager, this.baseUrl);
|
|
1617
1736
|
this.menus = new MenusResource(this.tokenManager, this.baseUrl);
|
|
1618
1737
|
this.orders = new OrdersResource(this.tokenManager, this.baseUrl);
|