feeef 0.10.0 → 0.11.1
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/build/index.js +640 -2
- package/build/index.js.map +1 -1
- package/build/src/core/batch.d.ts +63 -0
- package/build/src/core/entities/finance.d.ts +355 -0
- package/build/src/core/entities/inventory.d.ts +80 -0
- package/build/src/core/entities/store.d.ts +83 -0
- package/build/src/feeef/feeef.d.ts +10 -0
- package/build/src/feeef/repositories/finance.d.ts +156 -0
- package/build/src/feeef/repositories/inventory.d.ts +159 -0
- package/build/src/feeef/repositories/orders.d.ts +16 -0
- package/build/src/feeef/repositories/repository.d.ts +34 -0
- package/build/src/feeef/repositories/transfers.d.ts +1 -1
- package/build/src/feeef/services/integrations.d.ts +16 -0
- package/build/src/index.d.ts +5 -0
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -1,6 +1,84 @@
|
|
|
1
1
|
// src/feeef/feeef.ts
|
|
2
2
|
import axios from "axios";
|
|
3
3
|
|
|
4
|
+
// src/feeef/repositories/repository.ts
|
|
5
|
+
import { isAxiosError } from "axios";
|
|
6
|
+
|
|
7
|
+
// src/core/batch.ts
|
|
8
|
+
function batchSummaryHasFailures(summary) {
|
|
9
|
+
return summary.failed > 0;
|
|
10
|
+
}
|
|
11
|
+
function batchSummaryAllFailed(summary) {
|
|
12
|
+
return summary.total > 0 && summary.succeeded === 0;
|
|
13
|
+
}
|
|
14
|
+
function parseBatchRpcStatus(json) {
|
|
15
|
+
return {
|
|
16
|
+
code: json.code ?? "UNKNOWN",
|
|
17
|
+
message: json.message ?? "Request failed",
|
|
18
|
+
details: json.details
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function parseBatchSummary(json) {
|
|
22
|
+
return {
|
|
23
|
+
total: Number(json.total ?? 0),
|
|
24
|
+
succeeded: Number(json.succeeded ?? 0),
|
|
25
|
+
failed: Number(json.failed ?? 0)
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function parseBatchResult(data, resourceFromJson) {
|
|
29
|
+
const map = data && typeof data === "object" ? data : {};
|
|
30
|
+
const failedRaw = map.failedRequests ?? {};
|
|
31
|
+
const failedRequests = {};
|
|
32
|
+
for (const [key, value] of Object.entries(failedRaw)) {
|
|
33
|
+
failedRequests[key] = parseBatchRpcStatus(
|
|
34
|
+
value && typeof value === "object" ? value : {}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
let resources;
|
|
38
|
+
if (resourceFromJson && Array.isArray(map.resources)) {
|
|
39
|
+
resources = map.resources.map(
|
|
40
|
+
(e) => resourceFromJson(e && typeof e === "object" ? e : {})
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
resources,
|
|
45
|
+
failedRequests,
|
|
46
|
+
summary: parseBatchSummary(
|
|
47
|
+
map.summary && typeof map.summary === "object" ? map.summary : {}
|
|
48
|
+
),
|
|
49
|
+
code: map.code,
|
|
50
|
+
message: map.message
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function batchDeleteBody(request) {
|
|
54
|
+
return {
|
|
55
|
+
projectId: request.projectId,
|
|
56
|
+
names: request.names,
|
|
57
|
+
returnPartialSuccess: request.returnPartialSuccess ?? true,
|
|
58
|
+
...request.requestId ? { requestId: request.requestId } : {}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function batchUpdateManyBody(request) {
|
|
62
|
+
const { projectId, names, updateMask, returnPartialSuccess, requestId, fields } = request;
|
|
63
|
+
return {
|
|
64
|
+
projectId,
|
|
65
|
+
names,
|
|
66
|
+
updateMask,
|
|
67
|
+
...fields ?? {},
|
|
68
|
+
returnPartialSuccess: returnPartialSuccess ?? true,
|
|
69
|
+
...requestId ? { requestId } : {}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function batchReleaseBody(request) {
|
|
73
|
+
if (request.toJson) return request.toJson();
|
|
74
|
+
return {
|
|
75
|
+
projectId: request.projectId,
|
|
76
|
+
names: request.names,
|
|
77
|
+
returnPartialSuccess: request.returnPartialSuccess ?? true,
|
|
78
|
+
...request.requestId ? { requestId: request.requestId } : {}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
4
82
|
// src/feeef/repositories/repository.ts
|
|
5
83
|
var ModelRepository = class {
|
|
6
84
|
resource;
|
|
@@ -109,6 +187,69 @@ var ModelRepository = class {
|
|
|
109
187
|
}
|
|
110
188
|
});
|
|
111
189
|
}
|
|
190
|
+
/**
|
|
191
|
+
* Batch delete by resource name/id (`POST /{resource}:batchDelete`).
|
|
192
|
+
* Override on repositories that support batch delete.
|
|
193
|
+
*/
|
|
194
|
+
async deleteMany(_request) {
|
|
195
|
+
throw new Error(`deleteMany is not supported for ${this.resource}`);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Batch update with field mask (`POST /{resource}:batchUpdate`).
|
|
199
|
+
*/
|
|
200
|
+
async updateMany(_request) {
|
|
201
|
+
throw new Error(`updateMany is not supported for ${this.resource}`);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Batch create (`POST /{resource}:batchCreate`).
|
|
205
|
+
*/
|
|
206
|
+
async createMany(_request) {
|
|
207
|
+
throw new Error(`createMany is not supported for ${this.resource}`);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* POST `/{resource}:batchDelete` — used by inventory resource repositories.
|
|
211
|
+
*/
|
|
212
|
+
async postBatchDelete(request) {
|
|
213
|
+
return this.postBatch(`/${this.resource}:batchDelete`, batchDeleteBody(request));
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* POST `/{resource}:batchUpdate`.
|
|
217
|
+
*/
|
|
218
|
+
async postBatchUpdate(request) {
|
|
219
|
+
return this.postBatch(`/${this.resource}:batchUpdate`, batchUpdateManyBody(request));
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* POST `/{resource}:batchCreate`.
|
|
223
|
+
*/
|
|
224
|
+
async postBatchCreate(request) {
|
|
225
|
+
const body = {
|
|
226
|
+
projectId: request.projectId,
|
|
227
|
+
items: request.items,
|
|
228
|
+
returnPartialSuccess: request.returnPartialSuccess ?? true,
|
|
229
|
+
...request.requestId ? { requestId: request.requestId } : {}
|
|
230
|
+
};
|
|
231
|
+
return this.postBatch(`/${this.resource}:batchCreate`, body);
|
|
232
|
+
}
|
|
233
|
+
/** `POST /{resource}:{action}` for custom batch endpoints (e.g. `:batchRelease`). */
|
|
234
|
+
async postBatchAction(action, body) {
|
|
235
|
+
return this.postBatch(`/${this.resource}:${action}`, body);
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Parses batch envelope from 200 or 400 ABORTED responses.
|
|
239
|
+
*
|
|
240
|
+
* Use `postBatch<void>(...)` when the API returns no `resources` array.
|
|
241
|
+
*/
|
|
242
|
+
async postBatch(path, body, resourceFromJson) {
|
|
243
|
+
try {
|
|
244
|
+
const res = await this.client.post(path, body);
|
|
245
|
+
return parseBatchResult(res.data, resourceFromJson);
|
|
246
|
+
} catch (error) {
|
|
247
|
+
if (isAxiosError(error) && error.response?.data) {
|
|
248
|
+
return parseBatchResult(error.response.data, resourceFromJson);
|
|
249
|
+
}
|
|
250
|
+
throw error;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
112
253
|
};
|
|
113
254
|
|
|
114
255
|
// src/feeef/repositories/orders.ts
|
|
@@ -239,6 +380,14 @@ var OrderRepository = class extends ModelRepository {
|
|
|
239
380
|
const res = await this.client.post(`/${this.resource}/assignMany`, data);
|
|
240
381
|
return res.data;
|
|
241
382
|
}
|
|
383
|
+
/**
|
|
384
|
+
* Returns items from an order to inventory.
|
|
385
|
+
* @param data - The return data including orderId, reason, and deltas.
|
|
386
|
+
*/
|
|
387
|
+
async returnOrder(data) {
|
|
388
|
+
const res = await this.client.post(`/${this.resource}/return`, data);
|
|
389
|
+
return res.data;
|
|
390
|
+
}
|
|
242
391
|
};
|
|
243
392
|
|
|
244
393
|
// src/feeef/repositories/products.ts
|
|
@@ -1829,6 +1978,441 @@ var FeedbackRepository = class extends ModelRepository {
|
|
|
1829
1978
|
}
|
|
1830
1979
|
};
|
|
1831
1980
|
|
|
1981
|
+
// src/feeef/repositories/inventory.ts
|
|
1982
|
+
var InventoryBatchUpdateObjectsRequest = class {
|
|
1983
|
+
projectId;
|
|
1984
|
+
names;
|
|
1985
|
+
updateMask;
|
|
1986
|
+
returnPartialSuccess;
|
|
1987
|
+
requestId;
|
|
1988
|
+
fields;
|
|
1989
|
+
constructor(options) {
|
|
1990
|
+
this.projectId = options.projectId;
|
|
1991
|
+
this.names = options.names;
|
|
1992
|
+
this.updateMask = options.updateMask;
|
|
1993
|
+
this.returnPartialSuccess = options.returnPartialSuccess;
|
|
1994
|
+
this.requestId = options.requestId;
|
|
1995
|
+
this.fields = {
|
|
1996
|
+
...options.storageClass !== void 0 ? { storageClass: options.storageClass } : {},
|
|
1997
|
+
...options.warehouseId !== void 0 ? { warehouseId: options.warehouseId } : {},
|
|
1998
|
+
...options.namespace !== void 0 ? { namespace: options.namespace } : {},
|
|
1999
|
+
...options.batch !== void 0 ? { batch: options.batch } : {},
|
|
2000
|
+
...options.priority !== void 0 ? { priority: options.priority } : {},
|
|
2001
|
+
...options.expiresAt !== void 0 ? { expiresAt: options.expiresAt } : {}
|
|
2002
|
+
};
|
|
2003
|
+
}
|
|
2004
|
+
};
|
|
2005
|
+
var InventoryObjectRepository = class extends ModelRepository {
|
|
2006
|
+
constructor(client) {
|
|
2007
|
+
super("inventory/objects", client);
|
|
2008
|
+
}
|
|
2009
|
+
async find(options) {
|
|
2010
|
+
const res = await this.client.get(`/inventory/objects/${options.id}`, {
|
|
2011
|
+
params: options.params
|
|
2012
|
+
});
|
|
2013
|
+
return res.data;
|
|
2014
|
+
}
|
|
2015
|
+
async list(options) {
|
|
2016
|
+
const { page, offset, limit, params } = options ?? {};
|
|
2017
|
+
const res = await this.client.get("/inventory/objects", {
|
|
2018
|
+
params: { page, offset, limit, ...params }
|
|
2019
|
+
});
|
|
2020
|
+
return res.data;
|
|
2021
|
+
}
|
|
2022
|
+
async create(data) {
|
|
2023
|
+
const res = await this.client.post("/inventory/objects", data);
|
|
2024
|
+
return res.data;
|
|
2025
|
+
}
|
|
2026
|
+
async update(options) {
|
|
2027
|
+
const res = await this.client.put(`/inventory/objects/${options.id}`, options.data, {
|
|
2028
|
+
params: options.params
|
|
2029
|
+
});
|
|
2030
|
+
return res.data;
|
|
2031
|
+
}
|
|
2032
|
+
async delete(options) {
|
|
2033
|
+
await this.client.delete(`/inventory/objects/${options.id}`, { params: options.params });
|
|
2034
|
+
}
|
|
2035
|
+
async deleteMany(request) {
|
|
2036
|
+
return this.postBatchDelete(request);
|
|
2037
|
+
}
|
|
2038
|
+
async updateMany(request) {
|
|
2039
|
+
const body = request instanceof InventoryBatchUpdateObjectsRequest ? batchUpdateManyBody(request) : batchUpdateManyBody(request);
|
|
2040
|
+
return this.postBatch(`/${this.resource}:batchUpdate`, body);
|
|
2041
|
+
}
|
|
2042
|
+
async applyDeltas(data) {
|
|
2043
|
+
await this.client.post("/inventory/objects/apply-deltas", data);
|
|
2044
|
+
}
|
|
2045
|
+
};
|
|
2046
|
+
var InventoryWarehouseRepository = class extends ModelRepository {
|
|
2047
|
+
constructor(client) {
|
|
2048
|
+
super("inventory/warehouses", client);
|
|
2049
|
+
}
|
|
2050
|
+
async list(options) {
|
|
2051
|
+
const res = await this.client.get("/inventory/warehouses", { params: options?.params });
|
|
2052
|
+
return res.data;
|
|
2053
|
+
}
|
|
2054
|
+
async create(data) {
|
|
2055
|
+
const res = await this.client.post("/inventory/warehouses", data);
|
|
2056
|
+
return res.data;
|
|
2057
|
+
}
|
|
2058
|
+
async delete(options) {
|
|
2059
|
+
await this.client.delete(`/inventory/warehouses/${options.id}`, {
|
|
2060
|
+
params: options.params
|
|
2061
|
+
});
|
|
2062
|
+
}
|
|
2063
|
+
async deleteMany(request) {
|
|
2064
|
+
return this.postBatchDelete(request);
|
|
2065
|
+
}
|
|
2066
|
+
};
|
|
2067
|
+
var InventoryAliasRepository = class extends ModelRepository {
|
|
2068
|
+
constructor(client) {
|
|
2069
|
+
super("inventory/aliases", client);
|
|
2070
|
+
}
|
|
2071
|
+
async list(options) {
|
|
2072
|
+
const res = await this.client.get("/inventory/aliases", { params: options?.params });
|
|
2073
|
+
return res.data;
|
|
2074
|
+
}
|
|
2075
|
+
async create(data) {
|
|
2076
|
+
const res = await this.client.post("/inventory/aliases", data);
|
|
2077
|
+
return res.data;
|
|
2078
|
+
}
|
|
2079
|
+
async update(options) {
|
|
2080
|
+
const res = await this.client.put(`/inventory/aliases/${options.id}`, options.data, {
|
|
2081
|
+
params: options.params
|
|
2082
|
+
});
|
|
2083
|
+
return res.data;
|
|
2084
|
+
}
|
|
2085
|
+
async delete(options) {
|
|
2086
|
+
await this.client.delete(`/inventory/aliases/${options.id}`, { params: options.params });
|
|
2087
|
+
}
|
|
2088
|
+
async deleteMany(request) {
|
|
2089
|
+
return this.postBatchDelete(request);
|
|
2090
|
+
}
|
|
2091
|
+
};
|
|
2092
|
+
var InventoryReservationRepository = class extends ModelRepository {
|
|
2093
|
+
constructor(client) {
|
|
2094
|
+
super("inventory/reservations", client);
|
|
2095
|
+
}
|
|
2096
|
+
async find(options) {
|
|
2097
|
+
const res = await this.client.get(`/inventory/reservations/${options.id}`, {
|
|
2098
|
+
params: options.params
|
|
2099
|
+
});
|
|
2100
|
+
const data = res.data;
|
|
2101
|
+
if (Array.isArray(data) && data.length > 0) return data[0];
|
|
2102
|
+
return data;
|
|
2103
|
+
}
|
|
2104
|
+
async list(options) {
|
|
2105
|
+
const res = await this.client.get("/inventory/reservations", {
|
|
2106
|
+
params: options?.params
|
|
2107
|
+
});
|
|
2108
|
+
return res.data;
|
|
2109
|
+
}
|
|
2110
|
+
async create() {
|
|
2111
|
+
throw new Error("Reservations are created by the inventory service");
|
|
2112
|
+
}
|
|
2113
|
+
async update() {
|
|
2114
|
+
throw new Error("Reservations cannot be updated; use release");
|
|
2115
|
+
}
|
|
2116
|
+
async delete() {
|
|
2117
|
+
throw new Error("Reservations cannot be deleted; use release");
|
|
2118
|
+
}
|
|
2119
|
+
async release(options) {
|
|
2120
|
+
await this.client.post(`/inventory/reservations/${options.id}:release`, null, {
|
|
2121
|
+
params: { projectId: options.projectId }
|
|
2122
|
+
});
|
|
2123
|
+
}
|
|
2124
|
+
async releaseMany(request) {
|
|
2125
|
+
return this.postBatch(`/${this.resource}:batchRelease`, batchReleaseBody(request));
|
|
2126
|
+
}
|
|
2127
|
+
};
|
|
2128
|
+
var InventoryMovementRepository = class extends ModelRepository {
|
|
2129
|
+
constructor(client) {
|
|
2130
|
+
super("inventory/movements", client);
|
|
2131
|
+
}
|
|
2132
|
+
async list(options) {
|
|
2133
|
+
const res = await this.client.get("/inventory/movements", { params: options?.params });
|
|
2134
|
+
return res.data;
|
|
2135
|
+
}
|
|
2136
|
+
async create() {
|
|
2137
|
+
throw new Error("Inventory movements are immutable audit records");
|
|
2138
|
+
}
|
|
2139
|
+
async update() {
|
|
2140
|
+
throw new Error("Inventory movements are immutable audit records");
|
|
2141
|
+
}
|
|
2142
|
+
async delete() {
|
|
2143
|
+
throw new Error("Inventory movements are immutable audit records");
|
|
2144
|
+
}
|
|
2145
|
+
};
|
|
2146
|
+
var InventoryRepository = class {
|
|
2147
|
+
objects;
|
|
2148
|
+
warehouses;
|
|
2149
|
+
aliases;
|
|
2150
|
+
reservations;
|
|
2151
|
+
movements;
|
|
2152
|
+
client;
|
|
2153
|
+
constructor(client) {
|
|
2154
|
+
this.client = client;
|
|
2155
|
+
this.objects = new InventoryObjectRepository(client);
|
|
2156
|
+
this.warehouses = new InventoryWarehouseRepository(client);
|
|
2157
|
+
this.aliases = new InventoryAliasRepository(client);
|
|
2158
|
+
this.reservations = new InventoryReservationRepository(client);
|
|
2159
|
+
this.movements = new InventoryMovementRepository(client);
|
|
2160
|
+
}
|
|
2161
|
+
async availability(params) {
|
|
2162
|
+
const res = await this.client.get("/inventory/availability", {
|
|
2163
|
+
params: { projectId: params.projectId, skus: params.skus.join(",") }
|
|
2164
|
+
});
|
|
2165
|
+
const raw = res.data;
|
|
2166
|
+
if (raw && typeof raw === "object" && "data" in raw && raw.data) {
|
|
2167
|
+
return raw.data;
|
|
2168
|
+
}
|
|
2169
|
+
return raw ?? {};
|
|
2170
|
+
}
|
|
2171
|
+
async reservationsByHolder(params) {
|
|
2172
|
+
return this.reservations.list({ params });
|
|
2173
|
+
}
|
|
2174
|
+
async listProjects() {
|
|
2175
|
+
const res = await this.client.get("/inventory/projects");
|
|
2176
|
+
return res.data;
|
|
2177
|
+
}
|
|
2178
|
+
async createProject(data) {
|
|
2179
|
+
const res = await this.client.post("/inventory/projects", data);
|
|
2180
|
+
return res.data;
|
|
2181
|
+
}
|
|
2182
|
+
async publicAvailability(data) {
|
|
2183
|
+
const res = await this.client.post("/inventory/public/availability", data);
|
|
2184
|
+
const raw = res.data;
|
|
2185
|
+
if (raw && typeof raw === "object" && "data" in raw && raw.data) {
|
|
2186
|
+
return raw.data;
|
|
2187
|
+
}
|
|
2188
|
+
return raw ?? {};
|
|
2189
|
+
}
|
|
2190
|
+
};
|
|
2191
|
+
|
|
2192
|
+
// src/feeef/repositories/finance.ts
|
|
2193
|
+
var SupplierRepository = class extends ModelRepository {
|
|
2194
|
+
constructor(client) {
|
|
2195
|
+
super("finance/suppliers", client);
|
|
2196
|
+
}
|
|
2197
|
+
async deleteMany(request) {
|
|
2198
|
+
return this.postBatchDelete(request);
|
|
2199
|
+
}
|
|
2200
|
+
};
|
|
2201
|
+
var PurchaseOrderRepository = class extends ModelRepository {
|
|
2202
|
+
constructor(client) {
|
|
2203
|
+
super("finance/purchase-orders", client);
|
|
2204
|
+
}
|
|
2205
|
+
/** Transition the PO to `sent`. */
|
|
2206
|
+
async send(options) {
|
|
2207
|
+
const res = await this.client.post(`/${this.resource}/${options.id}/send`, null, {
|
|
2208
|
+
params: { projectId: options.projectId }
|
|
2209
|
+
});
|
|
2210
|
+
return res.data;
|
|
2211
|
+
}
|
|
2212
|
+
/** Transition the PO to `cancelled`. */
|
|
2213
|
+
async cancel(options) {
|
|
2214
|
+
const res = await this.client.post(`/${this.resource}/${options.id}/cancel`, null, {
|
|
2215
|
+
params: { projectId: options.projectId }
|
|
2216
|
+
});
|
|
2217
|
+
return res.data;
|
|
2218
|
+
}
|
|
2219
|
+
/** Set an explicit status (state machine enforced server-side). */
|
|
2220
|
+
async setStatus(options) {
|
|
2221
|
+
const res = await this.client.post(
|
|
2222
|
+
`/${this.resource}/${options.id}/status`,
|
|
2223
|
+
{ status: options.status },
|
|
2224
|
+
{ params: { projectId: options.projectId } }
|
|
2225
|
+
);
|
|
2226
|
+
return res.data;
|
|
2227
|
+
}
|
|
2228
|
+
};
|
|
2229
|
+
var PurchaseReceiptRepository = class extends ModelRepository {
|
|
2230
|
+
constructor(client) {
|
|
2231
|
+
super("finance/purchase-receipts", client);
|
|
2232
|
+
}
|
|
2233
|
+
async update() {
|
|
2234
|
+
throw new Error("Purchase receipts are immutable; create a new one or void/post.");
|
|
2235
|
+
}
|
|
2236
|
+
/** Post the receipt: stock goods into inventory at batch cost (idempotent). */
|
|
2237
|
+
async post(options) {
|
|
2238
|
+
const res = await this.client.post(`/${this.resource}/${options.id}/post`, null, {
|
|
2239
|
+
params: { projectId: options.projectId }
|
|
2240
|
+
});
|
|
2241
|
+
return res.data;
|
|
2242
|
+
}
|
|
2243
|
+
/** Void a posted receipt: reverse its stock-in. */
|
|
2244
|
+
async void(options) {
|
|
2245
|
+
const res = await this.client.post(`/${this.resource}/${options.id}/void`, null, {
|
|
2246
|
+
params: { projectId: options.projectId }
|
|
2247
|
+
});
|
|
2248
|
+
return res.data;
|
|
2249
|
+
}
|
|
2250
|
+
};
|
|
2251
|
+
var FinancialAccountRepository = class extends ModelRepository {
|
|
2252
|
+
constructor(client) {
|
|
2253
|
+
super("finance/financial-accounts", client);
|
|
2254
|
+
}
|
|
2255
|
+
async deleteMany(request) {
|
|
2256
|
+
return this.postBatchDelete(request);
|
|
2257
|
+
}
|
|
2258
|
+
};
|
|
2259
|
+
var SupplierBillRepository = class extends ModelRepository {
|
|
2260
|
+
constructor(client) {
|
|
2261
|
+
super("finance/supplier-bills", client);
|
|
2262
|
+
}
|
|
2263
|
+
async update() {
|
|
2264
|
+
throw new Error("Supplier bills are managed via payments; bill totals are not edited.");
|
|
2265
|
+
}
|
|
2266
|
+
/** Record a (partial) payment against a bill. */
|
|
2267
|
+
async pay(options) {
|
|
2268
|
+
const { id, projectId, ...body } = options;
|
|
2269
|
+
const res = await this.client.post(
|
|
2270
|
+
`/${this.resource}/${id}/pay`,
|
|
2271
|
+
{ projectId, ...body },
|
|
2272
|
+
{ params: { projectId } }
|
|
2273
|
+
);
|
|
2274
|
+
return res.data;
|
|
2275
|
+
}
|
|
2276
|
+
};
|
|
2277
|
+
var SupplierPaymentRepository = class extends ModelRepository {
|
|
2278
|
+
constructor(client) {
|
|
2279
|
+
super("finance/supplier-payments", client);
|
|
2280
|
+
}
|
|
2281
|
+
/** Void a payment and recompute the parent bill. */
|
|
2282
|
+
async void(options) {
|
|
2283
|
+
const res = await this.client.post(`/${this.resource}/${options.id}/void`, null, {
|
|
2284
|
+
params: { projectId: options.projectId }
|
|
2285
|
+
});
|
|
2286
|
+
return res.data;
|
|
2287
|
+
}
|
|
2288
|
+
};
|
|
2289
|
+
var CustomerPaymentRepository = class extends ModelRepository {
|
|
2290
|
+
constructor(client) {
|
|
2291
|
+
super("finance/customer-payments", client);
|
|
2292
|
+
}
|
|
2293
|
+
/** Void a customer payment. */
|
|
2294
|
+
async void(options) {
|
|
2295
|
+
const res = await this.client.post(`/${this.resource}/${options.id}/void`, null, {
|
|
2296
|
+
params: { projectId: options.projectId }
|
|
2297
|
+
});
|
|
2298
|
+
return res.data;
|
|
2299
|
+
}
|
|
2300
|
+
};
|
|
2301
|
+
var ExpenseRepository = class extends ModelRepository {
|
|
2302
|
+
constructor(client) {
|
|
2303
|
+
super("finance/expenses", client);
|
|
2304
|
+
}
|
|
2305
|
+
async deleteMany(request) {
|
|
2306
|
+
return this.postBatchDelete(request);
|
|
2307
|
+
}
|
|
2308
|
+
};
|
|
2309
|
+
var ExpenseCategoryRepository = class extends ModelRepository {
|
|
2310
|
+
constructor(client) {
|
|
2311
|
+
super("finance/expense-categories", client);
|
|
2312
|
+
}
|
|
2313
|
+
};
|
|
2314
|
+
var FinanceRepository = class {
|
|
2315
|
+
suppliers;
|
|
2316
|
+
purchaseOrders;
|
|
2317
|
+
purchaseReceipts;
|
|
2318
|
+
financialAccounts;
|
|
2319
|
+
supplierBills;
|
|
2320
|
+
supplierPayments;
|
|
2321
|
+
customerPayments;
|
|
2322
|
+
expenses;
|
|
2323
|
+
expenseCategories;
|
|
2324
|
+
client;
|
|
2325
|
+
constructor(client) {
|
|
2326
|
+
this.client = client;
|
|
2327
|
+
this.suppliers = new SupplierRepository(client);
|
|
2328
|
+
this.purchaseOrders = new PurchaseOrderRepository(client);
|
|
2329
|
+
this.purchaseReceipts = new PurchaseReceiptRepository(client);
|
|
2330
|
+
this.financialAccounts = new FinancialAccountRepository(client);
|
|
2331
|
+
this.supplierBills = new SupplierBillRepository(client);
|
|
2332
|
+
this.supplierPayments = new SupplierPaymentRepository(client);
|
|
2333
|
+
this.customerPayments = new CustomerPaymentRepository(client);
|
|
2334
|
+
this.expenses = new ExpenseRepository(client);
|
|
2335
|
+
this.expenseCategories = new ExpenseCategoryRepository(client);
|
|
2336
|
+
}
|
|
2337
|
+
listSuppliers(options) {
|
|
2338
|
+
const { projectId, page, limit, params } = options ?? {};
|
|
2339
|
+
return this.suppliers.list({ page, limit, params: { projectId, ...params } });
|
|
2340
|
+
}
|
|
2341
|
+
/** Open order receivables (derived, read-only). */
|
|
2342
|
+
async listReceivables(options) {
|
|
2343
|
+
const res = await this.client.get("/finance/receivables", {
|
|
2344
|
+
params: { projectId: options.projectId }
|
|
2345
|
+
});
|
|
2346
|
+
return res.data.data ?? res.data;
|
|
2347
|
+
}
|
|
2348
|
+
/** Record a customer / COD payment against an order. */
|
|
2349
|
+
async collectPayment(options) {
|
|
2350
|
+
const { orderId, projectId, ...body } = options;
|
|
2351
|
+
const res = await this.client.post(
|
|
2352
|
+
`/finance/orders/${orderId}/collect`,
|
|
2353
|
+
{ projectId, ...body },
|
|
2354
|
+
{ params: { projectId } }
|
|
2355
|
+
);
|
|
2356
|
+
return res.data;
|
|
2357
|
+
}
|
|
2358
|
+
// --- Reports ------------------------------------------------------------
|
|
2359
|
+
async overview(options) {
|
|
2360
|
+
const res = await this.client.get("/finance/reports/overview", {
|
|
2361
|
+
params: { projectId: options.projectId }
|
|
2362
|
+
});
|
|
2363
|
+
return res.data;
|
|
2364
|
+
}
|
|
2365
|
+
async cashPosition(options) {
|
|
2366
|
+
const res = await this.client.get("/finance/reports/cash-position", {
|
|
2367
|
+
params: { projectId: options.projectId }
|
|
2368
|
+
});
|
|
2369
|
+
return res.data;
|
|
2370
|
+
}
|
|
2371
|
+
async apAging(options) {
|
|
2372
|
+
const res = await this.client.get("/finance/reports/ap-aging", {
|
|
2373
|
+
params: { projectId: options.projectId }
|
|
2374
|
+
});
|
|
2375
|
+
return res.data;
|
|
2376
|
+
}
|
|
2377
|
+
async arAging(options) {
|
|
2378
|
+
const res = await this.client.get("/finance/reports/ar-aging", {
|
|
2379
|
+
params: { projectId: options.projectId }
|
|
2380
|
+
});
|
|
2381
|
+
return res.data;
|
|
2382
|
+
}
|
|
2383
|
+
async pnl(options) {
|
|
2384
|
+
const res = await this.client.get("/finance/reports/pnl", {
|
|
2385
|
+
params: { projectId: options.projectId, from: options.from, to: options.to }
|
|
2386
|
+
});
|
|
2387
|
+
return res.data;
|
|
2388
|
+
}
|
|
2389
|
+
// --- Phase 3 GL ---------------------------------------------------------
|
|
2390
|
+
async listGlAccounts(options) {
|
|
2391
|
+
const res = await this.client.get("/finance/gl-accounts", {
|
|
2392
|
+
params: { projectId: options.projectId, type: options.type }
|
|
2393
|
+
});
|
|
2394
|
+
return res.data?.data ?? res.data;
|
|
2395
|
+
}
|
|
2396
|
+
async listJournalEntries(options) {
|
|
2397
|
+
const res = await this.client.get("/finance/journal-entries", {
|
|
2398
|
+
params: options
|
|
2399
|
+
});
|
|
2400
|
+
return res.data?.data ?? res.data;
|
|
2401
|
+
}
|
|
2402
|
+
async trialBalance(options) {
|
|
2403
|
+
const res = await this.client.get("/finance/reports/trial-balance", {
|
|
2404
|
+
params: { projectId: options.projectId, asOf: options.asOf }
|
|
2405
|
+
});
|
|
2406
|
+
return res.data;
|
|
2407
|
+
}
|
|
2408
|
+
async balanceSheet(options) {
|
|
2409
|
+
const res = await this.client.get("/finance/reports/balance-sheet", {
|
|
2410
|
+
params: { projectId: options.projectId, asOf: options.asOf }
|
|
2411
|
+
});
|
|
2412
|
+
return res.data;
|
|
2413
|
+
}
|
|
2414
|
+
};
|
|
2415
|
+
|
|
1832
2416
|
// src/feeef/repositories/product_landing_page_templates.ts
|
|
1833
2417
|
var ProductLandingPageTemplatesRepository = class extends ModelRepository {
|
|
1834
2418
|
/**
|
|
@@ -3654,6 +4238,16 @@ var EcotrackDeliveryIntegrationApi = class {
|
|
|
3654
4238
|
});
|
|
3655
4239
|
return res.data;
|
|
3656
4240
|
}
|
|
4241
|
+
/**
|
|
4242
|
+
* Sync only COD payouts received by the merchant (Ecotrack cash-in history).
|
|
4243
|
+
*/
|
|
4244
|
+
async triggerCashinSync(options) {
|
|
4245
|
+
const res = await this.client.post(
|
|
4246
|
+
`/stores/${this.storeId}/integrations/ecotrack/sync/cashin`,
|
|
4247
|
+
options?.forceAll ? { forceAll: true } : void 0
|
|
4248
|
+
);
|
|
4249
|
+
return res.data;
|
|
4250
|
+
}
|
|
3657
4251
|
};
|
|
3658
4252
|
var YalidineAgent = /* @__PURE__ */ ((YalidineAgent2) => {
|
|
3659
4253
|
YalidineAgent2["yalidine"] = "yalidine";
|
|
@@ -3993,6 +4587,14 @@ var FeeeF = class {
|
|
|
3993
4587
|
* The repository for managing feedbacks.
|
|
3994
4588
|
*/
|
|
3995
4589
|
feedbacks;
|
|
4590
|
+
/**
|
|
4591
|
+
* The repository for managing inventory.
|
|
4592
|
+
*/
|
|
4593
|
+
inventory;
|
|
4594
|
+
/**
|
|
4595
|
+
* The repository for managing finance (procurement: suppliers, POs, receipts).
|
|
4596
|
+
*/
|
|
4597
|
+
finance;
|
|
3996
4598
|
/**
|
|
3997
4599
|
* The cart service for managing the cart.
|
|
3998
4600
|
*/
|
|
@@ -4051,6 +4653,8 @@ var FeeeF = class {
|
|
|
4051
4653
|
this.shippingPrices = new ShippingPriceRepository(this.client);
|
|
4052
4654
|
this.shippingMethods = new ShippingMethodRepository(this.client);
|
|
4053
4655
|
this.feedbacks = new FeedbackRepository(this.client);
|
|
4656
|
+
this.inventory = new InventoryRepository(this.client);
|
|
4657
|
+
this.finance = new FinanceRepository(this.client);
|
|
4054
4658
|
this.cart = new CartService();
|
|
4055
4659
|
this.actions = new ActionsService(this.client);
|
|
4056
4660
|
this.notifications = new NotificationsService(this.client);
|
|
@@ -4129,7 +4733,7 @@ var generatePublicStoreIntegrationCustomFields = (customFields) => {
|
|
|
4129
4733
|
var generatePublicStoreIntegrationMetaPixel = (metaPixel) => {
|
|
4130
4734
|
if (!metaPixel) return null;
|
|
4131
4735
|
return {
|
|
4132
|
-
pixels: metaPixel.pixels.map((pixel) => ({
|
|
4736
|
+
pixels: (metaPixel.pixels || []).map((pixel) => ({
|
|
4133
4737
|
id: pixel.id
|
|
4134
4738
|
})),
|
|
4135
4739
|
active: metaPixel.active,
|
|
@@ -4141,7 +4745,7 @@ var generatePublicStoreIntegrationMetaPixel = (metaPixel) => {
|
|
|
4141
4745
|
var generatePublicStoreIntegrationTiktokPixel = (tiktokPixel) => {
|
|
4142
4746
|
if (!tiktokPixel) return null;
|
|
4143
4747
|
return {
|
|
4144
|
-
pixels: tiktokPixel.pixels.map((pixel) => ({
|
|
4748
|
+
pixels: (tiktokPixel.pixels || []).map((pixel) => ({
|
|
4145
4749
|
id: pixel.id
|
|
4146
4750
|
})),
|
|
4147
4751
|
active: tiktokPixel.active,
|
|
@@ -4333,9 +4937,17 @@ var StoreSubscriptionType = /* @__PURE__ */ ((StoreSubscriptionType2) => {
|
|
|
4333
4937
|
StoreSubscriptionType2["free"] = "free";
|
|
4334
4938
|
StoreSubscriptionType2["premium"] = "premium";
|
|
4335
4939
|
StoreSubscriptionType2["vip"] = "vip";
|
|
4940
|
+
StoreSubscriptionType2["ultra"] = "ultra";
|
|
4336
4941
|
StoreSubscriptionType2["custom"] = "custom";
|
|
4337
4942
|
return StoreSubscriptionType2;
|
|
4338
4943
|
})(StoreSubscriptionType || {});
|
|
4944
|
+
var IntegrationBillingStatus = /* @__PURE__ */ ((IntegrationBillingStatus2) => {
|
|
4945
|
+
IntegrationBillingStatus2["active"] = "active";
|
|
4946
|
+
IntegrationBillingStatus2["grace"] = "grace";
|
|
4947
|
+
IntegrationBillingStatus2["past_due"] = "past_due";
|
|
4948
|
+
IntegrationBillingStatus2["canceled"] = "canceled";
|
|
4949
|
+
return IntegrationBillingStatus2;
|
|
4950
|
+
})(IntegrationBillingStatus || {});
|
|
4339
4951
|
|
|
4340
4952
|
// src/core/entities/product.ts
|
|
4341
4953
|
function generatePublicIntegrationsData(data) {
|
|
@@ -5075,22 +5687,35 @@ export {
|
|
|
5075
5687
|
CityRepository,
|
|
5076
5688
|
CountryRepository,
|
|
5077
5689
|
CurrencyRepository,
|
|
5690
|
+
CustomerPaymentRepository,
|
|
5078
5691
|
DeliveryServiceFilter,
|
|
5079
5692
|
DeliveryStatus,
|
|
5080
5693
|
DepositRepository,
|
|
5081
5694
|
EcomanagerDeliveryIntegrationApi,
|
|
5082
5695
|
EcotrackDeliveryIntegrationApi,
|
|
5083
5696
|
EmbaddedContactType,
|
|
5697
|
+
ExpenseCategoryRepository,
|
|
5698
|
+
ExpenseRepository,
|
|
5084
5699
|
FALLBACK_AI_EXCHANGE_RATE,
|
|
5085
5700
|
FeedbackPriority,
|
|
5086
5701
|
FeedbackRepository,
|
|
5087
5702
|
FeedbackStatus,
|
|
5088
5703
|
FeeeF,
|
|
5089
5704
|
FeeefTransmitHttpClient,
|
|
5705
|
+
FinanceRepository,
|
|
5706
|
+
FinancialAccountRepository,
|
|
5090
5707
|
GoogleSheetIntegrationApi,
|
|
5091
5708
|
ImageGenerationsRepository,
|
|
5092
5709
|
ImagePromptTemplatesRepository,
|
|
5710
|
+
IntegrationBillingStatus,
|
|
5093
5711
|
IntegrationFactory,
|
|
5712
|
+
InventoryAliasRepository,
|
|
5713
|
+
InventoryBatchUpdateObjectsRequest,
|
|
5714
|
+
InventoryMovementRepository,
|
|
5715
|
+
InventoryObjectRepository,
|
|
5716
|
+
InventoryRepository,
|
|
5717
|
+
InventoryReservationRepository,
|
|
5718
|
+
InventoryWarehouseRepository,
|
|
5094
5719
|
MetaPixelEvent,
|
|
5095
5720
|
ModelRepository,
|
|
5096
5721
|
NoestDeliveryIntegrationApi,
|
|
@@ -5107,6 +5732,8 @@ export {
|
|
|
5107
5732
|
ProductType,
|
|
5108
5733
|
ProductVariantView,
|
|
5109
5734
|
PromoRepository,
|
|
5735
|
+
PurchaseOrderRepository,
|
|
5736
|
+
PurchaseReceiptRepository,
|
|
5110
5737
|
SecurityTreatment,
|
|
5111
5738
|
ShippingMethodPolicy,
|
|
5112
5739
|
ShippingMethodRepository,
|
|
@@ -5126,6 +5753,9 @@ export {
|
|
|
5126
5753
|
TemplateComponentPolicy as StoreTemplatePolicy,
|
|
5127
5754
|
StoreTemplatesRepository,
|
|
5128
5755
|
Subscription,
|
|
5756
|
+
SupplierBillRepository,
|
|
5757
|
+
SupplierPaymentRepository,
|
|
5758
|
+
SupplierRepository,
|
|
5129
5759
|
TemplateComponentPolicy,
|
|
5130
5760
|
TemplateComponentsRepository,
|
|
5131
5761
|
TiktokPixelEvent,
|
|
@@ -5137,6 +5767,11 @@ export {
|
|
|
5137
5767
|
YalidineAgent,
|
|
5138
5768
|
YalidineDeliveryIntegrationApi,
|
|
5139
5769
|
ZimouDeliveryIntegrationApi,
|
|
5770
|
+
batchDeleteBody,
|
|
5771
|
+
batchReleaseBody,
|
|
5772
|
+
batchSummaryAllFailed,
|
|
5773
|
+
batchSummaryHasFailures,
|
|
5774
|
+
batchUpdateManyBody,
|
|
5140
5775
|
convertDartColorToCssNumber,
|
|
5141
5776
|
convertOrderEntityToOrderTrackEntity,
|
|
5142
5777
|
createFeeefTransmit,
|
|
@@ -5181,6 +5816,9 @@ export {
|
|
|
5181
5816
|
normalizeImageGeneration,
|
|
5182
5817
|
normalizeImagePromptTemplate,
|
|
5183
5818
|
normalizePaginatedResponse,
|
|
5819
|
+
parseBatchResult,
|
|
5820
|
+
parseBatchRpcStatus,
|
|
5821
|
+
parseBatchSummary,
|
|
5184
5822
|
serializeAttachmentPayload,
|
|
5185
5823
|
serializeAttachmentPayloads,
|
|
5186
5824
|
serializeImagePromptTemplateCreate,
|