@epostak/sdk 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +94 -396
- package/dist/client.d.ts +30 -8
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +28 -11
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/resources/account.d.ts +25 -0
- package/dist/resources/account.d.ts.map +1 -1
- package/dist/resources/account.js +25 -0
- package/dist/resources/account.js.map +1 -1
- package/dist/resources/documents.d.ts +265 -1
- package/dist/resources/documents.d.ts.map +1 -1
- package/dist/resources/documents.js +265 -1
- package/dist/resources/documents.js.map +1 -1
- package/dist/resources/extract.d.ts +58 -0
- package/dist/resources/extract.d.ts.map +1 -1
- package/dist/resources/extract.js +64 -2
- package/dist/resources/extract.js.map +1 -1
- package/dist/resources/firms.d.ts +104 -0
- package/dist/resources/firms.d.ts.map +1 -1
- package/dist/resources/firms.js +104 -0
- package/dist/resources/firms.js.map +1 -1
- package/dist/resources/peppol.d.ts +68 -1
- package/dist/resources/peppol.d.ts.map +1 -1
- package/dist/resources/peppol.js +68 -1
- package/dist/resources/peppol.js.map +1 -1
- package/dist/resources/reporting.d.ts +28 -0
- package/dist/resources/reporting.d.ts.map +1 -1
- package/dist/resources/reporting.js +28 -0
- package/dist/resources/reporting.js.map +1 -1
- package/dist/resources/webhooks.d.ts +207 -2
- package/dist/resources/webhooks.d.ts.map +1 -1
- package/dist/resources/webhooks.js +224 -3
- package/dist/resources/webhooks.js.map +1 -1
- package/dist/types.d.ts +499 -19
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/errors.d.ts +26 -4
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +26 -4
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/request.d.ts +42 -2
- package/dist/utils/request.d.ts.map +1 -1
- package/dist/utils/request.js +105 -30
- package/dist/utils/request.js.map +1 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { DocumentsResource } from
|
|
2
|
-
import { FirmsResource } from
|
|
3
|
-
import { PeppolResource } from
|
|
4
|
-
import { WebhooksResource } from
|
|
5
|
-
import { ReportingResource } from
|
|
6
|
-
import { ExtractResource } from
|
|
7
|
-
import { AccountResource } from
|
|
1
|
+
import { DocumentsResource } from "./resources/documents.js";
|
|
2
|
+
import { FirmsResource } from "./resources/firms.js";
|
|
3
|
+
import { PeppolResource } from "./resources/peppol.js";
|
|
4
|
+
import { WebhooksResource } from "./resources/webhooks.js";
|
|
5
|
+
import { ReportingResource } from "./resources/reporting.js";
|
|
6
|
+
import { ExtractResource } from "./resources/extract.js";
|
|
7
|
+
import { AccountResource } from "./resources/account.js";
|
|
8
8
|
export interface EPostakConfig {
|
|
9
9
|
/**
|
|
10
10
|
* Your Enterprise API key. Use `sk_live_*` for direct access or
|
|
@@ -21,6 +21,13 @@ export interface EPostakConfig {
|
|
|
21
21
|
* (`sk_int_*`). Each API call will include `X-Firm-Id` header.
|
|
22
22
|
*/
|
|
23
23
|
firmId?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Maximum number of automatic retries on 429 (rate-limit) and 5xx errors.
|
|
26
|
+
* Uses exponential backoff with jitter. Defaults to 3, set 0 to disable.
|
|
27
|
+
* Only GET and DELETE are retried by default; POST/PATCH/PUT require
|
|
28
|
+
* explicit opt-in via the `retry` option on individual requests.
|
|
29
|
+
*/
|
|
30
|
+
maxRetries?: number;
|
|
24
31
|
}
|
|
25
32
|
/**
|
|
26
33
|
* ePošťák Enterprise API client.
|
|
@@ -52,9 +59,24 @@ export declare class EPostak {
|
|
|
52
59
|
constructor(config: EPostakConfig);
|
|
53
60
|
/**
|
|
54
61
|
* Create a new client instance scoped to a specific firm.
|
|
55
|
-
* Useful when an integrator key needs to switch between
|
|
62
|
+
* Useful when an integrator key (`sk_int_*`) needs to switch between
|
|
63
|
+
* client firms without creating a new `EPostak` instance from scratch.
|
|
56
64
|
*
|
|
57
65
|
* @param firmId - The firm UUID to scope subsequent requests to
|
|
66
|
+
* @returns A new `EPostak` client with the `X-Firm-Id` header set
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* const integrator = new EPostak({ apiKey: 'sk_int_xxxxx' });
|
|
71
|
+
*
|
|
72
|
+
* // Act on behalf of firm A
|
|
73
|
+
* const firmA = integrator.withFirm('firm-a-uuid');
|
|
74
|
+
* await firmA.documents.send({ ... });
|
|
75
|
+
*
|
|
76
|
+
* // Act on behalf of firm B
|
|
77
|
+
* const firmB = integrator.withFirm('firm-b-uuid');
|
|
78
|
+
* await firmB.documents.inbox.list();
|
|
79
|
+
* ```
|
|
58
80
|
*/
|
|
59
81
|
withFirm(firmId: string): EPostak;
|
|
60
82
|
}
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAKzD,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","s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|
|
2
|
-
import { FirmsResource } from
|
|
3
|
-
import { PeppolResource } from
|
|
4
|
-
import { WebhooksResource } from
|
|
5
|
-
import { ReportingResource } from
|
|
6
|
-
import { ExtractResource } from
|
|
7
|
-
import { AccountResource } from
|
|
8
|
-
const DEFAULT_BASE_URL =
|
|
1
|
+
import { DocumentsResource } from "./resources/documents.js";
|
|
2
|
+
import { FirmsResource } from "./resources/firms.js";
|
|
3
|
+
import { PeppolResource } from "./resources/peppol.js";
|
|
4
|
+
import { WebhooksResource } from "./resources/webhooks.js";
|
|
5
|
+
import { ReportingResource } from "./resources/reporting.js";
|
|
6
|
+
import { ExtractResource } from "./resources/extract.js";
|
|
7
|
+
import { AccountResource } from "./resources/account.js";
|
|
8
|
+
const DEFAULT_BASE_URL = "https://epostak.sk/api/enterprise";
|
|
9
9
|
/**
|
|
10
10
|
* ePošťák Enterprise API client.
|
|
11
11
|
*
|
|
@@ -34,13 +34,14 @@ export class EPostak {
|
|
|
34
34
|
/** Account and firm information */
|
|
35
35
|
account;
|
|
36
36
|
constructor(config) {
|
|
37
|
-
if (!config.apiKey || typeof config.apiKey !==
|
|
38
|
-
throw new Error(
|
|
37
|
+
if (!config.apiKey || typeof config.apiKey !== "string") {
|
|
38
|
+
throw new Error("EPostak: apiKey is required");
|
|
39
39
|
}
|
|
40
40
|
this.clientConfig = {
|
|
41
41
|
apiKey: config.apiKey,
|
|
42
42
|
baseUrl: config.baseUrl ?? DEFAULT_BASE_URL,
|
|
43
43
|
firmId: config.firmId,
|
|
44
|
+
maxRetries: config.maxRetries ?? 3,
|
|
44
45
|
};
|
|
45
46
|
this.documents = new DocumentsResource(this.clientConfig);
|
|
46
47
|
this.firms = new FirmsResource(this.clientConfig);
|
|
@@ -52,15 +53,31 @@ export class EPostak {
|
|
|
52
53
|
}
|
|
53
54
|
/**
|
|
54
55
|
* Create a new client instance scoped to a specific firm.
|
|
55
|
-
* Useful when an integrator key needs to switch between
|
|
56
|
+
* Useful when an integrator key (`sk_int_*`) needs to switch between
|
|
57
|
+
* client firms without creating a new `EPostak` instance from scratch.
|
|
56
58
|
*
|
|
57
59
|
* @param firmId - The firm UUID to scope subsequent requests to
|
|
60
|
+
* @returns A new `EPostak` client with the `X-Firm-Id` header set
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const integrator = new EPostak({ apiKey: 'sk_int_xxxxx' });
|
|
65
|
+
*
|
|
66
|
+
* // Act on behalf of firm A
|
|
67
|
+
* const firmA = integrator.withFirm('firm-a-uuid');
|
|
68
|
+
* await firmA.documents.send({ ... });
|
|
69
|
+
*
|
|
70
|
+
* // Act on behalf of firm B
|
|
71
|
+
* const firmB = integrator.withFirm('firm-b-uuid');
|
|
72
|
+
* await firmB.documents.inbox.list();
|
|
73
|
+
* ```
|
|
58
74
|
*/
|
|
59
75
|
withFirm(firmId) {
|
|
60
76
|
return new EPostak({
|
|
61
77
|
apiKey: this.clientConfig.apiKey,
|
|
62
78
|
baseUrl: this.clientConfig.baseUrl,
|
|
63
79
|
firmId,
|
|
80
|
+
maxRetries: this.clientConfig.maxRetries,
|
|
64
81
|
});
|
|
65
82
|
}
|
|
66
83
|
}
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,MAAM,gBAAgB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,iBAAiB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC1D,IAAI,CAAC,KAAK,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAClD,IAAI,CAAC,MAAM,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACpD,IAAI,CAAC,QAAQ,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACxD,IAAI,CAAC,SAAS,GAAG,IAAI,iBAAiB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC1D,IAAI,CAAC,OAAO,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACtD,IAAI,CAAC,OAAO,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACxD,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,QAAQ,CAAC,MAAc;QACrB,OAAO,IAAI,OAAO,CAAC;YACjB,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM;YAChC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,OAAO;YAClC,MAAM;YACN,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU;SACzC,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,5 +8,5 @@ export { WebhooksResource, WebhookQueueResource, } from "./resources/webhooks.js
|
|
|
8
8
|
export { ReportingResource } from "./resources/reporting.js";
|
|
9
9
|
export { ExtractResource } from "./resources/extract.js";
|
|
10
10
|
export { AccountResource } from "./resources/account.js";
|
|
11
|
-
export type { InvoiceResponseCode, WebhookEvent, DocumentDirection, ConvertDirection, InboxStatus, LineItem, LineItemResponse, PartyAddress, Party, SendDocumentJsonRequest, SendDocumentXmlRequest, SendDocumentRequest, SendDocumentResponse, UpdateDocumentRequest, DocumentTotals, InboxDocument, InboxListParams, InboxListResponse, InboxDocumentDetailResponse, AcknowledgeResponse, InboxAllParams, InboxAllDocument, InboxAllResponse, StatusHistoryEntry, DocumentStatusResponse, DocumentEvidenceResponse, InvoiceRespondRequest, InvoiceRespondResponse, ValidationResult, PreflightRequest, PreflightResult, ConvertRequest, ConvertResult, SmpParticipantCapability, PeppolParticipant, DirectorySearchParams, DirectoryEntry, DirectorySearchResult, CompanyLookup, FirmSummary, FirmPeppolIdentifier, FirmDetail, FirmsListResponse, FirmDocumentsParams, PeppolIdentifierResponse, AssignFirmRequest, AssignFirmResponse, BatchAssignFirmsRequest, BatchAssignFirmResult, BatchAssignFirmsResponse, CreateWebhookRequest, UpdateWebhookRequest, Webhook, WebhookDetail, WebhookDelivery, WebhookWithDeliveries, WebhookListResponse, WebhookQueueParams, WebhookQueueItem, WebhookQueueResponse, WebhookQueueAllParams, WebhookQueueAllEvent, WebhookQueueAllResponse, StatisticsParams, Statistics, Account, ExtractResult, BatchExtractItem, BatchExtractResult, } from "./types.js";
|
|
11
|
+
export type { InvoiceResponseCode, WebhookEvent, DocumentDirection, ConvertDirection, InboxStatus, LineItem, LineItemResponse, PartyAddress, Party, SendDocumentJsonRequest, SendDocumentXmlRequest, SendDocumentRequest, SendDocumentResponse, UpdateDocumentRequest, DocumentTotals, InboxDocument, InboxListParams, InboxListResponse, InboxDocumentDetailResponse, AcknowledgeResponse, InboxAllParams, InboxAllDocument, InboxAllResponse, StatusHistoryEntry, DocumentStatusResponse, DocumentEvidenceResponse, InvoiceRespondRequest, InvoiceRespondResponse, ValidationResult, PreflightRequest, PreflightResult, ConvertRequest, ConvertResult, SmpParticipantCapability, PeppolParticipant, DirectorySearchParams, DirectoryEntry, DirectorySearchResult, CompanyLookup, FirmSummary, FirmPeppolIdentifier, FirmDetail, FirmsListResponse, FirmDocumentsParams, PeppolIdentifierResponse, AssignFirmRequest, AssignFirmResponse, BatchAssignFirmsRequest, BatchAssignFirmResult, BatchAssignFirmsResponse, CreateWebhookRequest, UpdateWebhookRequest, Webhook, WebhookDetail, WebhookDelivery, WebhookWithDeliveries, WebhookListResponse, WebhookTestResponse, WebhookDeliveryDetail, WebhookDeliveriesParams, WebhookDeliveriesResponse, WebhookQueueParams, WebhookQueueItem, WebhookQueueResponse, WebhookQueueAllParams, WebhookQueueAllEvent, WebhookQueueAllResponse, StatisticsParams, Statistics, Account, ExtractResult, BatchExtractItem, BatchExtractResult, } from "./types.js";
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,EACL,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,YAAY,EAEV,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EAEX,QAAQ,EACR,gBAAgB,EAEhB,YAAY,EACZ,KAAK,EAEL,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EAEpB,qBAAqB,EAErB,cAAc,EACd,aAAa,EAEb,eAAe,EACf,iBAAiB,EACjB,2BAA2B,EAC3B,mBAAmB,EAEnB,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e,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,YAAY,EAEV,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EAEX,QAAQ,EACR,gBAAgB,EAEhB,YAAY,EACZ,KAAK,EAEL,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EAEpB,qBAAqB,EAErB,cAAc,EACd,aAAa,EAEb,eAAe,EACf,iBAAiB,EACjB,2BAA2B,EAC3B,mBAAmB,EAEnB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAEhB,kBAAkB,EAClB,sBAAsB,EACtB,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EAEtB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,aAAa,EAEb,wBAAwB,EACxB,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACd,qBAAqB,EACrB,aAAa,EAEb,WAAW,EACX,oBAAoB,EACpB,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,wBAAwB,EAExB,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EAExB,oBAAoB,EACpB,oBAAoB,EACpB,OAAO,EACP,aAAa,EACb,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EAEnB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,EACvB,yBAAyB,EAEzB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EAEpB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EAEvB,gBAAgB,EAChB,UAAU,EAEV,OAAO,EAEP,aAAa,EACb,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,YAAY,CAAC"}
|
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
import { BaseResource } from "../utils/request.js";
|
|
2
2
|
import type { Account } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Resource for retrieving account information — firm details, subscription plan,
|
|
5
|
+
* and document usage for the current billing period.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const account = await client.account.get();
|
|
10
|
+
* console.log(`Plan: ${account.plan.name} (${account.plan.status})`);
|
|
11
|
+
* console.log(`Usage: ${account.usage.outbound} sent, ${account.usage.inbound} received`);
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
3
14
|
export declare class AccountResource extends BaseResource {
|
|
15
|
+
/**
|
|
16
|
+
* Get account information for the authenticated API key.
|
|
17
|
+
* Returns the associated firm, current subscription plan, and usage counters.
|
|
18
|
+
*
|
|
19
|
+
* @returns Account details including firm, plan, and usage
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const account = await client.account.get();
|
|
24
|
+
* if (account.plan.status === 'expired') {
|
|
25
|
+
* console.warn('Subscription expired — renew to continue sending documents');
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
4
29
|
get(): Promise<Account>;
|
|
5
30
|
}
|
|
6
31
|
//# sourceMappingURL=account.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/resources/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;CAGxB"}
|
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/resources/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;;;;;;;GAUG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IAC/C;;;;;;;;;;;;;OAaG;IACH,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;CAGxB"}
|
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
import { BaseResource } from "../utils/request.js";
|
|
2
|
+
/**
|
|
3
|
+
* Resource for retrieving account information — firm details, subscription plan,
|
|
4
|
+
* and document usage for the current billing period.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* const account = await client.account.get();
|
|
9
|
+
* console.log(`Plan: ${account.plan.name} (${account.plan.status})`);
|
|
10
|
+
* console.log(`Usage: ${account.usage.outbound} sent, ${account.usage.inbound} received`);
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
2
13
|
export class AccountResource extends BaseResource {
|
|
14
|
+
/**
|
|
15
|
+
* Get account information for the authenticated API key.
|
|
16
|
+
* Returns the associated firm, current subscription plan, and usage counters.
|
|
17
|
+
*
|
|
18
|
+
* @returns Account details including firm, plan, and usage
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const account = await client.account.get();
|
|
23
|
+
* if (account.plan.status === 'expired') {
|
|
24
|
+
* console.warn('Subscription expired — renew to continue sending documents');
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
3
28
|
get() {
|
|
4
29
|
return this.request("GET", "/account");
|
|
5
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/resources/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGnD,MAAM,OAAO,eAAgB,SAAQ,YAAY;IAC/C,GAAG;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IACzC,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/resources/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGnD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,eAAgB,SAAQ,YAAY;IAC/C;;;;;;;;;;;;;OAaG;IACH,GAAG;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IACzC,CAAC;CACF"}
|
|
@@ -1,26 +1,290 @@
|
|
|
1
1
|
import { BaseResource } from "../utils/request.js";
|
|
2
2
|
import type { ClientConfig } from "../utils/request.js";
|
|
3
3
|
import type { SendDocumentRequest, SendDocumentResponse, UpdateDocumentRequest, InboxDocument, InboxListParams, InboxListResponse, InboxDocumentDetailResponse, AcknowledgeResponse, InboxAllParams, InboxAllResponse, DocumentStatusResponse, DocumentEvidenceResponse, InvoiceRespondRequest, InvoiceRespondResponse, ValidationResult, PreflightRequest, PreflightResult, ConvertRequest, ConvertResult } from "../types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Resource for managing received (inbound) documents in your inbox.
|
|
6
|
+
* Provides methods to list, retrieve, and acknowledge incoming invoices.
|
|
7
|
+
*/
|
|
4
8
|
export declare class InboxResource extends BaseResource {
|
|
9
|
+
/**
|
|
10
|
+
* List documents in your inbox with optional filtering and pagination.
|
|
11
|
+
*
|
|
12
|
+
* @param params - Optional query parameters for filtering and pagination
|
|
13
|
+
* @returns Paginated list of inbox documents
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* // Get unprocessed documents
|
|
18
|
+
* const { documents, total } = await client.documents.inbox.list({
|
|
19
|
+
* status: 'RECEIVED',
|
|
20
|
+
* limit: 50,
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
5
24
|
list(params?: InboxListParams): Promise<InboxListResponse>;
|
|
25
|
+
/**
|
|
26
|
+
* Retrieve a single inbox document by ID, including the raw UBL XML payload.
|
|
27
|
+
*
|
|
28
|
+
* @param id - Document UUID
|
|
29
|
+
* @returns Document details with the UBL XML payload
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const { document, payload } = await client.documents.inbox.get('doc-uuid');
|
|
34
|
+
* console.log(payload); // UBL XML string
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
6
37
|
get(id: string): Promise<InboxDocumentDetailResponse>;
|
|
38
|
+
/**
|
|
39
|
+
* Acknowledge (mark as processed) a received inbox document.
|
|
40
|
+
* Once acknowledged, the document moves from `RECEIVED` to `ACKNOWLEDGED` status.
|
|
41
|
+
*
|
|
42
|
+
* @param id - Document UUID to acknowledge
|
|
43
|
+
* @returns Acknowledgment confirmation with timestamp
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* const ack = await client.documents.inbox.acknowledge('doc-uuid');
|
|
48
|
+
* console.log(ack.acknowledgedAt); // "2026-04-11T12:00:00Z"
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
7
51
|
acknowledge(id: string): Promise<AcknowledgeResponse>;
|
|
52
|
+
/**
|
|
53
|
+
* List documents across all managed firms (integrator endpoint).
|
|
54
|
+
* Only available with integrator API keys (`sk_int_*`).
|
|
55
|
+
*
|
|
56
|
+
* @param params - Optional query parameters including firm_id filter
|
|
57
|
+
* @returns Paginated list of documents across all firms
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* // Poll for new documents across all clients
|
|
62
|
+
* const { documents } = await client.documents.inbox.listAll({
|
|
63
|
+
* since: '2026-04-01T00:00:00Z',
|
|
64
|
+
* status: 'RECEIVED',
|
|
65
|
+
* });
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
8
68
|
listAll(params?: InboxAllParams): Promise<InboxAllResponse>;
|
|
9
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Resource for sending, receiving, and managing Peppol e-invoicing documents.
|
|
72
|
+
* This is the primary resource for document operations — sending invoices,
|
|
73
|
+
* checking delivery status, downloading PDFs, and responding to received invoices.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* const client = new EPostak({ apiKey: 'sk_live_xxxxx' });
|
|
78
|
+
*
|
|
79
|
+
* // Send an invoice
|
|
80
|
+
* const result = await client.documents.send({
|
|
81
|
+
* receiverPeppolId: '0245:1234567890',
|
|
82
|
+
* items: [{ description: 'Consulting', quantity: 10, unitPrice: 100, vatRate: 23 }],
|
|
83
|
+
* });
|
|
84
|
+
*
|
|
85
|
+
* // Check delivery status
|
|
86
|
+
* const status = await client.documents.status(result.documentId);
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
10
89
|
export declare class DocumentsResource extends BaseResource {
|
|
11
|
-
/**
|
|
90
|
+
/** Sub-resource for managing received (inbound) documents */
|
|
12
91
|
inbox: InboxResource;
|
|
13
92
|
constructor(config: ClientConfig);
|
|
93
|
+
/**
|
|
94
|
+
* Retrieve a single document by ID.
|
|
95
|
+
*
|
|
96
|
+
* @param id - Document UUID
|
|
97
|
+
* @returns Full document object including parties, lines, and totals
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```typescript
|
|
101
|
+
* const doc = await client.documents.get('doc-uuid');
|
|
102
|
+
* console.log(doc.totals.withVat); // 1230.00
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
14
105
|
get(id: string): Promise<InboxDocument>;
|
|
106
|
+
/**
|
|
107
|
+
* Update a draft document. Only documents that have not been sent yet can be updated.
|
|
108
|
+
* Pass `null` to clear optional fields, or omit them to leave unchanged.
|
|
109
|
+
*
|
|
110
|
+
* @param id - Document UUID of the draft to update
|
|
111
|
+
* @param body - Fields to update
|
|
112
|
+
* @returns The updated document
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* const updated = await client.documents.update('doc-uuid', {
|
|
117
|
+
* dueDate: '2026-05-15',
|
|
118
|
+
* note: 'Updated payment terms',
|
|
119
|
+
* });
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
15
122
|
update(id: string, body: UpdateDocumentRequest): Promise<InboxDocument>;
|
|
123
|
+
/**
|
|
124
|
+
* Send an invoice via the Peppol network. Accepts either structured JSON
|
|
125
|
+
* (the API generates UBL XML) or pre-built UBL XML.
|
|
126
|
+
*
|
|
127
|
+
* @param body - Invoice data as JSON fields or raw UBL XML
|
|
128
|
+
* @returns Document ID, Peppol message ID, and status confirmation
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```typescript
|
|
132
|
+
* // Send using JSON (API generates UBL)
|
|
133
|
+
* const result = await client.documents.send({
|
|
134
|
+
* receiverPeppolId: '0245:1234567890',
|
|
135
|
+
* invoiceNumber: 'FV-2026-042',
|
|
136
|
+
* items: [
|
|
137
|
+
* { description: 'Web development', quantity: 40, unit: 'HUR', unitPrice: 80, vatRate: 23 },
|
|
138
|
+
* ],
|
|
139
|
+
* });
|
|
140
|
+
*
|
|
141
|
+
* // Send using raw UBL XML
|
|
142
|
+
* const result = await client.documents.send({
|
|
143
|
+
* receiverPeppolId: '0245:1234567890',
|
|
144
|
+
* xml: '<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2">...</Invoice>',
|
|
145
|
+
* });
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
16
148
|
send(body: SendDocumentRequest): Promise<SendDocumentResponse>;
|
|
149
|
+
/**
|
|
150
|
+
* Get the current delivery status and full status history of a document.
|
|
151
|
+
* Use this to track whether a sent invoice was delivered, acknowledged, or failed.
|
|
152
|
+
*
|
|
153
|
+
* @param id - Document UUID
|
|
154
|
+
* @returns Status details including history timeline and delivery timestamps
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```typescript
|
|
158
|
+
* const status = await client.documents.status('doc-uuid');
|
|
159
|
+
* console.log(status.status); // "DELIVERED"
|
|
160
|
+
* console.log(status.deliveredAt); // "2026-04-11T12:30:00Z"
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
17
163
|
status(id: string): Promise<DocumentStatusResponse>;
|
|
164
|
+
/**
|
|
165
|
+
* Retrieve delivery evidence for a sent document, including AS4 receipts,
|
|
166
|
+
* Message Level Response (MLR), and Invoice Response from the buyer.
|
|
167
|
+
*
|
|
168
|
+
* @param id - Document UUID
|
|
169
|
+
* @returns Evidence records (AS4 receipt, MLR, Invoice Response)
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```typescript
|
|
173
|
+
* const evidence = await client.documents.evidence('doc-uuid');
|
|
174
|
+
* if (evidence.invoiceResponse?.status === 'AP') {
|
|
175
|
+
* console.log('Invoice was accepted by the buyer');
|
|
176
|
+
* }
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
18
179
|
evidence(id: string): Promise<DocumentEvidenceResponse>;
|
|
180
|
+
/**
|
|
181
|
+
* Download the PDF visualization of a document.
|
|
182
|
+
*
|
|
183
|
+
* @param id - Document UUID
|
|
184
|
+
* @returns PDF file content as a Buffer
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```typescript
|
|
188
|
+
* import { writeFileSync } from 'fs';
|
|
189
|
+
*
|
|
190
|
+
* const pdfBuffer = await client.documents.pdf('doc-uuid');
|
|
191
|
+
* writeFileSync('invoice.pdf', pdfBuffer);
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
19
194
|
pdf(id: string): Promise<Buffer>;
|
|
195
|
+
/**
|
|
196
|
+
* Download the UBL XML of a document.
|
|
197
|
+
*
|
|
198
|
+
* @param id - Document UUID
|
|
199
|
+
* @returns UBL 2.1 XML content as a string
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* const xml = await client.documents.ubl('doc-uuid');
|
|
204
|
+
* console.log(xml); // "<?xml version="1.0"?><Invoice ...>...</Invoice>"
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
20
207
|
ubl(id: string): Promise<string>;
|
|
208
|
+
/**
|
|
209
|
+
* Send an Invoice Response (accept, reject, or query) for a received document.
|
|
210
|
+
* This sends a Peppol Invoice Response message back to the supplier.
|
|
211
|
+
*
|
|
212
|
+
* @param id - Document UUID of the received invoice
|
|
213
|
+
* @param body - Response status and optional note
|
|
214
|
+
* @returns Confirmation with the response status and timestamp
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```typescript
|
|
218
|
+
* // Accept an invoice
|
|
219
|
+
* await client.documents.respond('doc-uuid', { status: 'AP' });
|
|
220
|
+
*
|
|
221
|
+
* // Reject with a reason
|
|
222
|
+
* await client.documents.respond('doc-uuid', {
|
|
223
|
+
* status: 'RE',
|
|
224
|
+
* note: 'Incorrect VAT rate applied',
|
|
225
|
+
* });
|
|
226
|
+
* ```
|
|
227
|
+
*/
|
|
21
228
|
respond(id: string, body: InvoiceRespondRequest): Promise<InvoiceRespondResponse>;
|
|
229
|
+
/**
|
|
230
|
+
* Validate a document without sending it. Checks Peppol BIS 3.0 compliance
|
|
231
|
+
* and returns warnings. For JSON input, also returns the generated UBL XML preview.
|
|
232
|
+
*
|
|
233
|
+
* @param body - Document data to validate (same format as `send()`)
|
|
234
|
+
* @returns Validation result with warnings and optional UBL preview
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* ```typescript
|
|
238
|
+
* const result = await client.documents.validate({
|
|
239
|
+
* receiverPeppolId: '0245:1234567890',
|
|
240
|
+
* items: [{ description: 'Test', quantity: 1, unitPrice: 100, vatRate: 23 }],
|
|
241
|
+
* });
|
|
242
|
+
* if (!result.valid) {
|
|
243
|
+
* console.error('Validation failed:', result.warnings);
|
|
244
|
+
* }
|
|
245
|
+
* ```
|
|
246
|
+
*/
|
|
22
247
|
validate(body: SendDocumentRequest): Promise<ValidationResult>;
|
|
248
|
+
/**
|
|
249
|
+
* Check if a Peppol receiver is registered and supports the target document type
|
|
250
|
+
* before sending. Use this to avoid sending to non-existent participants.
|
|
251
|
+
*
|
|
252
|
+
* @param body - Receiver Peppol ID and optional document type to check
|
|
253
|
+
* @returns Preflight result with registration and capability info
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* ```typescript
|
|
257
|
+
* const check = await client.documents.preflight({
|
|
258
|
+
* receiverPeppolId: '0245:1234567890',
|
|
259
|
+
* });
|
|
260
|
+
* if (!check.registered) {
|
|
261
|
+
* console.error('Receiver is not on the Peppol network');
|
|
262
|
+
* }
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
23
265
|
preflight(body: PreflightRequest): Promise<PreflightResult>;
|
|
266
|
+
/**
|
|
267
|
+
* Convert between JSON and UBL XML formats without sending.
|
|
268
|
+
* Useful for previewing the UBL output or parsing received XML into structured data.
|
|
269
|
+
*
|
|
270
|
+
* @param body - Conversion request with direction and input data
|
|
271
|
+
* @returns Converted output (UBL XML string or parsed JSON object)
|
|
272
|
+
*
|
|
273
|
+
* @example
|
|
274
|
+
* ```typescript
|
|
275
|
+
* // JSON to UBL
|
|
276
|
+
* const { result: ublXml } = await client.documents.convert({
|
|
277
|
+
* direction: 'json_to_ubl',
|
|
278
|
+
* data: { invoiceNumber: 'FV-001', items: [...] },
|
|
279
|
+
* });
|
|
280
|
+
*
|
|
281
|
+
* // UBL to JSON
|
|
282
|
+
* const { result: parsed } = await client.documents.convert({
|
|
283
|
+
* direction: 'ubl_to_json',
|
|
284
|
+
* xml: '<Invoice>...</Invoice>',
|
|
285
|
+
* });
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
24
288
|
convert(body: ConvertRequest): Promise<ConvertResult>;
|
|
25
289
|
}
|
|
26
290
|
//# sourceMappingURL=documents.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../src/resources/documents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAc,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,2BAA2B,EAC3B,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,aAAa,EACd,MAAM,aAAa,CAAC;AAErB,qBAAa,aAAc,SAAQ,YAAY;IAC7C,IAAI,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../src/resources/documents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAc,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,2BAA2B,EAC3B,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,aAAa,EACd,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,qBAAa,aAAc,SAAQ,YAAY;IAC7C;;;;;;;;;;;;;;OAcG;IACH,IAAI,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAY1D;;;;;;;;;;;OAWG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAIrD;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAOrD;;;;;;;;;;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