webcake-storefront-mcp 1.42.0 → 2.0.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/README.md +2 -2
- package/README.vi.md +2 -2
- package/dist/api-catalog.generated.json +165 -265
- package/dist/api.js +0 -425
- package/dist/changelog.json +7 -7
- package/dist/server.js +2 -0
- package/dist/tools/api-gateway.js +24 -4
- package/dist/tools/appointment.js +5 -49
- package/dist/tools/apps-extra.js +0 -28
- package/dist/tools/apps.js +0 -11
- package/dist/tools/cms-files.js +2 -10
- package/dist/tools/families.js +132 -0
- package/dist/tools/marketing.js +0 -45
- package/dist/tools/multilingual.js +0 -16
- package/dist/tools/orders.js +0 -1
- package/dist/tools/pages.js +0 -3
- package/dist/tools/products.js +0 -5
- package/dist/tools/registry.js +46 -23
- package/dist/tools/retired-tools.json +141 -0
- package/dist/tools/reviews.js +0 -5
- package/dist/tools/site-config.js +0 -78
- package/dist/web-guide.js +1 -1
- package/package.json +1 -1
- package/dist/tools/affiliate.js +0 -27
- package/dist/tools/catalog-extras.js +0 -88
- package/dist/tools/media.js +0 -39
- package/dist/tools/sale-channels.js +0 -45
package/dist/api.js
CHANGED
|
@@ -227,9 +227,6 @@ export class WebcakeCmsApi {
|
|
|
227
227
|
this.sessionId = sessionId;
|
|
228
228
|
}
|
|
229
229
|
// ── CMS Files ──
|
|
230
|
-
listCmsFiles() {
|
|
231
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/cms_files`);
|
|
232
|
-
}
|
|
233
230
|
async createCmsFile(params) {
|
|
234
231
|
await this.fetchCmsTokens();
|
|
235
232
|
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/cms_files`, {
|
|
@@ -251,9 +248,6 @@ export class WebcakeCmsApi {
|
|
|
251
248
|
body: { ...params, ...this.getBundleParams() },
|
|
252
249
|
});
|
|
253
250
|
}
|
|
254
|
-
debugFunction(params) {
|
|
255
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/cms_files/debug`, { body: params });
|
|
256
|
-
}
|
|
257
251
|
runFunction(functionName, method, params) {
|
|
258
252
|
return this.request(method, `/api/v1/${this.siteId}/_functions/${functionName}`, { body: params });
|
|
259
253
|
}
|
|
@@ -263,9 +257,6 @@ export class WebcakeCmsApi {
|
|
|
263
257
|
getFileVersions(query) {
|
|
264
258
|
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/cms_files/version_file`, { query });
|
|
265
259
|
}
|
|
266
|
-
toggleDebugRender(params) {
|
|
267
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/cms_files/toggle_is_debug_render`, { body: params });
|
|
268
|
-
}
|
|
269
260
|
// ── Pages ──
|
|
270
261
|
listPages() {
|
|
271
262
|
return this.request("GET", `/api/v1/site/${this.siteId}/pages`);
|
|
@@ -311,9 +302,6 @@ export class WebcakeCmsApi {
|
|
|
311
302
|
deletePage(params) {
|
|
312
303
|
return this.request("POST", `/api/v1/site/${this.siteId}/delete_page`, { body: params });
|
|
313
304
|
}
|
|
314
|
-
getPageVersions(pageId) {
|
|
315
|
-
return this.request("GET", `/api/v1/site/${this.siteId}/page_versions/${pageId}`);
|
|
316
|
-
}
|
|
317
305
|
listPageContents(query) {
|
|
318
306
|
return this.request("GET", `/api/v1/site/${this.siteId}/page_contents`, { query });
|
|
319
307
|
}
|
|
@@ -620,10 +608,6 @@ export class WebcakeCmsApi {
|
|
|
620
608
|
timeout: 60000,
|
|
621
609
|
});
|
|
622
610
|
}
|
|
623
|
-
/** Delete a single article. */
|
|
624
|
-
deleteArticle(id) {
|
|
625
|
-
return this.deleteArticles([id]);
|
|
626
|
-
}
|
|
627
611
|
/** Create a blog/article category. Command-based: pass a `commands` array whose entries
|
|
628
612
|
* each carry a caller-generated `data.id` (the new category id). Response is generic. */
|
|
629
613
|
createBlogCategory(commands) {
|
|
@@ -659,15 +643,9 @@ export class WebcakeCmsApi {
|
|
|
659
643
|
getProduct(id) {
|
|
660
644
|
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/products/${id}`);
|
|
661
645
|
}
|
|
662
|
-
searchProducts(query) {
|
|
663
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/products/search`, { query });
|
|
664
|
-
}
|
|
665
646
|
listCategories() {
|
|
666
647
|
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/categories/all`);
|
|
667
648
|
}
|
|
668
|
-
getProductsByCategory(categoryId) {
|
|
669
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/categories/products`, { query: { category_id: categoryId } });
|
|
670
|
-
}
|
|
671
649
|
/** Create a product. Body wraps fields in `product_params`; the backend generates the
|
|
672
650
|
* id/slug and sets is_published. Pass variations (price/stock per SKU) + categories. */
|
|
673
651
|
createProduct(productParams) {
|
|
@@ -734,9 +712,6 @@ export class WebcakeCmsApi {
|
|
|
734
712
|
getOrder(orderId) {
|
|
735
713
|
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/orders/${orderId}`);
|
|
736
714
|
}
|
|
737
|
-
countOrdersByStatus() {
|
|
738
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/orders/count_by_status`);
|
|
739
|
-
}
|
|
740
715
|
// ── Site Style / Themes ──
|
|
741
716
|
listThemes() {
|
|
742
717
|
return this.request("GET", `/api/v1/site/${this.siteId}/themes`);
|
|
@@ -878,14 +853,6 @@ export class WebcakeCmsApi {
|
|
|
878
853
|
uninstallApp(id) {
|
|
879
854
|
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/applications/subcriptions/uninstall_app`, { body: { id } });
|
|
880
855
|
}
|
|
881
|
-
/** Update an installed app's settings. `attrs` is merged onto the subscription (e.g. { settings: {...}, status }). */
|
|
882
|
-
updateApp(id, attrs) {
|
|
883
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/applications/subcriptions/update_app`, { body: { id, attrs } });
|
|
884
|
-
}
|
|
885
|
-
/** Update the product-review app's settings (shop_info, display options…). */
|
|
886
|
-
updateAppReview(id, settings) {
|
|
887
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/applications/subcriptions/update_app_review`, { body: { id, settings } });
|
|
888
|
-
}
|
|
889
856
|
// ── Product reviews (product_review app) ──
|
|
890
857
|
listReviews(query) {
|
|
891
858
|
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/applications/product_reviews/all_review_admin`, { query });
|
|
@@ -901,435 +868,43 @@ export class WebcakeCmsApi {
|
|
|
901
868
|
createOrUpdateReview(body) {
|
|
902
869
|
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/applications/product_reviews/create_or_update`, { body });
|
|
903
870
|
}
|
|
904
|
-
removeReviews(ids) {
|
|
905
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/applications/product_reviews/remove`, { body: { ids } });
|
|
906
|
-
}
|
|
907
|
-
/** Approve/hide reviews. `payload` typically { ids, permission } (permission 0=approved, 1=pending…). */
|
|
908
|
-
updateReviewStatus(payload) {
|
|
909
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/applications/product_reviews/update_status`, { body: payload });
|
|
910
|
-
}
|
|
911
871
|
// ── Appointment app ──
|
|
912
|
-
listAppointmentCalendars(query) {
|
|
913
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/appointment/appointment_calendars`, { query });
|
|
914
|
-
}
|
|
915
872
|
createAppointmentCalendar(appointment_calendar) {
|
|
916
873
|
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/appointment/create_appointment_calendar`, { body: { appointment_calendar } });
|
|
917
874
|
}
|
|
918
875
|
updateAppointmentCalendar(appointment_calendar) {
|
|
919
876
|
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/appointment/update_appointment_calendar`, { body: { appointment_calendar } });
|
|
920
877
|
}
|
|
921
|
-
deleteAppointmentCalendars(ids) {
|
|
922
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/appointment/delete_appointment_calendars`, { body: { ids } });
|
|
923
|
-
}
|
|
924
|
-
duplicateAppointmentCalendars(ids) {
|
|
925
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/appointment/duplicate_appointment_calendars`, { body: { ids } });
|
|
926
|
-
}
|
|
927
|
-
listAppointments(query) {
|
|
928
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/appointment/appointments`, { query });
|
|
929
|
-
}
|
|
930
|
-
listAppointmentAddresses(query) {
|
|
931
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/appointment/appointment_addresses`, { query });
|
|
932
|
-
}
|
|
933
|
-
createAppointmentAddress(appointment_address) {
|
|
934
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/appointment/create_appointment_address`, { body: { appointment_address } });
|
|
935
|
-
}
|
|
936
|
-
updateAppointmentAddress(appointment_address) {
|
|
937
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/appointment/update_appointment_address`, { body: { appointment_address } });
|
|
938
|
-
}
|
|
939
|
-
deleteAppointmentAddresses(ids) {
|
|
940
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/appointment/delete_appointment_addresses`, { body: { ids } });
|
|
941
|
-
}
|
|
942
|
-
listAppointmentClassifies(query) {
|
|
943
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/appointment/appointment_classifies`, { query });
|
|
944
|
-
}
|
|
945
|
-
createAppointmentClassify(appointment_classify) {
|
|
946
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/appointment/create_appointment_classify`, { body: { appointment_classify } });
|
|
947
|
-
}
|
|
948
|
-
updateAppointmentClassify(appointment_classify) {
|
|
949
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/appointment/update_appointment_classify`, { body: { appointment_classify } });
|
|
950
|
-
}
|
|
951
|
-
deleteAppointmentClassifies(ids) {
|
|
952
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/appointment/delete_appointment_classifies`, { body: { ids } });
|
|
953
|
-
}
|
|
954
|
-
listAppointmentEmployees(query) {
|
|
955
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/appointment/appointment_employees`, { query });
|
|
956
|
-
}
|
|
957
|
-
createAppointmentEmployee(appointment_employee) {
|
|
958
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/appointment/create_appointment_employee`, { body: { appointment_employee } });
|
|
959
|
-
}
|
|
960
|
-
updateAppointmentEmployee(appointment_employee) {
|
|
961
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/appointment/update_appointment_employee`, { body: { appointment_employee } });
|
|
962
|
-
}
|
|
963
|
-
deleteAppointmentEmployees(ids) {
|
|
964
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/appointment/delete_appointment_employees`, { body: { ids } });
|
|
965
|
-
}
|
|
966
878
|
// ── Affiliate app ──
|
|
967
|
-
getProgramAffiliates() {
|
|
968
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/affiliate/program_affiliates`);
|
|
969
|
-
}
|
|
970
|
-
getProductAffiliates(query) {
|
|
971
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/affiliate/product_affiliates`, { query });
|
|
972
|
-
}
|
|
973
|
-
getOrderAffiliates(query) {
|
|
974
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/affiliate/order_affiliates`, { query });
|
|
975
|
-
}
|
|
976
|
-
getAccountAffiliates(query) {
|
|
977
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/affiliate/account_affiliates`, { query });
|
|
978
|
-
}
|
|
979
|
-
getPayoutAffiliates(query) {
|
|
980
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/affiliate/payout_affiliates`, { query });
|
|
981
|
-
}
|
|
982
|
-
getAffiliateStatistic() {
|
|
983
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/affiliate/statistic`);
|
|
984
|
-
}
|
|
985
|
-
upsertOrderProgramAffiliate(payload) {
|
|
986
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/affiliate/upsert_order_program_affiliate`, { body: payload });
|
|
987
|
-
}
|
|
988
|
-
upsertProductProgramAffiliate(payload) {
|
|
989
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/affiliate/upsert_product_program_affiliate`, { body: payload });
|
|
990
|
-
}
|
|
991
|
-
upsertProductAffiliate(payload) {
|
|
992
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/affiliate/upsert_product_affiliate`, { body: payload });
|
|
993
|
-
}
|
|
994
|
-
deleteProductAffiliates(payload) {
|
|
995
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/affiliate/delete_product_affiliates`, { body: payload });
|
|
996
|
-
}
|
|
997
|
-
updatePayoutAffiliateStatus(payload) {
|
|
998
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/affiliate/update_status_payout_affiliate`, { body: payload });
|
|
999
|
-
}
|
|
1000
|
-
deleteAccountAffiliates(payload) {
|
|
1001
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/affiliate/delete_account_affiliates`, { body: payload });
|
|
1002
|
-
}
|
|
1003
|
-
updateAccountAffiliate(payload) {
|
|
1004
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/affiliate/update_account_affiliate`, { body: payload });
|
|
1005
|
-
}
|
|
1006
879
|
// ── Catalog extras (brands / suppliers / tags / ribbons / materials / variations) ──
|
|
1007
|
-
listProductBrands() {
|
|
1008
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/products/product_brands/all`);
|
|
1009
|
-
}
|
|
1010
|
-
upsertProductBrand(body) {
|
|
1011
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/products/product_brands/create_or_update`, { body });
|
|
1012
|
-
}
|
|
1013
|
-
listProductSuppliers() {
|
|
1014
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/products/product_suppliers/all`);
|
|
1015
|
-
}
|
|
1016
|
-
upsertProductSupplier(body) {
|
|
1017
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/products/product_suppliers/create_or_update`, { body });
|
|
1018
|
-
}
|
|
1019
|
-
listProductTags(query) {
|
|
1020
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/products/product_tags/all`, { query });
|
|
1021
|
-
}
|
|
1022
|
-
upsertProductTag(body) {
|
|
1023
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/products/product_tags/create_or_update`, { body });
|
|
1024
|
-
}
|
|
1025
|
-
listRibbons() {
|
|
1026
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/products/ribbons/all`);
|
|
1027
|
-
}
|
|
1028
|
-
upsertRibbon(body) {
|
|
1029
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/products/ribbons/create_or_update`, { body });
|
|
1030
|
-
}
|
|
1031
|
-
listMaterials() {
|
|
1032
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/products/materials/all`);
|
|
1033
|
-
}
|
|
1034
|
-
upsertMaterial(body) {
|
|
1035
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/products/materials/create_or_update`, { body });
|
|
1036
|
-
}
|
|
1037
|
-
getVariation(variationId) {
|
|
1038
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/products/variation/${variationId}`);
|
|
1039
|
-
}
|
|
1040
|
-
getProductMeasurement() {
|
|
1041
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/settings/product_measurement`);
|
|
1042
|
-
}
|
|
1043
|
-
updateProductMeasurement(product_measurement) {
|
|
1044
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/settings/product_measurement/update`, { body: { product_measurement } });
|
|
1045
|
-
}
|
|
1046
|
-
listBlockPhoneNumbers(query) {
|
|
1047
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/settings/block_phone_number/all`, { query });
|
|
1048
|
-
}
|
|
1049
|
-
upsertBlockPhoneCustomers(phone_numbers) {
|
|
1050
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/settings/block_phone_number/upsert_block_phone_customers`, { body: { phone_numbers } });
|
|
1051
|
-
}
|
|
1052
|
-
removeAllBlockPhoneCustomers() {
|
|
1053
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/settings/block_phone_number/remove_all_block_phone_customers`, { body: {} });
|
|
1054
|
-
}
|
|
1055
|
-
getPriceContacts(type) {
|
|
1056
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/settings/price_contact/get`, { query: { type } });
|
|
1057
|
-
}
|
|
1058
|
-
updatePriceContact(body) {
|
|
1059
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/settings/price_contact/update`, { body });
|
|
1060
|
-
}
|
|
1061
|
-
getCategoryById(categoryId) {
|
|
1062
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/categories/${categoryId}`);
|
|
1063
|
-
}
|
|
1064
880
|
// ── Site config (domains / redirects / shipping / utms / logs / filters / settings / fonts) ──
|
|
1065
|
-
listDomains(query) {
|
|
1066
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/domains/all`, { query });
|
|
1067
|
-
}
|
|
1068
|
-
createDomain(body) {
|
|
1069
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/domains/create`, { body });
|
|
1070
|
-
}
|
|
1071
|
-
updateDomain(body) {
|
|
1072
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/domains/update`, { body });
|
|
1073
|
-
}
|
|
1074
|
-
verifyDomain(domain_id) {
|
|
1075
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/domains/verify`, { body: { domain_id } });
|
|
1076
|
-
}
|
|
1077
|
-
deleteDomain(domain_id) {
|
|
1078
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/domains/delete`, { body: { domain_id } });
|
|
1079
|
-
}
|
|
1080
|
-
checkDomain(domain) {
|
|
1081
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/domains/check_domain`, { body: { domain } });
|
|
1082
|
-
}
|
|
1083
|
-
listRedirectUrls(query) {
|
|
1084
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/seos/redirect_urls/all`, { query });
|
|
1085
|
-
}
|
|
1086
|
-
createRedirectUrl(redirect_url) {
|
|
1087
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/seos/redirect_urls/create`, { body: { redirect_url } });
|
|
1088
|
-
}
|
|
1089
|
-
updateRedirectUrl(redirect_url) {
|
|
1090
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/seos/redirect_urls/update`, { body: { redirect_url } });
|
|
1091
|
-
}
|
|
1092
|
-
deleteRedirectUrls(redirect_url_ids) {
|
|
1093
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/seos/redirect_urls/delete`, { body: { redirect_url_ids } });
|
|
1094
|
-
}
|
|
1095
|
-
getShipping() {
|
|
1096
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/settings/shipping`);
|
|
1097
|
-
}
|
|
1098
|
-
updateShipping(body) {
|
|
1099
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/settings/shipping/update`, { body });
|
|
1100
|
-
}
|
|
1101
|
-
listSiteUtms(query) {
|
|
1102
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/site_utms/all`, { query });
|
|
1103
|
-
}
|
|
1104
|
-
createSiteUtm(site_utm) {
|
|
1105
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/site_utms/create`, { body: { site_utm } });
|
|
1106
|
-
}
|
|
1107
|
-
updateSiteUtm(site_utm) {
|
|
1108
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/site_utms/update`, { body: { site_utm } });
|
|
1109
|
-
}
|
|
1110
|
-
deleteSiteUtms(ids) {
|
|
1111
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/site_utms/delete`, { body: { ids } });
|
|
1112
|
-
}
|
|
1113
|
-
listSystemLogs(query) {
|
|
1114
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/system_logs/all`, { query });
|
|
1115
|
-
}
|
|
1116
|
-
listSavedFilters(table_key) {
|
|
1117
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/saved_filters/`, { query: { table_key } });
|
|
1118
|
-
}
|
|
1119
|
-
createSavedFilter(saved_filter) {
|
|
1120
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/saved_filters/create`, { body: { saved_filter } });
|
|
1121
|
-
}
|
|
1122
|
-
updateSavedFilter(id, saved_filter) {
|
|
1123
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/saved_filters/${id}/update`, { body: { saved_filter } });
|
|
1124
|
-
}
|
|
1125
|
-
deleteSavedFilter(id) {
|
|
1126
|
-
return this.request("DELETE", `/api/v1/dashboard/site/${this.siteId}/saved_filters/${id}`);
|
|
1127
|
-
}
|
|
1128
881
|
/** Raw /update_site call. `body` top-level keys replace; a nested `settings` key is merged server-side. */
|
|
1129
882
|
updateSiteRaw(body) {
|
|
1130
883
|
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/update_site`, { body });
|
|
1131
884
|
}
|
|
1132
|
-
updateSiteName(name) {
|
|
1133
|
-
return this.request("POST", `/api/v1/site/${this.siteId}/update_site_name`, { body: { name } });
|
|
1134
|
-
}
|
|
1135
|
-
updateSiteSlug(slug) {
|
|
1136
|
-
return this.request("POST", `/api/v1/site/${this.siteId}/update_slug_name`, { body: { slug } });
|
|
1137
|
-
}
|
|
1138
|
-
loadFonts() {
|
|
1139
|
-
return this.request("GET", `/api/v1/site/${this.siteId}/load_fonts`);
|
|
1140
|
-
}
|
|
1141
|
-
removeFont(id) {
|
|
1142
|
-
return this.request("DELETE", `/api/v1/site/${this.siteId}/remove_font`, { body: { id } });
|
|
1143
|
-
}
|
|
1144
|
-
loadFontGroups() {
|
|
1145
|
-
return this.request("GET", `/api/v1/site/${this.siteId}/load_font_groups`);
|
|
1146
|
-
}
|
|
1147
885
|
createFontGroup(body) {
|
|
1148
886
|
return this.request("POST", `/api/v1/site/${this.siteId}/create_font_group`, { body: { ...body, site_id: this.siteId } });
|
|
1149
887
|
}
|
|
1150
|
-
removeFontGroup(id) {
|
|
1151
|
-
return this.request("DELETE", `/api/v1/site/${this.siteId}/remove_font_groups`, { body: { id, site_id: this.siteId } });
|
|
1152
|
-
}
|
|
1153
|
-
listApiKeys(query) {
|
|
1154
|
-
return this.request("GET", `/api/v1/site/${this.siteId}/api_keys/all`, { query });
|
|
1155
|
-
}
|
|
1156
|
-
listPublishHistories(query) {
|
|
1157
|
-
return this.request("GET", `/api/v1/site/${this.siteId}/publish_histories`, { query });
|
|
1158
|
-
}
|
|
1159
888
|
// ── Marketing / CRM / team ──
|
|
1160
|
-
getSendEmail() {
|
|
1161
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/send_email/all`);
|
|
1162
|
-
}
|
|
1163
|
-
saveSendEmail(body) {
|
|
1164
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/send_email/save`, { body });
|
|
1165
|
-
}
|
|
1166
|
-
listContacts(query) {
|
|
1167
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/contact/all`, { query });
|
|
1168
|
-
}
|
|
1169
889
|
createContact(body) {
|
|
1170
890
|
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/contact/create`, { body: { ...body, site_id: this.siteId } });
|
|
1171
891
|
}
|
|
1172
|
-
deleteContacts(ids) {
|
|
1173
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/contact/delete`, { body: { ids } });
|
|
1174
|
-
}
|
|
1175
|
-
listSubscribers(query) {
|
|
1176
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/subscriber/all`, { query });
|
|
1177
|
-
}
|
|
1178
|
-
createSubscriber(body) {
|
|
1179
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/subscriber/create`, { body });
|
|
1180
|
-
}
|
|
1181
|
-
deleteSubscribers(ids) {
|
|
1182
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/subscriber/delete`, { body: { ids } });
|
|
1183
|
-
}
|
|
1184
|
-
listEmployees() {
|
|
1185
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/settings/employee/all`);
|
|
1186
|
-
}
|
|
1187
|
-
inviteEmployee(email) {
|
|
1188
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/settings/employee/invite`, { body: { email } });
|
|
1189
|
-
}
|
|
1190
|
-
updateEmployeePermissions(site_permission) {
|
|
1191
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/settings/employee/change_permissions`, { body: { site_permission } });
|
|
1192
|
-
}
|
|
1193
|
-
deleteEmployees(site_permission_ids) {
|
|
1194
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/settings/employee/delete_employees`, { body: { site_permission_ids } });
|
|
1195
|
-
}
|
|
1196
|
-
listInvitations() {
|
|
1197
|
-
return this.request("GET", `/api/v1/dashboard/site/invitations/all`);
|
|
1198
|
-
}
|
|
1199
|
-
acceptInvitation(invitation_id) {
|
|
1200
|
-
return this.request("POST", `/api/v1/dashboard/site/invitations/accept`, { body: { invitation_id } });
|
|
1201
|
-
}
|
|
1202
|
-
refuseInvitation(invitation_id) {
|
|
1203
|
-
return this.request("POST", `/api/v1/dashboard/site/invitations/refuse`, { body: { invitation_id } });
|
|
1204
|
-
}
|
|
1205
|
-
listCustomerTags() {
|
|
1206
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/customer/customer_tags`);
|
|
1207
|
-
}
|
|
1208
892
|
upsertCustomerTag(body) {
|
|
1209
893
|
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/customer/upsert_customer_tag`, { body: { ...body, site_id: this.siteId } });
|
|
1210
894
|
}
|
|
1211
895
|
assignCustomerTags(body) {
|
|
1212
896
|
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/customer/update_tags_for_multiple_customers`, { body: { ...body, site_id: this.siteId } });
|
|
1213
897
|
}
|
|
1214
|
-
getInsightToday() {
|
|
1215
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/insight/today`);
|
|
1216
|
-
}
|
|
1217
|
-
getInsight(query) {
|
|
1218
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/insight/all`, { query });
|
|
1219
|
-
}
|
|
1220
|
-
listNotifications() {
|
|
1221
|
-
return this.request("GET", `/api/v1/dashboard/site/notifications/all`);
|
|
1222
|
-
}
|
|
1223
|
-
markNotificationRead(notification_id) {
|
|
1224
|
-
return this.request("POST", `/api/v1/dashboard/site/notifications/mark_as_read`, { body: { notification_id } });
|
|
1225
|
-
}
|
|
1226
898
|
// ── Multilingual / translations ──
|
|
1227
|
-
mlAddLanguages(languages) {
|
|
1228
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/multilingual/add_multiple_language`, { body: { languages } });
|
|
1229
|
-
}
|
|
1230
|
-
mlChangeDefault(language_code) {
|
|
1231
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/multilingual/change_language_default`, { body: { language_code } });
|
|
1232
|
-
}
|
|
1233
899
|
mlGetTranslations(resource, query) {
|
|
1234
900
|
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/multilingual/${resource}`, { query });
|
|
1235
901
|
}
|
|
1236
902
|
mlSaveTranslations(action, body) {
|
|
1237
903
|
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/multilingual/${action}`, { body });
|
|
1238
904
|
}
|
|
1239
|
-
mlTranslateJson(body) {
|
|
1240
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/multilingual/translate_json`, { body });
|
|
1241
|
-
}
|
|
1242
905
|
// ── Media library + PWA ──
|
|
1243
|
-
listMediaFolders(query) {
|
|
1244
|
-
return this.request("GET", `/api/v1/site/${this.siteId}/media/folder`, { query });
|
|
1245
|
-
}
|
|
1246
|
-
listMediaContent(query) {
|
|
1247
|
-
return this.request("GET", `/api/v1/site/${this.siteId}/media/content`, { query });
|
|
1248
|
-
}
|
|
1249
|
-
listMediaAll(query) {
|
|
1250
|
-
return this.request("GET", `/api/v1/site/${this.siteId}/media/all`, { query });
|
|
1251
|
-
}
|
|
1252
|
-
getMediaCapacity() {
|
|
1253
|
-
return this.request("GET", `/api/v1/site/${this.siteId}/media/capacity`);
|
|
1254
|
-
}
|
|
1255
|
-
emptyMediaTrash() {
|
|
1256
|
-
return this.request("POST", `/api/v1/site/${this.siteId}/media/empty_trash`, { body: {} });
|
|
1257
|
-
}
|
|
1258
|
-
uploadBase64Media(base64) {
|
|
1259
|
-
return this.request("POST", `/api/v1/site/${this.siteId}/media/content/b64`, { body: { base64 }, timeout: 60000 });
|
|
1260
|
-
}
|
|
1261
|
-
updateMediaFolder(body) {
|
|
1262
|
-
return this.request("POST", `/api/v1/site/${this.siteId}/media/folder/update`, { body });
|
|
1263
|
-
}
|
|
1264
|
-
updateMediaContent(body) {
|
|
1265
|
-
return this.request("POST", `/api/v1/site/${this.siteId}/media/content/update`, { body });
|
|
1266
|
-
}
|
|
1267
|
-
getPwa() {
|
|
1268
|
-
return this.request("GET", `/api/v1/site/${this.siteId}/pwa`);
|
|
1269
|
-
}
|
|
1270
|
-
upsertPwa(body) {
|
|
1271
|
-
return this.request("POST", `/api/v1/site/${this.siteId}/pwa/upsert`, { body });
|
|
1272
|
-
}
|
|
1273
906
|
// ── Apps: product design / personal product design / course ──
|
|
1274
|
-
getDeviceTemplates() {
|
|
1275
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/applications/product_design/get_group_device_tempalte`);
|
|
1276
|
-
}
|
|
1277
|
-
createProductsByDeviceTemplate(groups) {
|
|
1278
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/applications/product_design/create_product_by_device_template`, { body: { groups, site_id: this.siteId } });
|
|
1279
|
-
}
|
|
1280
|
-
getAllPpd(query) {
|
|
1281
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/applications/personal_product_design/get_all_ppd`, { query });
|
|
1282
|
-
}
|
|
1283
|
-
upsertPpd(ppds) {
|
|
1284
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/applications/personal_product_design/upsert_ppd`, { body: { ppds, site_id: this.siteId } });
|
|
1285
|
-
}
|
|
1286
|
-
removePpd(ids) {
|
|
1287
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/applications/personal_product_design/remove_ppd`, { body: { ids, site_id: this.siteId } });
|
|
1288
|
-
}
|
|
1289
|
-
getProductVariationTemplate(product_id) {
|
|
1290
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/applications/personal_product_design/get_product_variation_template`, { query: { product_id } });
|
|
1291
|
-
}
|
|
1292
|
-
listCourses(query) {
|
|
1293
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/course-app`, { query });
|
|
1294
|
-
}
|
|
1295
|
-
getCourse(id) {
|
|
1296
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/course-app/${id}`);
|
|
1297
|
-
}
|
|
1298
907
|
createCourse(body) {
|
|
1299
908
|
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/course-app`, { body: { ...body, site_id: this.siteId } });
|
|
1300
909
|
}
|
|
1301
|
-
updateCourse(id, body) {
|
|
1302
|
-
return this.request("PATCH", `/api/v1/dashboard/site/${this.siteId}/course-app/${id}`, { body });
|
|
1303
|
-
}
|
|
1304
|
-
deleteCourse(id) {
|
|
1305
|
-
return this.request("DELETE", `/api/v1/dashboard/site/${this.siteId}/course-app/${id}`);
|
|
1306
|
-
}
|
|
1307
|
-
deleteManyCourses(ids) {
|
|
1308
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/course-app/delete_many`, { body: { ids, site_id: this.siteId } });
|
|
1309
|
-
}
|
|
1310
|
-
getCourseMembers(query) {
|
|
1311
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/course-app/members`, { query });
|
|
1312
|
-
}
|
|
1313
|
-
// ── Sale channels: partner feeds + catalogs ──
|
|
1314
|
-
listPartnerFeeds(query) {
|
|
1315
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/sale_channels/partner_feeds/all`, { query });
|
|
1316
|
-
}
|
|
1317
|
-
createPartnerFeed(body) {
|
|
1318
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/sale_channels/partner_feeds/create`, { body });
|
|
1319
|
-
}
|
|
1320
|
-
updatePartnerFeed(partnerFeedId, body) {
|
|
1321
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/sale_channels/partner_feeds/${partnerFeedId}/update`, { body });
|
|
1322
|
-
}
|
|
1323
|
-
deletePartnerFeeds(partner_feed_ids) {
|
|
1324
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/sale_channels/partner_feeds/delete`, { body: { partner_feed_ids } });
|
|
1325
|
-
}
|
|
1326
|
-
listPartnerFeedProducts(partnerFeedId, query) {
|
|
1327
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/sale_channels/partner_feeds/${partnerFeedId}/products/all`, { query });
|
|
1328
|
-
}
|
|
1329
|
-
syncPartnerFeed(partnerFeedId) {
|
|
1330
|
-
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/sale_channels/partner_feeds/${partnerFeedId}/products/sync`, { body: { partner_feed_id: partnerFeedId } });
|
|
1331
|
-
}
|
|
1332
|
-
listGoogleMerchants(query) {
|
|
1333
|
-
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/sale_channels/google/merchants`, { query });
|
|
1334
|
-
}
|
|
1335
910
|
}
|
package/dist/changelog.json
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "2.0.0",
|
|
4
|
+
"d": "19/11/2026",
|
|
5
|
+
"type": "Added",
|
|
6
|
+
"en": "18 new domain tools (page, page_element, page_draft, compose, builder_ref, global_source, global_section, site_code, theme, product,…",
|
|
7
|
+
"vi": "18 tool theo domain mới (page, page_element, page_draft, compose, builder_ref, global_source, global_section, site_code, theme, product,…"
|
|
8
|
+
},
|
|
2
9
|
{
|
|
3
10
|
"v": "1.42.0",
|
|
4
11
|
"d": "19/11/2026",
|
|
@@ -33,12 +40,5 @@
|
|
|
33
40
|
"type": "Changed",
|
|
34
41
|
"en": "The install command no longer asks any questions: it opens the prod browser connect page and configures every AI app it detects on the machine…",
|
|
35
42
|
"vi": "Lệnh install nay không còn hỏi gì: mở thẳng trang kết nối prod trên trình duyệt và ghi cấu hình vào mọi ứng dụng AI phát hiện được trên máy (Claude…"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"v": "1.37.0",
|
|
39
|
-
"d": "04/11/2026",
|
|
40
|
-
"type": "Added",
|
|
41
|
-
"en": "A new native-first guide is now injected into get_build_guide's build guide, get_http_function's and get_site_custom_code's custom-code guide, and…",
|
|
42
|
-
"vi": "Hướng dẫn \"native first\" mới nay được chèn vào build guide của get_build_guide, custom-code guide của get_http_function và get_site_custom_code,…"
|
|
43
43
|
}
|
|
44
44
|
]
|
package/dist/server.js
CHANGED
|
@@ -16,6 +16,8 @@ const INSTRUCTIONS = `You are an AI assistant connected to the WebCake/StoreCake
|
|
|
16
16
|
|
|
17
17
|
IMPORTANT: When the user asks ANY question about their website, store, products, orders, pages, or code — you MUST use the available tools to look up real data before answering. Never guess.
|
|
18
18
|
|
|
19
|
+
Tool families: most tools are grouped by domain (page, page_element, page_draft, compose, builder_ref, global_source, global_section, site_code, theme, product, product_category, promotion, order, blog, collection, cms_function, app, cached_result). Each runs its operations by \`action\`, and the action names are the tool names the guides use — "call new_section" means compose({ action: "new_section", … }), "create_product" means product({ action: "create_product", … }). help:true on any action returns its full documentation and schema.
|
|
20
|
+
|
|
19
21
|
Tool discovery: the common tools (pages, builder, products, orders, blog, customers, apps, publishing) are loaded directly. MANY more capabilities are available on demand — marketing/CRM (email, contacts, subscribers, employees), translations, media library, appointments, affiliate, product reviews, custom domains / SEO redirects / shipping, brands / tags / ribbons / materials, courses, sale channels, automation, and more. If you don't see a directly-loaded tool for the task, call search_tools("keywords") to find it, then run it with invoke_read_tool(name, arguments) if it only reads (list_/get_/search_…), otherwise invoke_tool(name, arguments). Use list_tool_groups to see everything available. If NO tool covers it, the whole backend API is reachable: api_find("keywords") → api_get (reads) / api_call (writes, dry_run first).
|
|
20
22
|
|
|
21
23
|
You can also BUILD pages: use get_build_guide, list_elements, get_element to learn the BuilderX component model, new_section/new_element to compose, validate_page to check, then build_page (dry_run first) to create. Publishing is site-level via publish_site.
|
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
// (settings merge, page-source validation, native-first, CMS tokens, by_ai…).
|
|
6
6
|
import { readFileSync } from "node:fs";
|
|
7
7
|
import { z } from "zod";
|
|
8
|
+
import { FAMILY_OF } from "./families.js";
|
|
9
|
+
/** How to call a dedicated tool: family members run as an action. */
|
|
10
|
+
const callName = (t) => (FAMILY_OF[t] ? `${FAMILY_OF[t]}{action:"${t}"}` : t);
|
|
8
11
|
let CATALOG = { meta: {}, ops: [] };
|
|
9
12
|
try {
|
|
10
13
|
CATALOG = JSON.parse(readFileSync(new URL("../api-catalog.generated.json", import.meta.url), "utf8"));
|
|
@@ -25,7 +28,7 @@ const words = (s) => s.replace(/([a-z])([A-Z])/g, "$1 $2").toLowerCase().split(/
|
|
|
25
28
|
export function opLine(o) {
|
|
26
29
|
const keys = o.params ? Object.keys(o.params) : [];
|
|
27
30
|
const shown = keys.slice(0, 6).map((k) => (o.required?.includes(k) ? `${k}*` : k));
|
|
28
|
-
return `${o.id} — ${o.handler}${shown.length ? ` (${shown.join(", ")}${keys.length > 6 ? ", …" : ""})` : ""}${o.tools ? ` ⇒ tool: ${o.tools.slice(0, 3).join(", ")}` : ""}`;
|
|
31
|
+
return `${o.id} — ${o.handler}${shown.length ? ` (${shown.join(", ")}${keys.length > 6 ? ", …" : ""})` : ""}${o.tools ? ` ⇒ tool: ${o.tools.slice(0, 3).map(callName).join(", ")}` : ""}`;
|
|
29
32
|
}
|
|
30
33
|
export function searchOps(query, limit = 15, method) {
|
|
31
34
|
const terms = words(query);
|
|
@@ -66,11 +69,28 @@ export function describeOp(o) {
|
|
|
66
69
|
...(o.required ? { required: o.required } : {}),
|
|
67
70
|
...(o.perms ? { needs_permission: o.perms } : {}),
|
|
68
71
|
...(o.tools
|
|
69
|
-
? { prefer_tool: o.tools, note: o.method === "GET" ? "A dedicated tool covers this route and returns a cleaner result." : "Writes to this route go through the dedicated tool (it carries the guards); api_call refuses them." }
|
|
72
|
+
? { prefer_tool: o.tools.map(callName), note: o.method === "GET" ? "A dedicated tool covers this route and returns a cleaner result." : "Writes to this route go through the dedicated tool (it carries the guards); api_call refuses them." }
|
|
70
73
|
: {}),
|
|
71
74
|
...(DENY[o.id] ? { refused: DENY[o.id] } : {}),
|
|
72
75
|
};
|
|
73
76
|
}
|
|
77
|
+
// Never hand a secret to the model: values under these keys are replaced in every result
|
|
78
|
+
// (a dedicated tool used to whitelist them; the generic gateway has to do it itself).
|
|
79
|
+
const SECRET_KEY = /secret|passw|token|api_?key|private_?key|access_?key|hash_?key|checksum|signature|credential|webhook_key|qr_data/i;
|
|
80
|
+
/** On a route that hands out credentials (…/token, …/api_key), a bare `key` is the secret too. */
|
|
81
|
+
const SECRET_ROUTE = /token|api_key|secret|credential/i;
|
|
82
|
+
export function redactSecrets(v, secretRoute = false, depth = 0) {
|
|
83
|
+
if (depth > 12 || v === null || typeof v !== "object")
|
|
84
|
+
return v;
|
|
85
|
+
if (Array.isArray(v))
|
|
86
|
+
return v.map((x) => redactSecrets(x, secretRoute, depth + 1));
|
|
87
|
+
const out = {};
|
|
88
|
+
for (const [k, x] of Object.entries(v)) {
|
|
89
|
+
const secret = SECRET_KEY.test(k) || (secretRoute && /^(key|value)$/.test(k));
|
|
90
|
+
out[k] = secret && x !== null && x !== "" && typeof x !== "boolean" && typeof x !== "object" ? "[redacted]" : redactSecrets(x, secretRoute, depth + 1);
|
|
91
|
+
}
|
|
92
|
+
return out;
|
|
93
|
+
}
|
|
74
94
|
const LIST_KEYS = ["data", "items", "products", "orders", "customers", "articles", "results", "list", "records", "entries"];
|
|
75
95
|
/** Trim a response for the model: keep `pick` fields per item, cap list length. */
|
|
76
96
|
export function trimResult(res, pick, maxItems = 50) {
|
|
@@ -122,7 +142,7 @@ export function registerApiGatewayTools(server, api, handle) {
|
|
|
122
142
|
if (DENY[o.id])
|
|
123
143
|
throw new Error(`Refused: ${DENY[o.id]}.`);
|
|
124
144
|
if (o.method !== "GET" && o.tools)
|
|
125
|
-
throw new Error(`Refused: ${o.id} is written through ${o.tools.join(" / ")} — that tool validates and guards this write. Use it instead.`);
|
|
145
|
+
throw new Error(`Refused: ${o.id} is written through ${o.tools.map(callName).join(" / ")} — that tool validates and guards this write. Use it instead.`);
|
|
126
146
|
const params = { ...(args.path_params || {}) };
|
|
127
147
|
if (params.site_id == null && pathParams(o.path).includes("site_id")) {
|
|
128
148
|
if (!api.siteId)
|
|
@@ -153,7 +173,7 @@ export function registerApiGatewayTools(server, api, handle) {
|
|
|
153
173
|
const msg = e?.message || String(e);
|
|
154
174
|
throw new Error(/API 403/.test(msg) && o.perms ? `${msg} — needs site permission ${o.perms.join(" / ")}.` : msg);
|
|
155
175
|
}
|
|
156
|
-
const out = trimResult(res, args.pick, args.max_items ?? 50);
|
|
176
|
+
const out = trimResult(redactSecrets(res, SECRET_ROUTE.test(o.path)), args.pick, args.max_items ?? 50);
|
|
157
177
|
const text = JSON.stringify(out);
|
|
158
178
|
return {
|
|
159
179
|
...(unknown.length ? { unknown_keys: unknown } : {}),
|