@getpeppr/cli 0.4.6 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +15 -13
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1016,7 +1016,7 @@ function validateInvoice(input) {
|
|
|
1016
1016
|
}
|
|
1017
1017
|
if (input.roundingAmount !== void 0 && input.roundingAmount !== null) {
|
|
1018
1018
|
if (input.roundingAmount < -0.99 || input.roundingAmount > 0.99) {
|
|
1019
|
-
errors.push(error("roundingAmount", `Rounding amount must be between -0.99 and 0.99, got ${input.roundingAmount}`, void 0, "
|
|
1019
|
+
errors.push(error("roundingAmount", `Rounding amount must be between -0.99 and 0.99, got ${input.roundingAmount}`, void 0, "Rounding is stored as integer cents (\xB199). Use values like 0.50 or -0.25."));
|
|
1020
1020
|
}
|
|
1021
1021
|
}
|
|
1022
1022
|
if (!input.buyerReference && !input.orderReference) {
|
|
@@ -1059,7 +1059,7 @@ function validateInvoice(input) {
|
|
|
1059
1059
|
}
|
|
1060
1060
|
|
|
1061
1061
|
// ../sdk/dist/version.js
|
|
1062
|
-
var SDK_VERSION = "
|
|
1062
|
+
var SDK_VERSION = "2.0.0";
|
|
1063
1063
|
|
|
1064
1064
|
// ../sdk/dist/core/client.js
|
|
1065
1065
|
function findHeaderCaseInsensitive(headers, name) {
|
|
@@ -1403,22 +1403,24 @@ var GetpepprAdapter = class {
|
|
|
1403
1403
|
params.set("dateTo", options.dateTo);
|
|
1404
1404
|
const query = params.toString() ? `?${params.toString()}` : "";
|
|
1405
1405
|
const result = await this.request("GET", `/events${query}`);
|
|
1406
|
-
const events = result.
|
|
1406
|
+
const events = result.data ?? [];
|
|
1407
1407
|
const meta = result.meta;
|
|
1408
1408
|
return {
|
|
1409
1409
|
data: events.map((evt) => ({
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
contact: evt.contact
|
|
1410
|
+
id: String(evt.id ?? ""),
|
|
1411
|
+
eventType: String(evt.eventType ?? evt.event_type ?? ""),
|
|
1412
|
+
documentId: evt.documentId ?? evt.document_id ?? null,
|
|
1413
|
+
metadata: evt.metadata ?? null,
|
|
1414
|
+
createdAt: String(evt.createdAt ?? evt.created_at ?? "")
|
|
1416
1415
|
})),
|
|
1417
1416
|
meta: {
|
|
1418
1417
|
totalCount: Number(meta?.total_count ?? meta?.totalCount ?? events.length),
|
|
1419
1418
|
offset: Number(meta?.offset ?? options?.offset ?? 0),
|
|
1420
1419
|
limit: Number(meta?.limit ?? options?.limit ?? 25),
|
|
1421
|
-
|
|
1420
|
+
// Prefer the gateway's authoritative has_more; fall back to computing it
|
|
1421
|
+
// from total_count/offset/limit so listAll() paginates correctly even if
|
|
1422
|
+
// a response omits the flag.
|
|
1423
|
+
hasMore: meta?.has_more != null || meta?.hasMore != null ? Boolean(meta.has_more ?? meta.hasMore) : Number(meta?.total_count ?? meta?.totalCount ?? 0) > Number(meta?.offset ?? options?.offset ?? 0) + Number(meta?.limit ?? options?.limit ?? 0),
|
|
1422
1424
|
truncated: Boolean(meta?.truncated ?? false)
|
|
1423
1425
|
}
|
|
1424
1426
|
};
|
|
@@ -1912,7 +1914,7 @@ var InvoiceOperations = class {
|
|
|
1912
1914
|
}
|
|
1913
1915
|
/**
|
|
1914
1916
|
* Create a draft invoice without sending it.
|
|
1915
|
-
* Validates input client-side, then creates the invoice
|
|
1917
|
+
* Validates input client-side, then creates the invoice via the gateway.
|
|
1916
1918
|
* Use `sendById()` to send the draft when ready.
|
|
1917
1919
|
*
|
|
1918
1920
|
* @example
|
|
@@ -2031,7 +2033,7 @@ ${validation.errors.map((e) => ` - ${e.field}: ${e.message}${e.suggestion ? ` (
|
|
|
2031
2033
|
/**
|
|
2032
2034
|
* Import an invoice from a file (XML, PDF, JSON).
|
|
2033
2035
|
* The file is base64-encoded and sent to the gateway, which forwards it
|
|
2034
|
-
* as multipart/form-data to
|
|
2036
|
+
* as multipart/form-data to the provider's import endpoint.
|
|
2035
2037
|
*
|
|
2036
2038
|
* @example
|
|
2037
2039
|
* ```ts
|
|
@@ -2093,7 +2095,7 @@ ${validation.errors.map((e) => ` - ${e.field}: ${e.message}${e.suggestion ? ` (
|
|
|
2093
2095
|
}
|
|
2094
2096
|
/**
|
|
2095
2097
|
* Transition an invoice to a new state.
|
|
2096
|
-
*
|
|
2098
|
+
* The gateway validates the state machine — invalid transitions return an error.
|
|
2097
2099
|
*
|
|
2098
2100
|
* @example
|
|
2099
2101
|
* ```ts
|