@viu/emporix-sdk 2.3.0 → 2.5.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/CHANGELOG.md +107 -0
- package/README.md +23 -3
- package/dist/availability.d.cts +1 -1
- package/dist/availability.d.ts +1 -1
- package/dist/cart.d.cts +1 -1
- package/dist/cart.d.ts +1 -1
- package/dist/category.d.cts +1 -1
- package/dist/category.d.ts +1 -1
- package/dist/checkout.d.cts +1 -1
- package/dist/checkout.d.ts +1 -1
- package/dist/companies.d.cts +1 -1
- package/dist/companies.d.ts +1 -1
- package/dist/contacts.d.cts +1 -1
- package/dist/contacts.d.ts +1 -1
- package/dist/{context-CQFcPZnt.d.cts → context-CgUWXqEt.d.cts} +1 -1
- package/dist/{context-CQFcPZnt.d.ts → context-CgUWXqEt.d.ts} +1 -1
- package/dist/customer-groups.d.cts +1 -1
- package/dist/customer-groups.d.ts +1 -1
- package/dist/customer.d.cts +1 -1
- package/dist/customer.d.ts +1 -1
- package/dist/index.cjs +1771 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4914 -25
- package/dist/index.d.ts +4914 -25
- package/dist/index.js +1755 -2
- package/dist/index.js.map +1 -1
- package/dist/locations.d.cts +1 -1
- package/dist/locations.d.ts +1 -1
- package/dist/media.d.cts +1 -1
- package/dist/media.d.ts +1 -1
- package/dist/orders.d.cts +1 -1
- package/dist/orders.d.ts +1 -1
- package/dist/payment.d.cts +1 -1
- package/dist/payment.d.ts +1 -1
- package/dist/price.d.cts +1 -1
- package/dist/price.d.ts +1 -1
- package/dist/product.d.cts +1 -1
- package/dist/product.d.ts +1 -1
- package/dist/segment.d.cts +1 -1
- package/dist/segment.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1689,8 +1689,1727 @@ var AiService = class {
|
|
|
1689
1689
|
}
|
|
1690
1690
|
};
|
|
1691
1691
|
|
|
1692
|
+
// src/services/tax.ts
|
|
1693
|
+
var SERVICE9 = { kind: "service" };
|
|
1694
|
+
var TaxService = class {
|
|
1695
|
+
constructor(ctx) {
|
|
1696
|
+
this.ctx = ctx;
|
|
1697
|
+
}
|
|
1698
|
+
ctx;
|
|
1699
|
+
base() {
|
|
1700
|
+
return `/tax/${this.ctx.tenant}`;
|
|
1701
|
+
}
|
|
1702
|
+
/** List all per-location tax configurations. */
|
|
1703
|
+
async listTaxConfigs(auth2 = SERVICE9) {
|
|
1704
|
+
return this.ctx.http.request({
|
|
1705
|
+
method: "GET",
|
|
1706
|
+
path: `${this.base()}/taxes`,
|
|
1707
|
+
auth: auth2
|
|
1708
|
+
});
|
|
1709
|
+
}
|
|
1710
|
+
/** Retrieve one tax configuration by its location (country) code. */
|
|
1711
|
+
async getTaxConfig(locationCode, auth2 = SERVICE9) {
|
|
1712
|
+
return this.ctx.http.request({
|
|
1713
|
+
method: "GET",
|
|
1714
|
+
path: `${this.base()}/taxes/${encodeURIComponent(locationCode)}`,
|
|
1715
|
+
auth: auth2
|
|
1716
|
+
});
|
|
1717
|
+
}
|
|
1718
|
+
/** Create a tax configuration (`POST`). Returns the created `{ locationCode }`. */
|
|
1719
|
+
async createTaxConfig(input, auth2 = SERVICE9) {
|
|
1720
|
+
return this.ctx.http.request({
|
|
1721
|
+
method: "POST",
|
|
1722
|
+
path: `${this.base()}/taxes`,
|
|
1723
|
+
auth: auth2,
|
|
1724
|
+
body: input
|
|
1725
|
+
});
|
|
1726
|
+
}
|
|
1727
|
+
/**
|
|
1728
|
+
* Update a tax configuration by location code (`PUT`). `metadata.version` is
|
|
1729
|
+
* required (optimistic locking — a stale version yields 409).
|
|
1730
|
+
*/
|
|
1731
|
+
async updateTaxConfig(locationCode, input, auth2 = SERVICE9) {
|
|
1732
|
+
return this.ctx.http.request({
|
|
1733
|
+
method: "PUT",
|
|
1734
|
+
path: `${this.base()}/taxes/${encodeURIComponent(locationCode)}`,
|
|
1735
|
+
auth: auth2,
|
|
1736
|
+
body: input
|
|
1737
|
+
});
|
|
1738
|
+
}
|
|
1739
|
+
/** Delete a tax configuration by location code. */
|
|
1740
|
+
async deleteTaxConfig(locationCode, auth2 = SERVICE9) {
|
|
1741
|
+
await this.ctx.http.request({
|
|
1742
|
+
method: "DELETE",
|
|
1743
|
+
path: `${this.base()}/taxes/${encodeURIComponent(locationCode)}`,
|
|
1744
|
+
auth: auth2
|
|
1745
|
+
});
|
|
1746
|
+
}
|
|
1747
|
+
/**
|
|
1748
|
+
* Calculate net/gross values for a price (`PUT /taxes/calculation-commands`).
|
|
1749
|
+
* Single command in, single result out.
|
|
1750
|
+
*/
|
|
1751
|
+
async calculateTax(request, auth2 = SERVICE9) {
|
|
1752
|
+
return this.ctx.http.request({
|
|
1753
|
+
method: "PUT",
|
|
1754
|
+
path: `${this.base()}/taxes/calculation-commands`,
|
|
1755
|
+
auth: auth2,
|
|
1756
|
+
body: request
|
|
1757
|
+
});
|
|
1758
|
+
}
|
|
1759
|
+
};
|
|
1760
|
+
|
|
1761
|
+
// src/services/coupon.ts
|
|
1762
|
+
var SERVICE10 = { kind: "service" };
|
|
1763
|
+
var CouponService = class {
|
|
1764
|
+
constructor(ctx) {
|
|
1765
|
+
this.ctx = ctx;
|
|
1766
|
+
}
|
|
1767
|
+
ctx;
|
|
1768
|
+
base() {
|
|
1769
|
+
return `/coupon/${this.ctx.tenant}`;
|
|
1770
|
+
}
|
|
1771
|
+
/** List coupons by criteria. Returns a plain array. */
|
|
1772
|
+
async listCoupons(query = {}, auth2 = SERVICE10) {
|
|
1773
|
+
return this.ctx.http.request({
|
|
1774
|
+
method: "GET",
|
|
1775
|
+
path: `${this.base()}/coupons`,
|
|
1776
|
+
auth: auth2,
|
|
1777
|
+
...Object.keys(query).length ? { query } : {}
|
|
1778
|
+
});
|
|
1779
|
+
}
|
|
1780
|
+
/** Retrieve one coupon by code. */
|
|
1781
|
+
async getCoupon(code, auth2 = SERVICE10) {
|
|
1782
|
+
return this.ctx.http.request({
|
|
1783
|
+
method: "GET",
|
|
1784
|
+
path: `${this.base()}/coupons/${encodeURIComponent(code)}`,
|
|
1785
|
+
auth: auth2
|
|
1786
|
+
});
|
|
1787
|
+
}
|
|
1788
|
+
/** Create a coupon (`POST`, HTTP 201). Returns the created resource's `{ id?, yrn? }`. */
|
|
1789
|
+
async createCoupon(input, auth2 = SERVICE10) {
|
|
1790
|
+
return this.ctx.http.request({
|
|
1791
|
+
method: "POST",
|
|
1792
|
+
path: `${this.base()}/coupons`,
|
|
1793
|
+
auth: auth2,
|
|
1794
|
+
body: input
|
|
1795
|
+
});
|
|
1796
|
+
}
|
|
1797
|
+
/** Replace a coupon by code (`PUT`). Resolves once the update is accepted. */
|
|
1798
|
+
async updateCoupon(code, input, auth2 = SERVICE10) {
|
|
1799
|
+
await this.ctx.http.request({
|
|
1800
|
+
method: "PUT",
|
|
1801
|
+
path: `${this.base()}/coupons/${encodeURIComponent(code)}`,
|
|
1802
|
+
auth: auth2,
|
|
1803
|
+
body: input
|
|
1804
|
+
});
|
|
1805
|
+
}
|
|
1806
|
+
/** Partially update a coupon by code (`PATCH` merge body). */
|
|
1807
|
+
async patchCoupon(code, patch, auth2 = SERVICE10) {
|
|
1808
|
+
await this.ctx.http.request({
|
|
1809
|
+
method: "PATCH",
|
|
1810
|
+
path: `${this.base()}/coupons/${encodeURIComponent(code)}`,
|
|
1811
|
+
auth: auth2,
|
|
1812
|
+
body: patch
|
|
1813
|
+
});
|
|
1814
|
+
}
|
|
1815
|
+
/** Delete a coupon by code. */
|
|
1816
|
+
async deleteCoupon(code, auth2 = SERVICE10) {
|
|
1817
|
+
await this.ctx.http.request({
|
|
1818
|
+
method: "DELETE",
|
|
1819
|
+
path: `${this.base()}/coupons/${encodeURIComponent(code)}`,
|
|
1820
|
+
auth: auth2
|
|
1821
|
+
});
|
|
1822
|
+
}
|
|
1823
|
+
/**
|
|
1824
|
+
* Check whether a coupon can be redeemed (`POST /validation`). Resolves when
|
|
1825
|
+
* redeemable; throws an `EmporixError` otherwise (no response body).
|
|
1826
|
+
*/
|
|
1827
|
+
async validateCoupon(code, redemption, auth2 = SERVICE10) {
|
|
1828
|
+
await this.ctx.http.request({
|
|
1829
|
+
method: "POST",
|
|
1830
|
+
path: `${this.base()}/coupons/${encodeURIComponent(code)}/validation`,
|
|
1831
|
+
auth: auth2,
|
|
1832
|
+
body: redemption
|
|
1833
|
+
});
|
|
1834
|
+
}
|
|
1835
|
+
/** List a coupon's redemptions by criteria. */
|
|
1836
|
+
async listRedemptions(code, query = {}, auth2 = SERVICE10) {
|
|
1837
|
+
return this.ctx.http.request({
|
|
1838
|
+
method: "GET",
|
|
1839
|
+
path: `${this.base()}/coupons/${encodeURIComponent(code)}/redemptions`,
|
|
1840
|
+
auth: auth2,
|
|
1841
|
+
...Object.keys(query).length ? { query } : {}
|
|
1842
|
+
});
|
|
1843
|
+
}
|
|
1844
|
+
/** Redeem a coupon by creating a redemption (`POST`, HTTP 201). Returns the resource location. */
|
|
1845
|
+
async redeemCoupon(code, redemption, auth2 = SERVICE10) {
|
|
1846
|
+
return this.ctx.http.request({
|
|
1847
|
+
method: "POST",
|
|
1848
|
+
path: `${this.base()}/coupons/${encodeURIComponent(code)}/redemptions`,
|
|
1849
|
+
auth: auth2,
|
|
1850
|
+
body: redemption
|
|
1851
|
+
});
|
|
1852
|
+
}
|
|
1853
|
+
/** Retrieve one redemption by id. */
|
|
1854
|
+
async getRedemption(code, id, auth2 = SERVICE10) {
|
|
1855
|
+
return this.ctx.http.request({
|
|
1856
|
+
method: "GET",
|
|
1857
|
+
path: `${this.base()}/coupons/${encodeURIComponent(code)}/redemptions/${encodeURIComponent(id)}`,
|
|
1858
|
+
auth: auth2
|
|
1859
|
+
});
|
|
1860
|
+
}
|
|
1861
|
+
/** Delete a redemption by id. */
|
|
1862
|
+
async deleteRedemption(code, id, auth2 = SERVICE10) {
|
|
1863
|
+
await this.ctx.http.request({
|
|
1864
|
+
method: "DELETE",
|
|
1865
|
+
path: `${this.base()}/coupons/${encodeURIComponent(code)}/redemptions/${encodeURIComponent(id)}`,
|
|
1866
|
+
auth: auth2
|
|
1867
|
+
});
|
|
1868
|
+
}
|
|
1869
|
+
/** Retrieve a customer's referral coupon (resolves to an empty body when none exists). */
|
|
1870
|
+
async getReferralCoupon(customerNumber, auth2 = SERVICE10) {
|
|
1871
|
+
return this.ctx.http.request({
|
|
1872
|
+
method: "GET",
|
|
1873
|
+
path: `${this.base()}/referral-coupons/${encodeURIComponent(customerNumber)}`,
|
|
1874
|
+
auth: auth2
|
|
1875
|
+
});
|
|
1876
|
+
}
|
|
1877
|
+
/** Create a referral coupon code for a customer (no request body). */
|
|
1878
|
+
async createReferralCoupon(customerNumber, auth2 = SERVICE10) {
|
|
1879
|
+
return this.ctx.http.request({
|
|
1880
|
+
method: "POST",
|
|
1881
|
+
path: `${this.base()}/referral-coupons/${encodeURIComponent(customerNumber)}`,
|
|
1882
|
+
auth: auth2
|
|
1883
|
+
});
|
|
1884
|
+
}
|
|
1885
|
+
};
|
|
1886
|
+
|
|
1887
|
+
// src/services/reward-points.ts
|
|
1888
|
+
var SERVICE11 = { kind: "service" };
|
|
1889
|
+
var RewardPointsService = class {
|
|
1890
|
+
constructor(ctx) {
|
|
1891
|
+
this.ctx = ctx;
|
|
1892
|
+
}
|
|
1893
|
+
ctx;
|
|
1894
|
+
/** Base without tenant (customer / public / batch endpoints). */
|
|
1895
|
+
base() {
|
|
1896
|
+
return `/reward-points`;
|
|
1897
|
+
}
|
|
1898
|
+
/** Tenant-scoped base (redeem options only). */
|
|
1899
|
+
tenantBase() {
|
|
1900
|
+
return `/reward-points/${this.ctx.tenant}`;
|
|
1901
|
+
}
|
|
1902
|
+
// --- Admin: customer points management (service token) ---
|
|
1903
|
+
/** Batch summary across all customers. */
|
|
1904
|
+
async listAllSummaries(query = {}, auth2 = SERVICE11) {
|
|
1905
|
+
return this.ctx.http.request({
|
|
1906
|
+
method: "GET",
|
|
1907
|
+
path: `${this.base()}/summaryBatch`,
|
|
1908
|
+
auth: auth2,
|
|
1909
|
+
...Object.keys(query).length ? { query } : {}
|
|
1910
|
+
});
|
|
1911
|
+
}
|
|
1912
|
+
/** Retrieve one customer's reward-points balance. */
|
|
1913
|
+
async getCustomerPoints(customerId, auth2 = SERVICE11) {
|
|
1914
|
+
return this.ctx.http.request({
|
|
1915
|
+
method: "GET",
|
|
1916
|
+
path: `${this.base()}/customer/${encodeURIComponent(customerId)}`,
|
|
1917
|
+
auth: auth2
|
|
1918
|
+
});
|
|
1919
|
+
}
|
|
1920
|
+
/** Create a reward-points entry for a customer. */
|
|
1921
|
+
async createCustomerPoints(customerId, input, auth2 = SERVICE11) {
|
|
1922
|
+
await this.ctx.http.request({
|
|
1923
|
+
method: "POST",
|
|
1924
|
+
path: `${this.base()}/customer/${encodeURIComponent(customerId)}`,
|
|
1925
|
+
auth: auth2,
|
|
1926
|
+
body: input
|
|
1927
|
+
});
|
|
1928
|
+
}
|
|
1929
|
+
/** Delete a customer's reward points. */
|
|
1930
|
+
async deleteCustomerPoints(customerId, auth2 = SERVICE11) {
|
|
1931
|
+
await this.ctx.http.request({
|
|
1932
|
+
method: "DELETE",
|
|
1933
|
+
path: `${this.base()}/customer/${encodeURIComponent(customerId)}`,
|
|
1934
|
+
auth: auth2
|
|
1935
|
+
});
|
|
1936
|
+
}
|
|
1937
|
+
/** Retrieve a reward-points summary for one customer. */
|
|
1938
|
+
async getCustomerSummary(customerId, auth2 = SERVICE11) {
|
|
1939
|
+
return this.ctx.http.request({
|
|
1940
|
+
method: "GET",
|
|
1941
|
+
path: `${this.base()}/customer/${encodeURIComponent(customerId)}/summary`,
|
|
1942
|
+
auth: auth2
|
|
1943
|
+
});
|
|
1944
|
+
}
|
|
1945
|
+
/** Add reward points for a customer. */
|
|
1946
|
+
async addPoints(customerId, input, auth2 = SERVICE11) {
|
|
1947
|
+
await this.ctx.http.request({
|
|
1948
|
+
method: "POST",
|
|
1949
|
+
path: `${this.base()}/customer/${encodeURIComponent(customerId)}/addPoints`,
|
|
1950
|
+
auth: auth2,
|
|
1951
|
+
body: input
|
|
1952
|
+
});
|
|
1953
|
+
}
|
|
1954
|
+
/** Redeem a customer's reward points (on behalf). */
|
|
1955
|
+
async redeemPoints(customerId, input, auth2 = SERVICE11) {
|
|
1956
|
+
await this.ctx.http.request({
|
|
1957
|
+
method: "POST",
|
|
1958
|
+
path: `${this.base()}/customer/${encodeURIComponent(customerId)}/redeemPoints`,
|
|
1959
|
+
auth: auth2,
|
|
1960
|
+
body: input
|
|
1961
|
+
});
|
|
1962
|
+
}
|
|
1963
|
+
// --- Storefront: the signed-in customer's own points (customer token required) ---
|
|
1964
|
+
/** The signed-in customer's reward-points balance. Requires a customer `auth`. */
|
|
1965
|
+
async getMyPoints(auth2) {
|
|
1966
|
+
return this.ctx.http.request({
|
|
1967
|
+
method: "GET",
|
|
1968
|
+
path: `${this.base()}/public/customer`,
|
|
1969
|
+
auth: auth2
|
|
1970
|
+
});
|
|
1971
|
+
}
|
|
1972
|
+
/** The signed-in customer's reward-points summary. Requires a customer `auth`. */
|
|
1973
|
+
async getMySummary(auth2) {
|
|
1974
|
+
return this.ctx.http.request({
|
|
1975
|
+
method: "GET",
|
|
1976
|
+
path: `${this.base()}/public/customer/summary`,
|
|
1977
|
+
auth: auth2
|
|
1978
|
+
});
|
|
1979
|
+
}
|
|
1980
|
+
/**
|
|
1981
|
+
* Redeem the signed-in customer's points for a coupon code. Requires a
|
|
1982
|
+
* customer `auth`. Returns the issued coupon `{ code }`.
|
|
1983
|
+
*/
|
|
1984
|
+
async redeemMyPoints(input, auth2) {
|
|
1985
|
+
return this.ctx.http.request({
|
|
1986
|
+
method: "POST",
|
|
1987
|
+
path: `${this.base()}/public/customer/redeem`,
|
|
1988
|
+
auth: auth2,
|
|
1989
|
+
body: input
|
|
1990
|
+
});
|
|
1991
|
+
}
|
|
1992
|
+
// --- Redeem options (tenant-scoped; read open to customer, management service-only) ---
|
|
1993
|
+
/** List redeem options. Defaults to the service token; pass a customer `auth` for storefront reads. */
|
|
1994
|
+
async listRedeemOptions(auth2 = SERVICE11) {
|
|
1995
|
+
return this.ctx.http.request({
|
|
1996
|
+
method: "GET",
|
|
1997
|
+
path: `${this.tenantBase()}/redeemOptions`,
|
|
1998
|
+
auth: auth2
|
|
1999
|
+
});
|
|
2000
|
+
}
|
|
2001
|
+
/** Create a redeem option. Returns the updated options list. */
|
|
2002
|
+
async createRedeemOption(input, auth2 = SERVICE11) {
|
|
2003
|
+
return this.ctx.http.request({
|
|
2004
|
+
method: "POST",
|
|
2005
|
+
path: `${this.tenantBase()}/redeemOptions`,
|
|
2006
|
+
auth: auth2,
|
|
2007
|
+
body: input
|
|
2008
|
+
});
|
|
2009
|
+
}
|
|
2010
|
+
/** Update a redeem option by id. Resolves once accepted (no response body). */
|
|
2011
|
+
async updateRedeemOption(redeemOptionId, input, auth2 = SERVICE11) {
|
|
2012
|
+
await this.ctx.http.request({
|
|
2013
|
+
method: "PUT",
|
|
2014
|
+
path: `${this.tenantBase()}/redeemOptions/${encodeURIComponent(redeemOptionId)}`,
|
|
2015
|
+
auth: auth2,
|
|
2016
|
+
body: input
|
|
2017
|
+
});
|
|
2018
|
+
}
|
|
2019
|
+
/** Delete a redeem option by id. */
|
|
2020
|
+
async deleteRedeemOption(redeemOptionId, auth2 = SERVICE11) {
|
|
2021
|
+
await this.ctx.http.request({
|
|
2022
|
+
method: "DELETE",
|
|
2023
|
+
path: `${this.tenantBase()}/redeemOptions/${encodeURIComponent(redeemOptionId)}`,
|
|
2024
|
+
auth: auth2
|
|
2025
|
+
});
|
|
2026
|
+
}
|
|
2027
|
+
};
|
|
2028
|
+
|
|
2029
|
+
// src/services/brand.ts
|
|
2030
|
+
var SERVICE12 = { kind: "service" };
|
|
2031
|
+
var BrandService = class {
|
|
2032
|
+
constructor(ctx) {
|
|
2033
|
+
this.ctx = ctx;
|
|
2034
|
+
}
|
|
2035
|
+
ctx;
|
|
2036
|
+
base() {
|
|
2037
|
+
return `/brand/brands`;
|
|
2038
|
+
}
|
|
2039
|
+
/** List all brands. */
|
|
2040
|
+
async listBrands(query = {}, auth2 = SERVICE12) {
|
|
2041
|
+
return this.ctx.http.request({
|
|
2042
|
+
method: "GET",
|
|
2043
|
+
path: this.base(),
|
|
2044
|
+
auth: auth2,
|
|
2045
|
+
...Object.keys(query).length ? { query } : {}
|
|
2046
|
+
});
|
|
2047
|
+
}
|
|
2048
|
+
/** Retrieve one brand by id. */
|
|
2049
|
+
async getBrand(brandId, auth2 = SERVICE12) {
|
|
2050
|
+
return this.ctx.http.request({
|
|
2051
|
+
method: "GET",
|
|
2052
|
+
path: `${this.base()}/${encodeURIComponent(brandId)}`,
|
|
2053
|
+
auth: auth2
|
|
2054
|
+
});
|
|
2055
|
+
}
|
|
2056
|
+
/** Create a brand. */
|
|
2057
|
+
async createBrand(input, auth2 = SERVICE12) {
|
|
2058
|
+
return this.ctx.http.request({
|
|
2059
|
+
method: "POST",
|
|
2060
|
+
path: this.base(),
|
|
2061
|
+
auth: auth2,
|
|
2062
|
+
body: input
|
|
2063
|
+
});
|
|
2064
|
+
}
|
|
2065
|
+
/** Replace a brand by id. */
|
|
2066
|
+
async updateBrand(brandId, input, auth2 = SERVICE12) {
|
|
2067
|
+
return this.ctx.http.request({
|
|
2068
|
+
method: "PUT",
|
|
2069
|
+
path: `${this.base()}/${encodeURIComponent(brandId)}`,
|
|
2070
|
+
auth: auth2,
|
|
2071
|
+
body: input
|
|
2072
|
+
});
|
|
2073
|
+
}
|
|
2074
|
+
/** Partially update a brand by id. */
|
|
2075
|
+
async patchBrand(brandId, patch, auth2 = SERVICE12) {
|
|
2076
|
+
return this.ctx.http.request({
|
|
2077
|
+
method: "PATCH",
|
|
2078
|
+
path: `${this.base()}/${encodeURIComponent(brandId)}`,
|
|
2079
|
+
auth: auth2,
|
|
2080
|
+
body: patch
|
|
2081
|
+
});
|
|
2082
|
+
}
|
|
2083
|
+
/** Delete a brand by id. */
|
|
2084
|
+
async deleteBrand(brandId, auth2 = SERVICE12) {
|
|
2085
|
+
await this.ctx.http.request({
|
|
2086
|
+
method: "DELETE",
|
|
2087
|
+
path: `${this.base()}/${encodeURIComponent(brandId)}`,
|
|
2088
|
+
auth: auth2
|
|
2089
|
+
});
|
|
2090
|
+
}
|
|
2091
|
+
};
|
|
2092
|
+
|
|
2093
|
+
// src/services/label.ts
|
|
2094
|
+
var SERVICE13 = { kind: "service" };
|
|
2095
|
+
var LabelService = class {
|
|
2096
|
+
constructor(ctx) {
|
|
2097
|
+
this.ctx = ctx;
|
|
2098
|
+
}
|
|
2099
|
+
ctx;
|
|
2100
|
+
base() {
|
|
2101
|
+
return `/label/labels`;
|
|
2102
|
+
}
|
|
2103
|
+
/** List all labels. */
|
|
2104
|
+
async listLabels(query = {}, auth2 = SERVICE13) {
|
|
2105
|
+
return this.ctx.http.request({
|
|
2106
|
+
method: "GET",
|
|
2107
|
+
path: this.base(),
|
|
2108
|
+
auth: auth2,
|
|
2109
|
+
...Object.keys(query).length ? { query } : {}
|
|
2110
|
+
});
|
|
2111
|
+
}
|
|
2112
|
+
/** Retrieve one label by id. */
|
|
2113
|
+
async getLabel(labelId, auth2 = SERVICE13) {
|
|
2114
|
+
return this.ctx.http.request({
|
|
2115
|
+
method: "GET",
|
|
2116
|
+
path: `${this.base()}/${encodeURIComponent(labelId)}`,
|
|
2117
|
+
auth: auth2
|
|
2118
|
+
});
|
|
2119
|
+
}
|
|
2120
|
+
/** Create a label. */
|
|
2121
|
+
async createLabel(input, auth2 = SERVICE13) {
|
|
2122
|
+
return this.ctx.http.request({
|
|
2123
|
+
method: "POST",
|
|
2124
|
+
path: this.base(),
|
|
2125
|
+
auth: auth2,
|
|
2126
|
+
body: input
|
|
2127
|
+
});
|
|
2128
|
+
}
|
|
2129
|
+
/** Replace a label by id. */
|
|
2130
|
+
async updateLabel(labelId, input, auth2 = SERVICE13) {
|
|
2131
|
+
return this.ctx.http.request({
|
|
2132
|
+
method: "PUT",
|
|
2133
|
+
path: `${this.base()}/${encodeURIComponent(labelId)}`,
|
|
2134
|
+
auth: auth2,
|
|
2135
|
+
body: input
|
|
2136
|
+
});
|
|
2137
|
+
}
|
|
2138
|
+
/** Partially update a label by id. */
|
|
2139
|
+
async patchLabel(labelId, patch, auth2 = SERVICE13) {
|
|
2140
|
+
return this.ctx.http.request({
|
|
2141
|
+
method: "PATCH",
|
|
2142
|
+
path: `${this.base()}/${encodeURIComponent(labelId)}`,
|
|
2143
|
+
auth: auth2,
|
|
2144
|
+
body: patch
|
|
2145
|
+
});
|
|
2146
|
+
}
|
|
2147
|
+
/** Delete a label by id. */
|
|
2148
|
+
async deleteLabel(labelId, auth2 = SERVICE13) {
|
|
2149
|
+
await this.ctx.http.request({
|
|
2150
|
+
method: "DELETE",
|
|
2151
|
+
path: `${this.base()}/${encodeURIComponent(labelId)}`,
|
|
2152
|
+
auth: auth2
|
|
2153
|
+
});
|
|
2154
|
+
}
|
|
2155
|
+
};
|
|
2156
|
+
|
|
2157
|
+
// src/services/country.ts
|
|
2158
|
+
var SERVICE14 = { kind: "service" };
|
|
2159
|
+
var CountryService = class {
|
|
2160
|
+
constructor(ctx) {
|
|
2161
|
+
this.ctx = ctx;
|
|
2162
|
+
}
|
|
2163
|
+
ctx;
|
|
2164
|
+
base() {
|
|
2165
|
+
return `/country/${this.ctx.tenant}`;
|
|
2166
|
+
}
|
|
2167
|
+
/** List all countries. */
|
|
2168
|
+
async listCountries(query = {}, auth2 = SERVICE14) {
|
|
2169
|
+
return this.ctx.http.request({
|
|
2170
|
+
method: "GET",
|
|
2171
|
+
path: `${this.base()}/countries`,
|
|
2172
|
+
auth: auth2,
|
|
2173
|
+
...Object.keys(query).length ? { query } : {}
|
|
2174
|
+
});
|
|
2175
|
+
}
|
|
2176
|
+
/** Retrieve one country by code. */
|
|
2177
|
+
async getCountry(countryCode, auth2 = SERVICE14) {
|
|
2178
|
+
return this.ctx.http.request({
|
|
2179
|
+
method: "GET",
|
|
2180
|
+
path: `${this.base()}/countries/${encodeURIComponent(countryCode)}`,
|
|
2181
|
+
auth: auth2
|
|
2182
|
+
});
|
|
2183
|
+
}
|
|
2184
|
+
/** Partially update a country by code. Resolves once accepted (no response body). */
|
|
2185
|
+
async patchCountry(countryCode, patch, auth2 = SERVICE14) {
|
|
2186
|
+
await this.ctx.http.request({
|
|
2187
|
+
method: "PATCH",
|
|
2188
|
+
path: `${this.base()}/countries/${encodeURIComponent(countryCode)}`,
|
|
2189
|
+
auth: auth2,
|
|
2190
|
+
body: patch
|
|
2191
|
+
});
|
|
2192
|
+
}
|
|
2193
|
+
/** List all regions. */
|
|
2194
|
+
async listRegions(query = {}, auth2 = SERVICE14) {
|
|
2195
|
+
return this.ctx.http.request({
|
|
2196
|
+
method: "GET",
|
|
2197
|
+
path: `${this.base()}/regions`,
|
|
2198
|
+
auth: auth2,
|
|
2199
|
+
...Object.keys(query).length ? { query } : {}
|
|
2200
|
+
});
|
|
2201
|
+
}
|
|
2202
|
+
/** Retrieve one region by code. */
|
|
2203
|
+
async getRegion(regionCode, auth2 = SERVICE14) {
|
|
2204
|
+
return this.ctx.http.request({
|
|
2205
|
+
method: "GET",
|
|
2206
|
+
path: `${this.base()}/regions/${encodeURIComponent(regionCode)}`,
|
|
2207
|
+
auth: auth2
|
|
2208
|
+
});
|
|
2209
|
+
}
|
|
2210
|
+
};
|
|
2211
|
+
|
|
2212
|
+
// src/services/currency.ts
|
|
2213
|
+
var SERVICE15 = { kind: "service" };
|
|
2214
|
+
var CurrencyService = class {
|
|
2215
|
+
constructor(ctx) {
|
|
2216
|
+
this.ctx = ctx;
|
|
2217
|
+
}
|
|
2218
|
+
ctx;
|
|
2219
|
+
base() {
|
|
2220
|
+
return `/currency/${this.ctx.tenant}`;
|
|
2221
|
+
}
|
|
2222
|
+
// --- Currencies ---
|
|
2223
|
+
/** List all currencies. */
|
|
2224
|
+
async listCurrencies(query = {}, auth2 = SERVICE15) {
|
|
2225
|
+
return this.ctx.http.request({
|
|
2226
|
+
method: "GET",
|
|
2227
|
+
path: `${this.base()}/currencies`,
|
|
2228
|
+
auth: auth2,
|
|
2229
|
+
...Object.keys(query).length ? { query } : {}
|
|
2230
|
+
});
|
|
2231
|
+
}
|
|
2232
|
+
/** Retrieve one currency by code. */
|
|
2233
|
+
async getCurrency(code, auth2 = SERVICE15) {
|
|
2234
|
+
return this.ctx.http.request({
|
|
2235
|
+
method: "GET",
|
|
2236
|
+
path: `${this.base()}/currencies/${encodeURIComponent(code)}`,
|
|
2237
|
+
auth: auth2
|
|
2238
|
+
});
|
|
2239
|
+
}
|
|
2240
|
+
/** Create a currency. */
|
|
2241
|
+
async createCurrency(input, auth2 = SERVICE15) {
|
|
2242
|
+
return this.ctx.http.request({
|
|
2243
|
+
method: "POST",
|
|
2244
|
+
path: `${this.base()}/currencies`,
|
|
2245
|
+
auth: auth2,
|
|
2246
|
+
body: input
|
|
2247
|
+
});
|
|
2248
|
+
}
|
|
2249
|
+
/** Update a currency by code. */
|
|
2250
|
+
async updateCurrency(code, input, auth2 = SERVICE15) {
|
|
2251
|
+
return this.ctx.http.request({
|
|
2252
|
+
method: "PUT",
|
|
2253
|
+
path: `${this.base()}/currencies/${encodeURIComponent(code)}`,
|
|
2254
|
+
auth: auth2,
|
|
2255
|
+
body: input
|
|
2256
|
+
});
|
|
2257
|
+
}
|
|
2258
|
+
/** Delete a currency by code. */
|
|
2259
|
+
async deleteCurrency(code, auth2 = SERVICE15) {
|
|
2260
|
+
await this.ctx.http.request({
|
|
2261
|
+
method: "DELETE",
|
|
2262
|
+
path: `${this.base()}/currencies/${encodeURIComponent(code)}`,
|
|
2263
|
+
auth: auth2
|
|
2264
|
+
});
|
|
2265
|
+
}
|
|
2266
|
+
// --- Exchange rates ---
|
|
2267
|
+
/** List all exchange rates. */
|
|
2268
|
+
async listExchangeRates(query = {}, auth2 = SERVICE15) {
|
|
2269
|
+
return this.ctx.http.request({
|
|
2270
|
+
method: "GET",
|
|
2271
|
+
path: `${this.base()}/exchanges`,
|
|
2272
|
+
auth: auth2,
|
|
2273
|
+
...Object.keys(query).length ? { query } : {}
|
|
2274
|
+
});
|
|
2275
|
+
}
|
|
2276
|
+
/** Retrieve one exchange rate by code. */
|
|
2277
|
+
async getExchangeRate(code, auth2 = SERVICE15) {
|
|
2278
|
+
return this.ctx.http.request({
|
|
2279
|
+
method: "GET",
|
|
2280
|
+
path: `${this.base()}/exchanges/${encodeURIComponent(code)}`,
|
|
2281
|
+
auth: auth2
|
|
2282
|
+
});
|
|
2283
|
+
}
|
|
2284
|
+
/** Create an exchange rate. */
|
|
2285
|
+
async createExchangeRate(input, auth2 = SERVICE15) {
|
|
2286
|
+
return this.ctx.http.request({
|
|
2287
|
+
method: "POST",
|
|
2288
|
+
path: `${this.base()}/exchanges`,
|
|
2289
|
+
auth: auth2,
|
|
2290
|
+
body: input
|
|
2291
|
+
});
|
|
2292
|
+
}
|
|
2293
|
+
/** Update an exchange rate by code. */
|
|
2294
|
+
async updateExchangeRate(code, input, auth2 = SERVICE15) {
|
|
2295
|
+
return this.ctx.http.request({
|
|
2296
|
+
method: "PUT",
|
|
2297
|
+
path: `${this.base()}/exchanges/${encodeURIComponent(code)}`,
|
|
2298
|
+
auth: auth2,
|
|
2299
|
+
body: input
|
|
2300
|
+
});
|
|
2301
|
+
}
|
|
2302
|
+
/** Delete an exchange rate by code. */
|
|
2303
|
+
async deleteExchangeRate(code, auth2 = SERVICE15) {
|
|
2304
|
+
await this.ctx.http.request({
|
|
2305
|
+
method: "DELETE",
|
|
2306
|
+
path: `${this.base()}/exchanges/${encodeURIComponent(code)}`,
|
|
2307
|
+
auth: auth2
|
|
2308
|
+
});
|
|
2309
|
+
}
|
|
2310
|
+
};
|
|
2311
|
+
|
|
2312
|
+
// src/services/shipping.ts
|
|
2313
|
+
var SERVICE16 = { kind: "service" };
|
|
2314
|
+
var ShippingService = class {
|
|
2315
|
+
constructor(ctx) {
|
|
2316
|
+
this.ctx = ctx;
|
|
2317
|
+
}
|
|
2318
|
+
ctx;
|
|
2319
|
+
base() {
|
|
2320
|
+
return `/shipping/${this.ctx.tenant}`;
|
|
2321
|
+
}
|
|
2322
|
+
siteBase(site) {
|
|
2323
|
+
return `${this.base()}/${encodeURIComponent(site)}`;
|
|
2324
|
+
}
|
|
2325
|
+
// --- Sites ---
|
|
2326
|
+
/** Find shipping-related sites by postal code (`POST /findSite`). */
|
|
2327
|
+
async findSites(input, auth2 = SERVICE16) {
|
|
2328
|
+
return this.ctx.http.request({
|
|
2329
|
+
method: "POST",
|
|
2330
|
+
path: `${this.base()}/findSite`,
|
|
2331
|
+
auth: auth2,
|
|
2332
|
+
body: input
|
|
2333
|
+
});
|
|
2334
|
+
}
|
|
2335
|
+
// --- Zones ---
|
|
2336
|
+
/** List shipping zones for a site. */
|
|
2337
|
+
async listZones(site, query = {}, auth2 = SERVICE16) {
|
|
2338
|
+
return this.ctx.http.request({
|
|
2339
|
+
method: "GET",
|
|
2340
|
+
path: `${this.siteBase(site)}/zones`,
|
|
2341
|
+
auth: auth2,
|
|
2342
|
+
...Object.keys(query).length ? { query } : {}
|
|
2343
|
+
});
|
|
2344
|
+
}
|
|
2345
|
+
/** Retrieve one shipping zone. */
|
|
2346
|
+
async getZone(site, zoneId, auth2 = SERVICE16) {
|
|
2347
|
+
return this.ctx.http.request({
|
|
2348
|
+
method: "GET",
|
|
2349
|
+
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}`,
|
|
2350
|
+
auth: auth2
|
|
2351
|
+
});
|
|
2352
|
+
}
|
|
2353
|
+
/** Create a shipping zone. */
|
|
2354
|
+
async createZone(site, zone, auth2 = SERVICE16) {
|
|
2355
|
+
return this.ctx.http.request({
|
|
2356
|
+
method: "POST",
|
|
2357
|
+
path: `${this.siteBase(site)}/zones`,
|
|
2358
|
+
auth: auth2,
|
|
2359
|
+
body: zone
|
|
2360
|
+
});
|
|
2361
|
+
}
|
|
2362
|
+
/** Replace a shipping zone. */
|
|
2363
|
+
async updateZone(site, zoneId, zone, auth2 = SERVICE16) {
|
|
2364
|
+
await this.ctx.http.request({
|
|
2365
|
+
method: "PUT",
|
|
2366
|
+
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}`,
|
|
2367
|
+
auth: auth2,
|
|
2368
|
+
body: zone
|
|
2369
|
+
});
|
|
2370
|
+
}
|
|
2371
|
+
/** Partially update a shipping zone. */
|
|
2372
|
+
async patchZone(site, zoneId, patch, auth2 = SERVICE16) {
|
|
2373
|
+
await this.ctx.http.request({
|
|
2374
|
+
method: "PATCH",
|
|
2375
|
+
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}`,
|
|
2376
|
+
auth: auth2,
|
|
2377
|
+
body: patch
|
|
2378
|
+
});
|
|
2379
|
+
}
|
|
2380
|
+
/** Delete a shipping zone. */
|
|
2381
|
+
async deleteZone(site, zoneId, auth2 = SERVICE16) {
|
|
2382
|
+
await this.ctx.http.request({
|
|
2383
|
+
method: "DELETE",
|
|
2384
|
+
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}`,
|
|
2385
|
+
auth: auth2
|
|
2386
|
+
});
|
|
2387
|
+
}
|
|
2388
|
+
// --- Methods (per zone) ---
|
|
2389
|
+
/** List shipping methods of a zone. */
|
|
2390
|
+
async listMethods(site, zoneId, query = {}, auth2 = SERVICE16) {
|
|
2391
|
+
return this.ctx.http.request({
|
|
2392
|
+
method: "GET",
|
|
2393
|
+
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}/methods`,
|
|
2394
|
+
auth: auth2,
|
|
2395
|
+
...Object.keys(query).length ? { query } : {}
|
|
2396
|
+
});
|
|
2397
|
+
}
|
|
2398
|
+
/** Retrieve one shipping method. */
|
|
2399
|
+
async getMethod(site, zoneId, methodId, auth2 = SERVICE16) {
|
|
2400
|
+
return this.ctx.http.request({
|
|
2401
|
+
method: "GET",
|
|
2402
|
+
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}/methods/${encodeURIComponent(methodId)}`,
|
|
2403
|
+
auth: auth2
|
|
2404
|
+
});
|
|
2405
|
+
}
|
|
2406
|
+
/** Create a shipping method in a zone. */
|
|
2407
|
+
async createMethod(site, zoneId, method, auth2 = SERVICE16) {
|
|
2408
|
+
return this.ctx.http.request({
|
|
2409
|
+
method: "POST",
|
|
2410
|
+
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}/methods`,
|
|
2411
|
+
auth: auth2,
|
|
2412
|
+
body: method
|
|
2413
|
+
});
|
|
2414
|
+
}
|
|
2415
|
+
/** Replace a shipping method. */
|
|
2416
|
+
async updateMethod(site, zoneId, methodId, method, auth2 = SERVICE16) {
|
|
2417
|
+
await this.ctx.http.request({
|
|
2418
|
+
method: "PUT",
|
|
2419
|
+
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}/methods/${encodeURIComponent(methodId)}`,
|
|
2420
|
+
auth: auth2,
|
|
2421
|
+
body: method
|
|
2422
|
+
});
|
|
2423
|
+
}
|
|
2424
|
+
/** Partially update a shipping method. */
|
|
2425
|
+
async patchMethod(site, zoneId, methodId, patch, auth2 = SERVICE16) {
|
|
2426
|
+
await this.ctx.http.request({
|
|
2427
|
+
method: "PATCH",
|
|
2428
|
+
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}/methods/${encodeURIComponent(methodId)}`,
|
|
2429
|
+
auth: auth2,
|
|
2430
|
+
body: patch
|
|
2431
|
+
});
|
|
2432
|
+
}
|
|
2433
|
+
/** Delete a shipping method. */
|
|
2434
|
+
async deleteMethod(site, zoneId, methodId, auth2 = SERVICE16) {
|
|
2435
|
+
await this.ctx.http.request({
|
|
2436
|
+
method: "DELETE",
|
|
2437
|
+
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}/methods/${encodeURIComponent(methodId)}`,
|
|
2438
|
+
auth: auth2
|
|
2439
|
+
});
|
|
2440
|
+
}
|
|
2441
|
+
// --- Cost / quote ---
|
|
2442
|
+
/** Calculate the final shipping cost (`POST /quote`). */
|
|
2443
|
+
async quote(site, input, auth2 = SERVICE16) {
|
|
2444
|
+
return this.ctx.http.request({
|
|
2445
|
+
method: "POST",
|
|
2446
|
+
path: `${this.siteBase(site)}/quote`,
|
|
2447
|
+
auth: auth2,
|
|
2448
|
+
body: input
|
|
2449
|
+
});
|
|
2450
|
+
}
|
|
2451
|
+
/** Calculate the minimum shipping cost (`POST /quote/minimum`). */
|
|
2452
|
+
async quoteMinimum(site, input, auth2 = SERVICE16) {
|
|
2453
|
+
return this.ctx.http.request({
|
|
2454
|
+
method: "POST",
|
|
2455
|
+
path: `${this.siteBase(site)}/quote/minimum`,
|
|
2456
|
+
auth: auth2,
|
|
2457
|
+
body: input
|
|
2458
|
+
});
|
|
2459
|
+
}
|
|
2460
|
+
/** Calculate the shipping cost for a given slot (`POST /quote/slot`). */
|
|
2461
|
+
async quoteSlot(site, input, auth2 = SERVICE16) {
|
|
2462
|
+
return this.ctx.http.request({
|
|
2463
|
+
method: "POST",
|
|
2464
|
+
path: `${this.siteBase(site)}/quote/slot`,
|
|
2465
|
+
auth: auth2,
|
|
2466
|
+
body: input
|
|
2467
|
+
});
|
|
2468
|
+
}
|
|
2469
|
+
// --- Groups ---
|
|
2470
|
+
/** List shipping groups for a site. */
|
|
2471
|
+
async listGroups(site, query = {}, auth2 = SERVICE16) {
|
|
2472
|
+
return this.ctx.http.request({
|
|
2473
|
+
method: "GET",
|
|
2474
|
+
path: `${this.siteBase(site)}/groups`,
|
|
2475
|
+
auth: auth2,
|
|
2476
|
+
...Object.keys(query).length ? { query } : {}
|
|
2477
|
+
});
|
|
2478
|
+
}
|
|
2479
|
+
/** Retrieve one shipping group. */
|
|
2480
|
+
async getGroup(site, groupId, auth2 = SERVICE16) {
|
|
2481
|
+
return this.ctx.http.request({
|
|
2482
|
+
method: "GET",
|
|
2483
|
+
path: `${this.siteBase(site)}/groups/${encodeURIComponent(groupId)}`,
|
|
2484
|
+
auth: auth2
|
|
2485
|
+
});
|
|
2486
|
+
}
|
|
2487
|
+
/** Create a shipping group. */
|
|
2488
|
+
async createGroup(site, group, auth2 = SERVICE16) {
|
|
2489
|
+
return this.ctx.http.request({
|
|
2490
|
+
method: "POST",
|
|
2491
|
+
path: `${this.siteBase(site)}/groups`,
|
|
2492
|
+
auth: auth2,
|
|
2493
|
+
body: group
|
|
2494
|
+
});
|
|
2495
|
+
}
|
|
2496
|
+
/** Replace a shipping group. */
|
|
2497
|
+
async updateGroup(site, groupId, group, auth2 = SERVICE16) {
|
|
2498
|
+
await this.ctx.http.request({
|
|
2499
|
+
method: "PUT",
|
|
2500
|
+
path: `${this.siteBase(site)}/groups/${encodeURIComponent(groupId)}`,
|
|
2501
|
+
auth: auth2,
|
|
2502
|
+
body: group
|
|
2503
|
+
});
|
|
2504
|
+
}
|
|
2505
|
+
/** Delete a shipping group. */
|
|
2506
|
+
async deleteGroup(site, groupId, auth2 = SERVICE16) {
|
|
2507
|
+
await this.ctx.http.request({
|
|
2508
|
+
method: "DELETE",
|
|
2509
|
+
path: `${this.siteBase(site)}/groups/${encodeURIComponent(groupId)}`,
|
|
2510
|
+
auth: auth2
|
|
2511
|
+
});
|
|
2512
|
+
}
|
|
2513
|
+
// --- Customer-group relations ---
|
|
2514
|
+
/** List customer-group relations for a site. */
|
|
2515
|
+
async listCgRelations(site, query = {}, auth2 = SERVICE16) {
|
|
2516
|
+
return this.ctx.http.request({
|
|
2517
|
+
method: "GET",
|
|
2518
|
+
path: `${this.siteBase(site)}/cgrelations`,
|
|
2519
|
+
auth: auth2,
|
|
2520
|
+
...Object.keys(query).length ? { query } : {}
|
|
2521
|
+
});
|
|
2522
|
+
}
|
|
2523
|
+
/** Retrieve a customer's customer-group relations. */
|
|
2524
|
+
async getCgRelations(site, customerId, auth2 = SERVICE16) {
|
|
2525
|
+
return this.ctx.http.request({
|
|
2526
|
+
method: "GET",
|
|
2527
|
+
path: `${this.siteBase(site)}/cgrelations/${encodeURIComponent(customerId)}`,
|
|
2528
|
+
auth: auth2
|
|
2529
|
+
});
|
|
2530
|
+
}
|
|
2531
|
+
/** Create a customer-group relation. */
|
|
2532
|
+
async createCgRelation(site, relation, auth2 = SERVICE16) {
|
|
2533
|
+
return this.ctx.http.request({
|
|
2534
|
+
method: "POST",
|
|
2535
|
+
path: `${this.siteBase(site)}/cgrelations`,
|
|
2536
|
+
auth: auth2,
|
|
2537
|
+
body: relation
|
|
2538
|
+
});
|
|
2539
|
+
}
|
|
2540
|
+
/** Update a customer's customer-group relations. */
|
|
2541
|
+
async updateCgRelations(site, customerId, relation, auth2 = SERVICE16) {
|
|
2542
|
+
await this.ctx.http.request({
|
|
2543
|
+
method: "PUT",
|
|
2544
|
+
path: `${this.siteBase(site)}/cgrelations/${encodeURIComponent(customerId)}`,
|
|
2545
|
+
auth: auth2,
|
|
2546
|
+
body: relation
|
|
2547
|
+
});
|
|
2548
|
+
}
|
|
2549
|
+
/** Delete a customer's customer-group relation. */
|
|
2550
|
+
async deleteCgRelation(site, customerId, auth2 = SERVICE16) {
|
|
2551
|
+
await this.ctx.http.request({
|
|
2552
|
+
method: "DELETE",
|
|
2553
|
+
path: `${this.siteBase(site)}/cgrelations/${encodeURIComponent(customerId)}`,
|
|
2554
|
+
auth: auth2
|
|
2555
|
+
});
|
|
2556
|
+
}
|
|
2557
|
+
// --- Phase 2: delivery windows ---
|
|
2558
|
+
/** Retrieve delivery windows for a delivery area + cart. */
|
|
2559
|
+
async getAreaDeliveryWindows(deliveryAreaId, cartId, auth2 = SERVICE16) {
|
|
2560
|
+
return this.ctx.http.request({
|
|
2561
|
+
method: "GET",
|
|
2562
|
+
path: `${this.base()}/areaDeliveryTimes/${encodeURIComponent(deliveryAreaId)}/${encodeURIComponent(cartId)}`,
|
|
2563
|
+
auth: auth2
|
|
2564
|
+
});
|
|
2565
|
+
}
|
|
2566
|
+
/** Retrieve delivery windows for a cart. */
|
|
2567
|
+
async getCartDeliveryWindows(cartId, auth2 = SERVICE16) {
|
|
2568
|
+
return this.ctx.http.request({
|
|
2569
|
+
method: "GET",
|
|
2570
|
+
path: `${this.base()}/actualDeliveryWindows/${encodeURIComponent(cartId)}`,
|
|
2571
|
+
auth: auth2
|
|
2572
|
+
});
|
|
2573
|
+
}
|
|
2574
|
+
/** Increment the delivery-window counter. */
|
|
2575
|
+
async incrementDeliveryWindowCounter(input, auth2 = SERVICE16) {
|
|
2576
|
+
await this.ctx.http.request({
|
|
2577
|
+
method: "POST",
|
|
2578
|
+
path: `${this.base()}/actualDeliveryWindows/incrementCounter`,
|
|
2579
|
+
auth: auth2,
|
|
2580
|
+
body: input
|
|
2581
|
+
});
|
|
2582
|
+
}
|
|
2583
|
+
/** Validate a delivery window. Resolves when valid; throws otherwise. */
|
|
2584
|
+
async validateDeliveryWindow(input, auth2 = SERVICE16) {
|
|
2585
|
+
await this.ctx.http.request({
|
|
2586
|
+
method: "POST",
|
|
2587
|
+
path: `${this.base()}/deliveryWindowValidation`,
|
|
2588
|
+
auth: auth2,
|
|
2589
|
+
body: input
|
|
2590
|
+
});
|
|
2591
|
+
}
|
|
2592
|
+
// --- Phase 2: delivery times ---
|
|
2593
|
+
/** List all delivery times. */
|
|
2594
|
+
async listDeliveryTimes(query = {}, auth2 = SERVICE16) {
|
|
2595
|
+
return this.ctx.http.request({
|
|
2596
|
+
method: "GET",
|
|
2597
|
+
path: `${this.base()}/delivery-times`,
|
|
2598
|
+
auth: auth2,
|
|
2599
|
+
...Object.keys(query).length ? { query } : {}
|
|
2600
|
+
});
|
|
2601
|
+
}
|
|
2602
|
+
/** Retrieve one delivery time. */
|
|
2603
|
+
async getDeliveryTime(deliveryTimeId, auth2 = SERVICE16) {
|
|
2604
|
+
return this.ctx.http.request({
|
|
2605
|
+
method: "GET",
|
|
2606
|
+
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}`,
|
|
2607
|
+
auth: auth2
|
|
2608
|
+
});
|
|
2609
|
+
}
|
|
2610
|
+
/** Create a delivery time. */
|
|
2611
|
+
async createDeliveryTime(input, auth2 = SERVICE16) {
|
|
2612
|
+
return this.ctx.http.request({
|
|
2613
|
+
method: "POST",
|
|
2614
|
+
path: `${this.base()}/delivery-times`,
|
|
2615
|
+
auth: auth2,
|
|
2616
|
+
body: input
|
|
2617
|
+
});
|
|
2618
|
+
}
|
|
2619
|
+
/** Create multiple delivery times (`POST /delivery-times/bulk`). */
|
|
2620
|
+
async createDeliveryTimesBulk(inputs, auth2 = SERVICE16) {
|
|
2621
|
+
return this.ctx.http.request({
|
|
2622
|
+
method: "POST",
|
|
2623
|
+
path: `${this.base()}/delivery-times/bulk`,
|
|
2624
|
+
auth: auth2,
|
|
2625
|
+
body: inputs
|
|
2626
|
+
});
|
|
2627
|
+
}
|
|
2628
|
+
/** Replace a delivery time. */
|
|
2629
|
+
async updateDeliveryTime(deliveryTimeId, input, auth2 = SERVICE16) {
|
|
2630
|
+
await this.ctx.http.request({
|
|
2631
|
+
method: "PUT",
|
|
2632
|
+
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}`,
|
|
2633
|
+
auth: auth2,
|
|
2634
|
+
body: input
|
|
2635
|
+
});
|
|
2636
|
+
}
|
|
2637
|
+
/** Partially update a delivery time (JSON-Patch op array). */
|
|
2638
|
+
async patchDeliveryTime(deliveryTimeId, ops, auth2 = SERVICE16) {
|
|
2639
|
+
await this.ctx.http.request({
|
|
2640
|
+
method: "PATCH",
|
|
2641
|
+
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}`,
|
|
2642
|
+
auth: auth2,
|
|
2643
|
+
body: ops
|
|
2644
|
+
});
|
|
2645
|
+
}
|
|
2646
|
+
/** Delete a delivery time. */
|
|
2647
|
+
async deleteDeliveryTime(deliveryTimeId, auth2 = SERVICE16) {
|
|
2648
|
+
await this.ctx.http.request({
|
|
2649
|
+
method: "DELETE",
|
|
2650
|
+
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}`,
|
|
2651
|
+
auth: auth2
|
|
2652
|
+
});
|
|
2653
|
+
}
|
|
2654
|
+
// --- Phase 2: delivery time slots ---
|
|
2655
|
+
/** List slots of a delivery time. */
|
|
2656
|
+
async listSlots(deliveryTimeId, auth2 = SERVICE16) {
|
|
2657
|
+
return this.ctx.http.request({
|
|
2658
|
+
method: "GET",
|
|
2659
|
+
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}/slots`,
|
|
2660
|
+
auth: auth2
|
|
2661
|
+
});
|
|
2662
|
+
}
|
|
2663
|
+
/** Retrieve one slot. */
|
|
2664
|
+
async getSlot(deliveryTimeId, slotId, auth2 = SERVICE16) {
|
|
2665
|
+
return this.ctx.http.request({
|
|
2666
|
+
method: "GET",
|
|
2667
|
+
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}/slots/${encodeURIComponent(slotId)}`,
|
|
2668
|
+
auth: auth2
|
|
2669
|
+
});
|
|
2670
|
+
}
|
|
2671
|
+
/** Create a slot in a delivery time. */
|
|
2672
|
+
async createSlot(deliveryTimeId, input, auth2 = SERVICE16) {
|
|
2673
|
+
return this.ctx.http.request({
|
|
2674
|
+
method: "POST",
|
|
2675
|
+
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}/slots`,
|
|
2676
|
+
auth: auth2,
|
|
2677
|
+
body: input
|
|
2678
|
+
});
|
|
2679
|
+
}
|
|
2680
|
+
/** Replace a slot. */
|
|
2681
|
+
async updateSlot(deliveryTimeId, slotId, input, auth2 = SERVICE16) {
|
|
2682
|
+
await this.ctx.http.request({
|
|
2683
|
+
method: "PUT",
|
|
2684
|
+
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}/slots/${encodeURIComponent(slotId)}`,
|
|
2685
|
+
auth: auth2,
|
|
2686
|
+
body: input
|
|
2687
|
+
});
|
|
2688
|
+
}
|
|
2689
|
+
/** Partially update a slot (JSON-Patch op array). */
|
|
2690
|
+
async patchSlot(deliveryTimeId, slotId, ops, auth2 = SERVICE16) {
|
|
2691
|
+
await this.ctx.http.request({
|
|
2692
|
+
method: "PATCH",
|
|
2693
|
+
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}/slots/${encodeURIComponent(slotId)}`,
|
|
2694
|
+
auth: auth2,
|
|
2695
|
+
body: ops
|
|
2696
|
+
});
|
|
2697
|
+
}
|
|
2698
|
+
/** Delete a slot. */
|
|
2699
|
+
async deleteSlot(deliveryTimeId, slotId, auth2 = SERVICE16) {
|
|
2700
|
+
await this.ctx.http.request({
|
|
2701
|
+
method: "DELETE",
|
|
2702
|
+
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}/slots/${encodeURIComponent(slotId)}`,
|
|
2703
|
+
auth: auth2
|
|
2704
|
+
});
|
|
2705
|
+
}
|
|
2706
|
+
/** Delete all slots of a delivery time. */
|
|
2707
|
+
async deleteAllSlots(deliveryTimeId, auth2 = SERVICE16) {
|
|
2708
|
+
await this.ctx.http.request({
|
|
2709
|
+
method: "DELETE",
|
|
2710
|
+
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}/slots`,
|
|
2711
|
+
auth: auth2
|
|
2712
|
+
});
|
|
2713
|
+
}
|
|
2714
|
+
// --- Phase 2: delivery cycles ---
|
|
2715
|
+
/** Generate a delivery cycle (`POST /delivery-cycles/generate`). Returns the cycle id. */
|
|
2716
|
+
async generateDeliveryCycle(input, auth2 = SERVICE16) {
|
|
2717
|
+
return this.ctx.http.request({
|
|
2718
|
+
method: "POST",
|
|
2719
|
+
path: `${this.base()}/delivery-cycles/generate`,
|
|
2720
|
+
auth: auth2,
|
|
2721
|
+
body: input
|
|
2722
|
+
});
|
|
2723
|
+
}
|
|
2724
|
+
};
|
|
2725
|
+
|
|
2726
|
+
// src/services/returns.ts
|
|
2727
|
+
var SERVICE17 = { kind: "service" };
|
|
2728
|
+
var ReturnsService = class {
|
|
2729
|
+
constructor(ctx) {
|
|
2730
|
+
this.ctx = ctx;
|
|
2731
|
+
}
|
|
2732
|
+
ctx;
|
|
2733
|
+
base() {
|
|
2734
|
+
return `/return/${this.ctx.tenant}/returns`;
|
|
2735
|
+
}
|
|
2736
|
+
/** List returns (paged; supports `pageSize`/`pageNumber`/`sort`/`q`). */
|
|
2737
|
+
async listReturns(query = {}, auth2 = SERVICE17) {
|
|
2738
|
+
return this.ctx.http.request({
|
|
2739
|
+
method: "GET",
|
|
2740
|
+
path: this.base(),
|
|
2741
|
+
auth: auth2,
|
|
2742
|
+
...Object.keys(query).length ? { query } : {}
|
|
2743
|
+
});
|
|
2744
|
+
}
|
|
2745
|
+
/** Retrieve one return by id. */
|
|
2746
|
+
async getReturn(returnId, auth2 = SERVICE17) {
|
|
2747
|
+
return this.ctx.http.request({
|
|
2748
|
+
method: "GET",
|
|
2749
|
+
path: `${this.base()}/${encodeURIComponent(returnId)}`,
|
|
2750
|
+
auth: auth2
|
|
2751
|
+
});
|
|
2752
|
+
}
|
|
2753
|
+
/** Create a return. Returns the created `{ id }`. */
|
|
2754
|
+
async createReturn(input, auth2 = SERVICE17) {
|
|
2755
|
+
return this.ctx.http.request({
|
|
2756
|
+
method: "POST",
|
|
2757
|
+
path: this.base(),
|
|
2758
|
+
auth: auth2,
|
|
2759
|
+
body: input
|
|
2760
|
+
});
|
|
2761
|
+
}
|
|
2762
|
+
/** Replace a return by id (`PUT`). */
|
|
2763
|
+
async updateReturn(returnId, input, auth2 = SERVICE17) {
|
|
2764
|
+
await this.ctx.http.request({
|
|
2765
|
+
method: "PUT",
|
|
2766
|
+
path: `${this.base()}/${encodeURIComponent(returnId)}`,
|
|
2767
|
+
auth: auth2,
|
|
2768
|
+
body: input
|
|
2769
|
+
});
|
|
2770
|
+
}
|
|
2771
|
+
/** Partially update a return by id (`PATCH`, JSON-Patch op-array). */
|
|
2772
|
+
async patchReturn(returnId, ops, auth2 = SERVICE17) {
|
|
2773
|
+
await this.ctx.http.request({
|
|
2774
|
+
method: "PATCH",
|
|
2775
|
+
path: `${this.base()}/${encodeURIComponent(returnId)}`,
|
|
2776
|
+
auth: auth2,
|
|
2777
|
+
body: ops
|
|
2778
|
+
});
|
|
2779
|
+
}
|
|
2780
|
+
/** Delete a return by id. */
|
|
2781
|
+
async deleteReturn(returnId, auth2 = SERVICE17) {
|
|
2782
|
+
await this.ctx.http.request({
|
|
2783
|
+
method: "DELETE",
|
|
2784
|
+
path: `${this.base()}/${encodeURIComponent(returnId)}`,
|
|
2785
|
+
auth: auth2
|
|
2786
|
+
});
|
|
2787
|
+
}
|
|
2788
|
+
};
|
|
2789
|
+
|
|
2790
|
+
// src/services/sepa-export.ts
|
|
2791
|
+
var SERVICE18 = { kind: "service" };
|
|
2792
|
+
var SepaExportService = class {
|
|
2793
|
+
constructor(ctx) {
|
|
2794
|
+
this.ctx = ctx;
|
|
2795
|
+
}
|
|
2796
|
+
ctx;
|
|
2797
|
+
base() {
|
|
2798
|
+
return `/sepa-export/${this.ctx.tenant}`;
|
|
2799
|
+
}
|
|
2800
|
+
/** Retrieve a SEPA export file by id. Returns the raw file content (text). */
|
|
2801
|
+
async getFile(fileId, auth2 = SERVICE18) {
|
|
2802
|
+
const path = `${this.base()}/files/${encodeURIComponent(fileId)}`;
|
|
2803
|
+
const res = await this.ctx.http.requestRaw({ method: "GET", path, auth: auth2 });
|
|
2804
|
+
if (!res.ok) {
|
|
2805
|
+
const errBody = await res.text().catch(() => void 0);
|
|
2806
|
+
throw errorFromResponse(res.status, `GET ${path} \u2192 ${res.status}`, errBody);
|
|
2807
|
+
}
|
|
2808
|
+
return res.text();
|
|
2809
|
+
}
|
|
2810
|
+
/** List export jobs. */
|
|
2811
|
+
async listJobs(query = {}, auth2 = SERVICE18) {
|
|
2812
|
+
return this.ctx.http.request({
|
|
2813
|
+
method: "GET",
|
|
2814
|
+
path: `${this.base()}/jobs`,
|
|
2815
|
+
auth: auth2,
|
|
2816
|
+
...Object.keys(query).length ? { query } : {}
|
|
2817
|
+
});
|
|
2818
|
+
}
|
|
2819
|
+
/** Create an export job. */
|
|
2820
|
+
async createJob(input, auth2 = SERVICE18) {
|
|
2821
|
+
return this.ctx.http.request({
|
|
2822
|
+
method: "POST",
|
|
2823
|
+
path: `${this.base()}/jobs`,
|
|
2824
|
+
auth: auth2,
|
|
2825
|
+
body: input
|
|
2826
|
+
});
|
|
2827
|
+
}
|
|
2828
|
+
};
|
|
2829
|
+
|
|
2830
|
+
// src/services/indexing.ts
|
|
2831
|
+
var SERVICE19 = { kind: "service" };
|
|
2832
|
+
var IndexingService = class {
|
|
2833
|
+
constructor(ctx) {
|
|
2834
|
+
this.ctx = ctx;
|
|
2835
|
+
}
|
|
2836
|
+
ctx;
|
|
2837
|
+
base() {
|
|
2838
|
+
return `/indexing/${this.ctx.tenant}`;
|
|
2839
|
+
}
|
|
2840
|
+
/** List indexing configurations. */
|
|
2841
|
+
async listConfigurations(auth2 = SERVICE19) {
|
|
2842
|
+
return this.ctx.http.request({ method: "GET", path: `${this.base()}/configurations`, auth: auth2 });
|
|
2843
|
+
}
|
|
2844
|
+
/** Get a configuration by provider name. */
|
|
2845
|
+
async getConfiguration(provider, auth2 = SERVICE19) {
|
|
2846
|
+
return this.ctx.http.request({
|
|
2847
|
+
method: "GET",
|
|
2848
|
+
path: `${this.base()}/configurations/${encodeURIComponent(provider)}`,
|
|
2849
|
+
auth: auth2
|
|
2850
|
+
});
|
|
2851
|
+
}
|
|
2852
|
+
/** Create a configuration. */
|
|
2853
|
+
async createConfiguration(input, auth2 = SERVICE19) {
|
|
2854
|
+
return this.ctx.http.request({
|
|
2855
|
+
method: "POST",
|
|
2856
|
+
path: `${this.base()}/configurations`,
|
|
2857
|
+
auth: auth2,
|
|
2858
|
+
body: input
|
|
2859
|
+
});
|
|
2860
|
+
}
|
|
2861
|
+
/** Update a configuration by provider name. */
|
|
2862
|
+
async updateConfiguration(provider, input, auth2 = SERVICE19) {
|
|
2863
|
+
await this.ctx.http.request({
|
|
2864
|
+
method: "PUT",
|
|
2865
|
+
path: `${this.base()}/configurations/${encodeURIComponent(provider)}`,
|
|
2866
|
+
auth: auth2,
|
|
2867
|
+
body: input
|
|
2868
|
+
});
|
|
2869
|
+
}
|
|
2870
|
+
/** Delete a configuration by provider name. */
|
|
2871
|
+
async deleteConfiguration(provider, auth2 = SERVICE19) {
|
|
2872
|
+
await this.ctx.http.request({
|
|
2873
|
+
method: "DELETE",
|
|
2874
|
+
path: `${this.base()}/configurations/${encodeURIComponent(provider)}`,
|
|
2875
|
+
auth: auth2
|
|
2876
|
+
});
|
|
2877
|
+
}
|
|
2878
|
+
/** List public indexing configurations. */
|
|
2879
|
+
async listPublicConfigurations(auth2 = SERVICE19) {
|
|
2880
|
+
return this.ctx.http.request({ method: "GET", path: `${this.base()}/public/configurations`, auth: auth2 });
|
|
2881
|
+
}
|
|
2882
|
+
/** Get a public configuration by provider name. */
|
|
2883
|
+
async getPublicConfiguration(provider, auth2 = SERVICE19) {
|
|
2884
|
+
return this.ctx.http.request({
|
|
2885
|
+
method: "GET",
|
|
2886
|
+
path: `${this.base()}/public/configurations/${encodeURIComponent(provider)}`,
|
|
2887
|
+
auth: auth2
|
|
2888
|
+
});
|
|
2889
|
+
}
|
|
2890
|
+
/** Trigger a reindex. */
|
|
2891
|
+
async reindex(input, auth2 = SERVICE19) {
|
|
2892
|
+
await this.ctx.http.request({ method: "POST", path: `${this.base()}/reindex`, auth: auth2, body: input });
|
|
2893
|
+
}
|
|
2894
|
+
};
|
|
2895
|
+
|
|
2896
|
+
// src/services/unit-handling.ts
|
|
2897
|
+
var SERVICE20 = { kind: "service" };
|
|
2898
|
+
var UnitHandlingService = class {
|
|
2899
|
+
constructor(ctx) {
|
|
2900
|
+
this.ctx = ctx;
|
|
2901
|
+
}
|
|
2902
|
+
ctx;
|
|
2903
|
+
base() {
|
|
2904
|
+
return `/unit-handling/${this.ctx.tenant}`;
|
|
2905
|
+
}
|
|
2906
|
+
/** Find units (filter/sort/page). */
|
|
2907
|
+
async listUnits(query = {}, auth2 = SERVICE20) {
|
|
2908
|
+
return this.ctx.http.request({
|
|
2909
|
+
method: "GET",
|
|
2910
|
+
path: `${this.base()}/units`,
|
|
2911
|
+
auth: auth2,
|
|
2912
|
+
...Object.keys(query).length ? { query } : {}
|
|
2913
|
+
});
|
|
2914
|
+
}
|
|
2915
|
+
/** Retrieve a unit by code. */
|
|
2916
|
+
async getUnit(unitCode, auth2 = SERVICE20) {
|
|
2917
|
+
return this.ctx.http.request({
|
|
2918
|
+
method: "GET",
|
|
2919
|
+
path: `${this.base()}/units/${encodeURIComponent(unitCode)}`,
|
|
2920
|
+
auth: auth2
|
|
2921
|
+
});
|
|
2922
|
+
}
|
|
2923
|
+
/** Add a new unit. */
|
|
2924
|
+
async createUnit(input, auth2 = SERVICE20) {
|
|
2925
|
+
return this.ctx.http.request({ method: "POST", path: `${this.base()}/units`, auth: auth2, body: input });
|
|
2926
|
+
}
|
|
2927
|
+
/** Update a unit by code. */
|
|
2928
|
+
async updateUnit(unitCode, input, auth2 = SERVICE20) {
|
|
2929
|
+
await this.ctx.http.request({
|
|
2930
|
+
method: "PUT",
|
|
2931
|
+
path: `${this.base()}/units/${encodeURIComponent(unitCode)}`,
|
|
2932
|
+
auth: auth2,
|
|
2933
|
+
body: input
|
|
2934
|
+
});
|
|
2935
|
+
}
|
|
2936
|
+
/** Delete a unit by code. */
|
|
2937
|
+
async deleteUnit(unitCode, auth2 = SERVICE20) {
|
|
2938
|
+
await this.ctx.http.request({
|
|
2939
|
+
method: "DELETE",
|
|
2940
|
+
path: `${this.base()}/units/${encodeURIComponent(unitCode)}`,
|
|
2941
|
+
auth: auth2
|
|
2942
|
+
});
|
|
2943
|
+
}
|
|
2944
|
+
/** Delete multiple units by code (bulk). The codes are sent as the request body. */
|
|
2945
|
+
async deleteUnits(codes, auth2 = SERVICE20) {
|
|
2946
|
+
await this.ctx.http.request({
|
|
2947
|
+
method: "DELETE",
|
|
2948
|
+
path: `${this.base()}/units`,
|
|
2949
|
+
auth: auth2,
|
|
2950
|
+
body: codes
|
|
2951
|
+
});
|
|
2952
|
+
}
|
|
2953
|
+
/** Fetch a conversion factor (`PUT /units/conversion-factor-commands`). */
|
|
2954
|
+
async getConversionFactor(input, auth2 = SERVICE20) {
|
|
2955
|
+
return this.ctx.http.request({
|
|
2956
|
+
method: "PUT",
|
|
2957
|
+
path: `${this.base()}/units/conversion-factor-commands`,
|
|
2958
|
+
auth: auth2,
|
|
2959
|
+
body: input
|
|
2960
|
+
});
|
|
2961
|
+
}
|
|
2962
|
+
/** Convert a value between units (`PUT /units/convert-unit-commands`). */
|
|
2963
|
+
async convertUnit(input, auth2 = SERVICE20) {
|
|
2964
|
+
return this.ctx.http.request({
|
|
2965
|
+
method: "PUT",
|
|
2966
|
+
path: `${this.base()}/units/convert-unit-commands`,
|
|
2967
|
+
auth: auth2,
|
|
2968
|
+
body: input
|
|
2969
|
+
});
|
|
2970
|
+
}
|
|
2971
|
+
/** List all unit types. */
|
|
2972
|
+
async listUnitTypes(auth2 = SERVICE20) {
|
|
2973
|
+
return this.ctx.http.request({ method: "GET", path: `${this.base()}/types`, auth: auth2 });
|
|
2974
|
+
}
|
|
2975
|
+
};
|
|
2976
|
+
|
|
2977
|
+
// src/services/catalog.ts
|
|
2978
|
+
var SERVICE21 = { kind: "service" };
|
|
2979
|
+
var CatalogService = class {
|
|
2980
|
+
constructor(ctx) {
|
|
2981
|
+
this.ctx = ctx;
|
|
2982
|
+
}
|
|
2983
|
+
ctx;
|
|
2984
|
+
base() {
|
|
2985
|
+
return `/catalog/${this.ctx.tenant}/catalogs`;
|
|
2986
|
+
}
|
|
2987
|
+
/** List catalogs (filtered/sorted). */
|
|
2988
|
+
async listCatalogs(query = {}, auth2 = SERVICE21) {
|
|
2989
|
+
return this.ctx.http.request({
|
|
2990
|
+
method: "GET",
|
|
2991
|
+
path: this.base(),
|
|
2992
|
+
auth: auth2,
|
|
2993
|
+
...Object.keys(query).length ? { query } : {}
|
|
2994
|
+
});
|
|
2995
|
+
}
|
|
2996
|
+
/** Retrieve a catalog by id. */
|
|
2997
|
+
async getCatalog(catalogId, auth2 = SERVICE21) {
|
|
2998
|
+
return this.ctx.http.request({
|
|
2999
|
+
method: "GET",
|
|
3000
|
+
path: `${this.base()}/${encodeURIComponent(catalogId)}`,
|
|
3001
|
+
auth: auth2
|
|
3002
|
+
});
|
|
3003
|
+
}
|
|
3004
|
+
/** Retrieve all catalogs that contain a category. */
|
|
3005
|
+
async getCatalogsForCategory(categoryId, auth2 = SERVICE21) {
|
|
3006
|
+
return this.ctx.http.request({
|
|
3007
|
+
method: "GET",
|
|
3008
|
+
path: `${this.base()}/categories/${encodeURIComponent(categoryId)}`,
|
|
3009
|
+
auth: auth2
|
|
3010
|
+
});
|
|
3011
|
+
}
|
|
3012
|
+
/** Create a catalog. */
|
|
3013
|
+
async createCatalog(input, auth2 = SERVICE21) {
|
|
3014
|
+
return this.ctx.http.request({ method: "POST", path: this.base(), auth: auth2, body: input });
|
|
3015
|
+
}
|
|
3016
|
+
/** Upsert a catalog by id (`PUT`). */
|
|
3017
|
+
async updateCatalog(catalogId, input, auth2 = SERVICE21) {
|
|
3018
|
+
return this.ctx.http.request({
|
|
3019
|
+
method: "PUT",
|
|
3020
|
+
path: `${this.base()}/${encodeURIComponent(catalogId)}`,
|
|
3021
|
+
auth: auth2,
|
|
3022
|
+
body: input
|
|
3023
|
+
});
|
|
3024
|
+
}
|
|
3025
|
+
/** Partially update a catalog by id (`PATCH`). */
|
|
3026
|
+
async patchCatalog(catalogId, patch, auth2 = SERVICE21) {
|
|
3027
|
+
await this.ctx.http.request({
|
|
3028
|
+
method: "PATCH",
|
|
3029
|
+
path: `${this.base()}/${encodeURIComponent(catalogId)}`,
|
|
3030
|
+
auth: auth2,
|
|
3031
|
+
body: patch
|
|
3032
|
+
});
|
|
3033
|
+
}
|
|
3034
|
+
/** Remove a catalog by id. */
|
|
3035
|
+
async deleteCatalog(catalogId, auth2 = SERVICE21) {
|
|
3036
|
+
await this.ctx.http.request({
|
|
3037
|
+
method: "DELETE",
|
|
3038
|
+
path: `${this.base()}/${encodeURIComponent(catalogId)}`,
|
|
3039
|
+
auth: auth2
|
|
3040
|
+
});
|
|
3041
|
+
}
|
|
3042
|
+
};
|
|
3043
|
+
|
|
3044
|
+
// src/services/vendor.ts
|
|
3045
|
+
var SERVICE22 = { kind: "service" };
|
|
3046
|
+
var VendorService = class {
|
|
3047
|
+
constructor(ctx) {
|
|
3048
|
+
this.ctx = ctx;
|
|
3049
|
+
}
|
|
3050
|
+
ctx;
|
|
3051
|
+
base() {
|
|
3052
|
+
return `/vendor/${this.ctx.tenant}`;
|
|
3053
|
+
}
|
|
3054
|
+
// --- Vendors ---
|
|
3055
|
+
/** List all vendors. */
|
|
3056
|
+
async listVendors(query = {}, auth2 = SERVICE22) {
|
|
3057
|
+
return this.ctx.http.request({
|
|
3058
|
+
method: "GET",
|
|
3059
|
+
path: `${this.base()}/vendors`,
|
|
3060
|
+
auth: auth2,
|
|
3061
|
+
...Object.keys(query).length ? { query } : {}
|
|
3062
|
+
});
|
|
3063
|
+
}
|
|
3064
|
+
/** Retrieve a vendor by id. */
|
|
3065
|
+
async getVendor(vendorId, auth2 = SERVICE22) {
|
|
3066
|
+
return this.ctx.http.request({
|
|
3067
|
+
method: "GET",
|
|
3068
|
+
path: `${this.base()}/vendors/${encodeURIComponent(vendorId)}`,
|
|
3069
|
+
auth: auth2
|
|
3070
|
+
});
|
|
3071
|
+
}
|
|
3072
|
+
/** Search vendors (`POST /vendors/search`). */
|
|
3073
|
+
async searchVendors(query, auth2 = SERVICE22) {
|
|
3074
|
+
return this.ctx.http.request({
|
|
3075
|
+
method: "POST",
|
|
3076
|
+
path: `${this.base()}/vendors/search`,
|
|
3077
|
+
auth: auth2,
|
|
3078
|
+
body: query
|
|
3079
|
+
});
|
|
3080
|
+
}
|
|
3081
|
+
/** Create a vendor. */
|
|
3082
|
+
async createVendor(input, auth2 = SERVICE22) {
|
|
3083
|
+
return this.ctx.http.request({ method: "POST", path: `${this.base()}/vendors`, auth: auth2, body: input });
|
|
3084
|
+
}
|
|
3085
|
+
/** Upsert a vendor by id (`PUT`). */
|
|
3086
|
+
async updateVendor(vendorId, input, auth2 = SERVICE22) {
|
|
3087
|
+
await this.ctx.http.request({
|
|
3088
|
+
method: "PUT",
|
|
3089
|
+
path: `${this.base()}/vendors/${encodeURIComponent(vendorId)}`,
|
|
3090
|
+
auth: auth2,
|
|
3091
|
+
body: input
|
|
3092
|
+
});
|
|
3093
|
+
}
|
|
3094
|
+
/** Delete a vendor by id. */
|
|
3095
|
+
async deleteVendor(vendorId, auth2 = SERVICE22) {
|
|
3096
|
+
await this.ctx.http.request({
|
|
3097
|
+
method: "DELETE",
|
|
3098
|
+
path: `${this.base()}/vendors/${encodeURIComponent(vendorId)}`,
|
|
3099
|
+
auth: auth2
|
|
3100
|
+
});
|
|
3101
|
+
}
|
|
3102
|
+
// --- Vendor locations ---
|
|
3103
|
+
/** List all vendor locations. */
|
|
3104
|
+
async listVendorLocations(query = {}, auth2 = SERVICE22) {
|
|
3105
|
+
return this.ctx.http.request({
|
|
3106
|
+
method: "GET",
|
|
3107
|
+
path: `${this.base()}/locations`,
|
|
3108
|
+
auth: auth2,
|
|
3109
|
+
...Object.keys(query).length ? { query } : {}
|
|
3110
|
+
});
|
|
3111
|
+
}
|
|
3112
|
+
/** Retrieve a vendor location by id. */
|
|
3113
|
+
async getVendorLocation(locationId, auth2 = SERVICE22) {
|
|
3114
|
+
return this.ctx.http.request({
|
|
3115
|
+
method: "GET",
|
|
3116
|
+
path: `${this.base()}/locations/${encodeURIComponent(locationId)}`,
|
|
3117
|
+
auth: auth2
|
|
3118
|
+
});
|
|
3119
|
+
}
|
|
3120
|
+
/** Create a vendor location. */
|
|
3121
|
+
async createVendorLocation(input, auth2 = SERVICE22) {
|
|
3122
|
+
return this.ctx.http.request({ method: "POST", path: `${this.base()}/locations`, auth: auth2, body: input });
|
|
3123
|
+
}
|
|
3124
|
+
/** Upsert a vendor location by id (`PUT`). */
|
|
3125
|
+
async updateVendorLocation(locationId, input, auth2 = SERVICE22) {
|
|
3126
|
+
await this.ctx.http.request({
|
|
3127
|
+
method: "PUT",
|
|
3128
|
+
path: `${this.base()}/locations/${encodeURIComponent(locationId)}`,
|
|
3129
|
+
auth: auth2,
|
|
3130
|
+
body: input
|
|
3131
|
+
});
|
|
3132
|
+
}
|
|
3133
|
+
/** Delete a vendor location by id. */
|
|
3134
|
+
async deleteVendorLocation(locationId, auth2 = SERVICE22) {
|
|
3135
|
+
await this.ctx.http.request({
|
|
3136
|
+
method: "DELETE",
|
|
3137
|
+
path: `${this.base()}/locations/${encodeURIComponent(locationId)}`,
|
|
3138
|
+
auth: auth2
|
|
3139
|
+
});
|
|
3140
|
+
}
|
|
3141
|
+
};
|
|
3142
|
+
|
|
3143
|
+
// src/services/pick-pack.ts
|
|
3144
|
+
var SERVICE23 = { kind: "service" };
|
|
3145
|
+
var PickPackService = class {
|
|
3146
|
+
constructor(ctx) {
|
|
3147
|
+
this.ctx = ctx;
|
|
3148
|
+
}
|
|
3149
|
+
ctx;
|
|
3150
|
+
base() {
|
|
3151
|
+
return `/pick-pack/${this.ctx.tenant}`;
|
|
3152
|
+
}
|
|
3153
|
+
orderPath(orderId) {
|
|
3154
|
+
return `${this.base()}/orders/${encodeURIComponent(orderId)}`;
|
|
3155
|
+
}
|
|
3156
|
+
/** List packlist orders. */
|
|
3157
|
+
async listOrders(query = {}, auth2 = SERVICE23) {
|
|
3158
|
+
return this.ctx.http.request({
|
|
3159
|
+
method: "GET",
|
|
3160
|
+
path: `${this.base()}/orders`,
|
|
3161
|
+
auth: auth2,
|
|
3162
|
+
...Object.keys(query).length ? { query } : {}
|
|
3163
|
+
});
|
|
3164
|
+
}
|
|
3165
|
+
/** Retrieve a packlist order by id. */
|
|
3166
|
+
async getOrder(orderId, auth2 = SERVICE23) {
|
|
3167
|
+
return this.ctx.http.request({ method: "GET", path: this.orderPath(orderId), auth: auth2 });
|
|
3168
|
+
}
|
|
3169
|
+
/** Update an order's status (`PATCH`). Returns an acknowledgement. */
|
|
3170
|
+
async updateOrder(orderId, change, auth2 = SERVICE23) {
|
|
3171
|
+
return this.ctx.http.request({ method: "PATCH", path: this.orderPath(orderId), auth: auth2, body: change });
|
|
3172
|
+
}
|
|
3173
|
+
/** Finish an order. Returns an acknowledgement. */
|
|
3174
|
+
async finishOrder(orderId, auth2 = SERVICE23) {
|
|
3175
|
+
return this.ctx.http.request({ method: "POST", path: `${this.orderPath(orderId)}/finish`, auth: auth2 });
|
|
3176
|
+
}
|
|
3177
|
+
/** List order cycles (ids). */
|
|
3178
|
+
async listOrderCycles(query = {}, auth2 = SERVICE23) {
|
|
3179
|
+
return this.ctx.http.request({
|
|
3180
|
+
method: "GET",
|
|
3181
|
+
path: `${this.base()}/orderCycles`,
|
|
3182
|
+
auth: auth2,
|
|
3183
|
+
...Object.keys(query).length ? { query } : {}
|
|
3184
|
+
});
|
|
3185
|
+
}
|
|
3186
|
+
/** Add an assignee to an order. Returns an acknowledgement. */
|
|
3187
|
+
async addAssignee(orderId, assignee, auth2 = SERVICE23) {
|
|
3188
|
+
return this.ctx.http.request({ method: "POST", path: `${this.orderPath(orderId)}/assignees`, auth: auth2, body: assignee });
|
|
3189
|
+
}
|
|
3190
|
+
/** Remove an assignee from an order. */
|
|
3191
|
+
async removeAssignee(orderId, assigneeId, auth2 = SERVICE23) {
|
|
3192
|
+
await this.ctx.http.request({
|
|
3193
|
+
method: "DELETE",
|
|
3194
|
+
path: `${this.orderPath(orderId)}/assignees/${encodeURIComponent(assigneeId)}`,
|
|
3195
|
+
auth: auth2
|
|
3196
|
+
});
|
|
3197
|
+
}
|
|
3198
|
+
/** Update packaging products for an order (`PUT`). Returns an acknowledgement. */
|
|
3199
|
+
async updatePackaging(orderId, change, auth2 = SERVICE23) {
|
|
3200
|
+
return this.ctx.http.request({ method: "PUT", path: `${this.orderPath(orderId)}/packaging`, auth: auth2, body: change });
|
|
3201
|
+
}
|
|
3202
|
+
/** Create a packing event. Returns an acknowledgement. */
|
|
3203
|
+
async createEvent(event, auth2 = SERVICE23) {
|
|
3204
|
+
return this.ctx.http.request({ method: "POST", path: `${this.base()}/events`, auth: auth2, body: event });
|
|
3205
|
+
}
|
|
3206
|
+
/** List packing events. */
|
|
3207
|
+
async listEvents(query = {}, auth2 = SERVICE23) {
|
|
3208
|
+
return this.ctx.http.request({
|
|
3209
|
+
method: "GET",
|
|
3210
|
+
path: `${this.base()}/events`,
|
|
3211
|
+
auth: auth2,
|
|
3212
|
+
...Object.keys(query).length ? { query } : {}
|
|
3213
|
+
});
|
|
3214
|
+
}
|
|
3215
|
+
/** Trigger an order recalculation. Returns the created job's id. */
|
|
3216
|
+
async triggerRecalculation(input, auth2 = SERVICE23) {
|
|
3217
|
+
return this.ctx.http.request({
|
|
3218
|
+
method: "POST",
|
|
3219
|
+
path: `${this.base()}/jobs/recalculations`,
|
|
3220
|
+
auth: auth2,
|
|
3221
|
+
body: input
|
|
3222
|
+
});
|
|
3223
|
+
}
|
|
3224
|
+
/** Retrieve a recalculation job by id. */
|
|
3225
|
+
async getRecalculationJob(jobId, auth2 = SERVICE23) {
|
|
3226
|
+
return this.ctx.http.request({
|
|
3227
|
+
method: "GET",
|
|
3228
|
+
path: `${this.base()}/jobs/recalculations/${encodeURIComponent(jobId)}`,
|
|
3229
|
+
auth: auth2
|
|
3230
|
+
});
|
|
3231
|
+
}
|
|
3232
|
+
};
|
|
3233
|
+
|
|
3234
|
+
// src/services/customer-admin.ts
|
|
3235
|
+
var SERVICE24 = { kind: "service" };
|
|
3236
|
+
var CustomerAdminService = class {
|
|
3237
|
+
constructor(ctx) {
|
|
3238
|
+
this.ctx = ctx;
|
|
3239
|
+
}
|
|
3240
|
+
ctx;
|
|
3241
|
+
base() {
|
|
3242
|
+
return `/customer/${this.ctx.tenant}/customers`;
|
|
3243
|
+
}
|
|
3244
|
+
customerPath(customerNumber) {
|
|
3245
|
+
return `${this.base()}/${encodeURIComponent(customerNumber)}`;
|
|
3246
|
+
}
|
|
3247
|
+
addressPath(customerNumber, addressId) {
|
|
3248
|
+
return `${this.customerPath(customerNumber)}/addresses/${encodeURIComponent(addressId)}`;
|
|
3249
|
+
}
|
|
3250
|
+
// --- Customers ---
|
|
3251
|
+
/** List customers. */
|
|
3252
|
+
async listCustomers(query = {}, auth2 = SERVICE24) {
|
|
3253
|
+
return this.ctx.http.request({
|
|
3254
|
+
method: "GET",
|
|
3255
|
+
path: this.base(),
|
|
3256
|
+
auth: auth2,
|
|
3257
|
+
...Object.keys(query).length ? { query } : {}
|
|
3258
|
+
});
|
|
3259
|
+
}
|
|
3260
|
+
/** Search customers (`POST /customers/search`). */
|
|
3261
|
+
async searchCustomers(query, auth2 = SERVICE24) {
|
|
3262
|
+
return this.ctx.http.request({ method: "POST", path: `${this.base()}/search`, auth: auth2, body: query });
|
|
3263
|
+
}
|
|
3264
|
+
/** Retrieve a customer profile by number. */
|
|
3265
|
+
async getCustomer(customerNumber, auth2 = SERVICE24) {
|
|
3266
|
+
return this.ctx.http.request({ method: "GET", path: this.customerPath(customerNumber), auth: auth2 });
|
|
3267
|
+
}
|
|
3268
|
+
/** Create a customer. */
|
|
3269
|
+
async createCustomer(input, auth2 = SERVICE24) {
|
|
3270
|
+
return this.ctx.http.request({ method: "POST", path: this.base(), auth: auth2, body: input });
|
|
3271
|
+
}
|
|
3272
|
+
/** Upsert a customer profile by number (`PUT`). */
|
|
3273
|
+
async upsertCustomer(customerNumber, input, auth2 = SERVICE24) {
|
|
3274
|
+
return this.ctx.http.request({ method: "PUT", path: this.customerPath(customerNumber), auth: auth2, body: input });
|
|
3275
|
+
}
|
|
3276
|
+
/** Partially update a customer profile (`PATCH`). */
|
|
3277
|
+
async patchCustomer(customerNumber, patch, auth2 = SERVICE24) {
|
|
3278
|
+
await this.ctx.http.request({ method: "PATCH", path: this.customerPath(customerNumber), auth: auth2, body: patch });
|
|
3279
|
+
}
|
|
3280
|
+
/** Delete a customer profile. */
|
|
3281
|
+
async deleteCustomer(customerNumber, auth2 = SERVICE24) {
|
|
3282
|
+
await this.ctx.http.request({ method: "DELETE", path: this.customerPath(customerNumber), auth: auth2 });
|
|
3283
|
+
}
|
|
3284
|
+
// --- Addresses ---
|
|
3285
|
+
/** List a customer's addresses. */
|
|
3286
|
+
async listAddresses(customerNumber, auth2 = SERVICE24) {
|
|
3287
|
+
return this.ctx.http.request({
|
|
3288
|
+
method: "GET",
|
|
3289
|
+
path: `${this.customerPath(customerNumber)}/addresses`,
|
|
3290
|
+
auth: auth2
|
|
3291
|
+
});
|
|
3292
|
+
}
|
|
3293
|
+
/** Retrieve one address. */
|
|
3294
|
+
async getAddress(customerNumber, addressId, auth2 = SERVICE24) {
|
|
3295
|
+
return this.ctx.http.request({ method: "GET", path: this.addressPath(customerNumber, addressId), auth: auth2 });
|
|
3296
|
+
}
|
|
3297
|
+
/** Add an address. */
|
|
3298
|
+
async addAddress(customerNumber, input, auth2 = SERVICE24) {
|
|
3299
|
+
return this.ctx.http.request({
|
|
3300
|
+
method: "POST",
|
|
3301
|
+
path: `${this.customerPath(customerNumber)}/addresses`,
|
|
3302
|
+
auth: auth2,
|
|
3303
|
+
body: input
|
|
3304
|
+
});
|
|
3305
|
+
}
|
|
3306
|
+
/** Upsert an address by id (`PUT`). */
|
|
3307
|
+
async upsertAddress(customerNumber, addressId, input, auth2 = SERVICE24) {
|
|
3308
|
+
return this.ctx.http.request({ method: "PUT", path: this.addressPath(customerNumber, addressId), auth: auth2, body: input });
|
|
3309
|
+
}
|
|
3310
|
+
/** Partially update an address by id (`PATCH`). */
|
|
3311
|
+
async patchAddress(customerNumber, addressId, patch, auth2 = SERVICE24) {
|
|
3312
|
+
await this.ctx.http.request({ method: "PATCH", path: this.addressPath(customerNumber, addressId), auth: auth2, body: patch });
|
|
3313
|
+
}
|
|
3314
|
+
/** Delete an address by id. */
|
|
3315
|
+
async deleteAddress(customerNumber, addressId, auth2 = SERVICE24) {
|
|
3316
|
+
await this.ctx.http.request({ method: "DELETE", path: this.addressPath(customerNumber, addressId), auth: auth2 });
|
|
3317
|
+
}
|
|
3318
|
+
/** Add tags to an address (`?tags=` query). */
|
|
3319
|
+
async addAddressTags(customerNumber, addressId, tags, auth2 = SERVICE24) {
|
|
3320
|
+
await this.ctx.http.request({
|
|
3321
|
+
method: "POST",
|
|
3322
|
+
path: `${this.addressPath(customerNumber, addressId)}/tags`,
|
|
3323
|
+
auth: auth2,
|
|
3324
|
+
query: { tags: tags.join(",") }
|
|
3325
|
+
});
|
|
3326
|
+
}
|
|
3327
|
+
/** Remove tags from an address (`?tags=` query). */
|
|
3328
|
+
async removeAddressTags(customerNumber, addressId, tags, auth2 = SERVICE24) {
|
|
3329
|
+
await this.ctx.http.request({
|
|
3330
|
+
method: "DELETE",
|
|
3331
|
+
path: `${this.addressPath(customerNumber, addressId)}/tags`,
|
|
3332
|
+
auth: auth2,
|
|
3333
|
+
query: { tags: tags.join(",") }
|
|
3334
|
+
});
|
|
3335
|
+
}
|
|
3336
|
+
};
|
|
3337
|
+
|
|
3338
|
+
// src/services/approval.ts
|
|
3339
|
+
var SERVICE25 = { kind: "service" };
|
|
3340
|
+
var ApprovalService = class {
|
|
3341
|
+
constructor(ctx) {
|
|
3342
|
+
this.ctx = ctx;
|
|
3343
|
+
}
|
|
3344
|
+
ctx;
|
|
3345
|
+
base() {
|
|
3346
|
+
return `/approval/${this.ctx.tenant}`;
|
|
3347
|
+
}
|
|
3348
|
+
/** List approvals (paged via `pageNumber`/`pageSize`/`sort`/`q`). Returns an array. */
|
|
3349
|
+
async listApprovals(query = {}, auth2 = SERVICE25) {
|
|
3350
|
+
return this.ctx.http.request({
|
|
3351
|
+
method: "GET",
|
|
3352
|
+
path: `${this.base()}/approvals`,
|
|
3353
|
+
auth: auth2,
|
|
3354
|
+
...Object.keys(query).length ? { query } : {}
|
|
3355
|
+
});
|
|
3356
|
+
}
|
|
3357
|
+
/** Retrieve a single approval by id. */
|
|
3358
|
+
async getApproval(approvalId, auth2 = SERVICE25) {
|
|
3359
|
+
return this.ctx.http.request({
|
|
3360
|
+
method: "GET",
|
|
3361
|
+
path: `${this.base()}/approvals/${encodeURIComponent(approvalId)}`,
|
|
3362
|
+
auth: auth2
|
|
3363
|
+
});
|
|
3364
|
+
}
|
|
3365
|
+
/** Create an approval request (cart or quote). Returns the created `{ id }`. */
|
|
3366
|
+
async createApproval(input, auth2 = SERVICE25) {
|
|
3367
|
+
return this.ctx.http.request({
|
|
3368
|
+
method: "POST",
|
|
3369
|
+
path: `${this.base()}/approvals`,
|
|
3370
|
+
auth: auth2,
|
|
3371
|
+
body: input
|
|
3372
|
+
});
|
|
3373
|
+
}
|
|
3374
|
+
/** Approve/reject/amend an approval via a JSON-Patch op-array (`PATCH`). */
|
|
3375
|
+
async updateApproval(approvalId, ops, auth2 = SERVICE25) {
|
|
3376
|
+
await this.ctx.http.request({
|
|
3377
|
+
method: "PATCH",
|
|
3378
|
+
path: `${this.base()}/approvals/${encodeURIComponent(approvalId)}`,
|
|
3379
|
+
auth: auth2,
|
|
3380
|
+
body: ops
|
|
3381
|
+
});
|
|
3382
|
+
}
|
|
3383
|
+
/** Delete an approval by id. */
|
|
3384
|
+
async deleteApproval(approvalId, auth2 = SERVICE25) {
|
|
3385
|
+
await this.ctx.http.request({
|
|
3386
|
+
method: "DELETE",
|
|
3387
|
+
path: `${this.base()}/approvals/${encodeURIComponent(approvalId)}`,
|
|
3388
|
+
auth: auth2
|
|
3389
|
+
});
|
|
3390
|
+
}
|
|
3391
|
+
/** Check whether an operation on a resource is permitted / needs approval. */
|
|
3392
|
+
async checkPermitted(input, auth2 = SERVICE25) {
|
|
3393
|
+
return this.ctx.http.request({
|
|
3394
|
+
method: "POST",
|
|
3395
|
+
path: `${this.base()}/approval/permitted`,
|
|
3396
|
+
auth: auth2,
|
|
3397
|
+
body: input
|
|
3398
|
+
});
|
|
3399
|
+
}
|
|
3400
|
+
/** Search for users eligible to approve a resource. Returns an array. */
|
|
3401
|
+
async searchApprovers(input, auth2 = SERVICE25) {
|
|
3402
|
+
return this.ctx.http.request({
|
|
3403
|
+
method: "POST",
|
|
3404
|
+
path: `${this.base()}/search/users`,
|
|
3405
|
+
auth: auth2,
|
|
3406
|
+
body: input
|
|
3407
|
+
});
|
|
3408
|
+
}
|
|
3409
|
+
};
|
|
3410
|
+
|
|
1692
3411
|
// package.json
|
|
1693
|
-
var version = "2.
|
|
3412
|
+
var version = "2.5.0";
|
|
1694
3413
|
|
|
1695
3414
|
// src/version.ts
|
|
1696
3415
|
var SDK_VERSION = version;
|
|
@@ -1724,6 +3443,23 @@ var EmporixClient = class {
|
|
|
1724
3443
|
webhooks;
|
|
1725
3444
|
schemas;
|
|
1726
3445
|
ai;
|
|
3446
|
+
taxes;
|
|
3447
|
+
coupons;
|
|
3448
|
+
rewardPoints;
|
|
3449
|
+
brands;
|
|
3450
|
+
labels;
|
|
3451
|
+
countries;
|
|
3452
|
+
currencies;
|
|
3453
|
+
shipping;
|
|
3454
|
+
returns;
|
|
3455
|
+
sepaExport;
|
|
3456
|
+
indexing;
|
|
3457
|
+
units;
|
|
3458
|
+
catalogs;
|
|
3459
|
+
vendors;
|
|
3460
|
+
pickPack;
|
|
3461
|
+
customerAdmin;
|
|
3462
|
+
approvals;
|
|
1727
3463
|
/** The validated tenant this client is bound to. */
|
|
1728
3464
|
tenant;
|
|
1729
3465
|
/**
|
|
@@ -1803,6 +3539,23 @@ var EmporixClient = class {
|
|
|
1803
3539
|
this.webhooks = new WebhookService(mk("webhook"));
|
|
1804
3540
|
this.schemas = new SchemaService(mk("schema"));
|
|
1805
3541
|
this.ai = new AiService(mk("ai"));
|
|
3542
|
+
this.taxes = new TaxService(mk("tax"));
|
|
3543
|
+
this.coupons = new CouponService(mk("coupon"));
|
|
3544
|
+
this.rewardPoints = new RewardPointsService(mk("reward-points"));
|
|
3545
|
+
this.brands = new BrandService(mk("brand"));
|
|
3546
|
+
this.labels = new LabelService(mk("label"));
|
|
3547
|
+
this.countries = new CountryService(mk("country"));
|
|
3548
|
+
this.currencies = new CurrencyService(mk("currency"));
|
|
3549
|
+
this.shipping = new ShippingService(mk("shipping"));
|
|
3550
|
+
this.returns = new ReturnsService(mk("returns"));
|
|
3551
|
+
this.sepaExport = new SepaExportService(mk("sepa-export"));
|
|
3552
|
+
this.indexing = new IndexingService(mk("indexing"));
|
|
3553
|
+
this.units = new UnitHandlingService(mk("unit-handling"));
|
|
3554
|
+
this.catalogs = new CatalogService(mk("catalog"));
|
|
3555
|
+
this.vendors = new VendorService(mk("vendor"));
|
|
3556
|
+
this.pickPack = new PickPackService(mk("pick-pack"));
|
|
3557
|
+
this.customerAdmin = new CustomerAdminService(mk("customer-admin"));
|
|
3558
|
+
this.approvals = new ApprovalService(mk("approval"));
|
|
1806
3559
|
}
|
|
1807
3560
|
/** Sets the runtime log level globally or for one service. */
|
|
1808
3561
|
setLogLevel(level, opts = {}) {
|
|
@@ -1814,6 +3567,6 @@ var EmporixClient = class {
|
|
|
1814
3567
|
}
|
|
1815
3568
|
};
|
|
1816
3569
|
|
|
1817
|
-
export { AiService, ClientConfigService, DEFAULT_HOST, DefaultTokenProvider, EmporixClient, FeeService, HttpClient, LEVEL, LevelResolver, RagIndexerService, SchemaService, SequentialIdService, SessionContextService, ShoppingListService, SiteService, TenantConfigService, WebhookService, auth, createConsoleLogger, createNoopLogger, redact, resolveToken, validateConfig };
|
|
3570
|
+
export { AiService, ApprovalService, BrandService, CatalogService, ClientConfigService, CountryService, CouponService, CurrencyService, CustomerAdminService, DEFAULT_HOST, DefaultTokenProvider, EmporixClient, FeeService, HttpClient, IndexingService, LEVEL, LabelService, LevelResolver, PickPackService, RagIndexerService, ReturnsService, RewardPointsService, SchemaService, SepaExportService, SequentialIdService, SessionContextService, ShippingService, ShoppingListService, SiteService, TaxService, TenantConfigService, UnitHandlingService, VendorService, WebhookService, auth, createConsoleLogger, createNoopLogger, redact, resolveToken, validateConfig };
|
|
1818
3571
|
//# sourceMappingURL=index.js.map
|
|
1819
3572
|
//# sourceMappingURL=index.js.map
|