pingen2-sdk-js 0.1.2
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/LICENSE +28 -0
- package/README.md +415 -0
- package/dist/client.d.ts +30 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +72 -0
- package/dist/client.js.map +1 -0
- package/dist/common/enums/address-position.d.ts +5 -0
- package/dist/common/enums/address-position.d.ts.map +1 -0
- package/dist/common/enums/address-position.js +9 -0
- package/dist/common/enums/address-position.js.map +1 -0
- package/dist/common/enums/delivery-product.d.ts +8 -0
- package/dist/common/enums/delivery-product.d.ts.map +1 -0
- package/dist/common/enums/delivery-product.js +12 -0
- package/dist/common/enums/delivery-product.js.map +1 -0
- package/dist/common/enums/index.d.ts +6 -0
- package/dist/common/enums/index.d.ts.map +1 -0
- package/dist/common/enums/index.js +14 -0
- package/dist/common/enums/index.js.map +1 -0
- package/dist/common/enums/paper-type.d.ts +7 -0
- package/dist/common/enums/paper-type.d.ts.map +1 -0
- package/dist/common/enums/paper-type.js +11 -0
- package/dist/common/enums/paper-type.js.map +1 -0
- package/dist/common/enums/print-mode.d.ts +5 -0
- package/dist/common/enums/print-mode.d.ts.map +1 -0
- package/dist/common/enums/print-mode.js +9 -0
- package/dist/common/enums/print-mode.js.map +1 -0
- package/dist/common/enums/print-spectrum.d.ts +5 -0
- package/dist/common/enums/print-spectrum.d.ts.map +1 -0
- package/dist/common/enums/print-spectrum.js +9 -0
- package/dist/common/enums/print-spectrum.js.map +1 -0
- package/dist/common/index.d.ts +8 -0
- package/dist/common/index.d.ts.map +1 -0
- package/dist/common/index.js +24 -0
- package/dist/common/index.js.map +1 -0
- package/dist/common/json-api.d.ts +37 -0
- package/dist/common/json-api.d.ts.map +1 -0
- package/dist/common/json-api.js +3 -0
- package/dist/common/json-api.js.map +1 -0
- package/dist/common/preset.d.ts +13 -0
- package/dist/common/preset.d.ts.map +1 -0
- package/dist/common/preset.js +20 -0
- package/dist/common/preset.js.map +1 -0
- package/dist/common/relationships.d.ts +20 -0
- package/dist/common/relationships.d.ts.map +1 -0
- package/dist/common/relationships.js +3 -0
- package/dist/common/relationships.js.map +1 -0
- package/dist/common/response.d.ts +12 -0
- package/dist/common/response.d.ts.map +1 -0
- package/dist/common/response.js +77 -0
- package/dist/common/response.js.map +1 -0
- package/dist/common/typed-response.d.ts +29 -0
- package/dist/common/typed-response.d.ts.map +1 -0
- package/dist/common/typed-response.js +3 -0
- package/dist/common/typed-response.js.map +1 -0
- package/dist/common/webhook-event.d.ts +34 -0
- package/dist/common/webhook-event.d.ts.map +1 -0
- package/dist/common/webhook-event.js +3 -0
- package/dist/common/webhook-event.js.map +1 -0
- package/dist/constants.d.ts +10 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +16 -0
- package/dist/constants.js.map +1 -0
- package/dist/errors.d.ts +50 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +115 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +61 -0
- package/dist/index.js.map +1 -0
- package/dist/oauth.d.ts +17 -0
- package/dist/oauth.d.ts.map +1 -0
- package/dist/oauth.js +68 -0
- package/dist/oauth.js.map +1 -0
- package/dist/requestor.d.ts +28 -0
- package/dist/requestor.d.ts.map +1 -0
- package/dist/requestor.js +163 -0
- package/dist/requestor.js.map +1 -0
- package/dist/resources/base.d.ts +19 -0
- package/dist/resources/base.d.ts.map +1 -0
- package/dist/resources/base.js +40 -0
- package/dist/resources/base.js.map +1 -0
- package/dist/resources/batches/batches.d.ts +15 -0
- package/dist/resources/batches/batches.d.ts.map +1 -0
- package/dist/resources/batches/batches.js +68 -0
- package/dist/resources/batches/batches.js.map +1 -0
- package/dist/resources/batches/enums.d.ts +39 -0
- package/dist/resources/batches/enums.d.ts.map +1 -0
- package/dist/resources/batches/enums.js +44 -0
- package/dist/resources/batches/enums.js.map +1 -0
- package/dist/resources/batches/response.d.ts +27 -0
- package/dist/resources/batches/response.d.ts.map +1 -0
- package/dist/resources/batches/response.js +3 -0
- package/dist/resources/batches/response.js.map +1 -0
- package/dist/resources/batches/types.d.ts +41 -0
- package/dist/resources/batches/types.d.ts.map +1 -0
- package/dist/resources/batches/types.js +3 -0
- package/dist/resources/batches/types.js.map +1 -0
- package/dist/resources/ebills/ebills.d.ts +13 -0
- package/dist/resources/ebills/ebills.d.ts.map +1 -0
- package/dist/resources/ebills/ebills.js +38 -0
- package/dist/resources/ebills/ebills.js.map +1 -0
- package/dist/resources/ebills/response.d.ts +27 -0
- package/dist/resources/ebills/response.d.ts.map +1 -0
- package/dist/resources/ebills/response.js +3 -0
- package/dist/resources/ebills/response.js.map +1 -0
- package/dist/resources/ebills/types.d.ts +23 -0
- package/dist/resources/ebills/types.d.ts.map +1 -0
- package/dist/resources/ebills/types.js +3 -0
- package/dist/resources/ebills/types.js.map +1 -0
- package/dist/resources/emails/emails.d.ts +13 -0
- package/dist/resources/emails/emails.d.ts.map +1 -0
- package/dist/resources/emails/emails.js +38 -0
- package/dist/resources/emails/emails.js.map +1 -0
- package/dist/resources/emails/response.d.ts +24 -0
- package/dist/resources/emails/response.d.ts.map +1 -0
- package/dist/resources/emails/response.js +3 -0
- package/dist/resources/emails/response.js.map +1 -0
- package/dist/resources/emails/types.d.ts +26 -0
- package/dist/resources/emails/types.d.ts.map +1 -0
- package/dist/resources/emails/types.js +3 -0
- package/dist/resources/emails/types.js.map +1 -0
- package/dist/resources/events/batch-events.d.ts +6 -0
- package/dist/resources/events/batch-events.d.ts.map +1 -0
- package/dist/resources/events/batch-events.js +11 -0
- package/dist/resources/events/batch-events.js.map +1 -0
- package/dist/resources/events/ebill-events.d.ts +6 -0
- package/dist/resources/events/ebill-events.d.ts.map +1 -0
- package/dist/resources/events/ebill-events.js +11 -0
- package/dist/resources/events/ebill-events.js.map +1 -0
- package/dist/resources/events/email-events.d.ts +6 -0
- package/dist/resources/events/email-events.d.ts.map +1 -0
- package/dist/resources/events/email-events.js +11 -0
- package/dist/resources/events/email-events.js.map +1 -0
- package/dist/resources/events/letter-events.d.ts +11 -0
- package/dist/resources/events/letter-events.d.ts.map +1 -0
- package/dist/resources/events/letter-events.js +26 -0
- package/dist/resources/events/letter-events.js.map +1 -0
- package/dist/resources/events/response.d.ts +20 -0
- package/dist/resources/events/response.d.ts.map +1 -0
- package/dist/resources/events/response.js +3 -0
- package/dist/resources/events/response.js.map +1 -0
- package/dist/resources/file-upload.d.ts +17 -0
- package/dist/resources/file-upload.d.ts.map +1 -0
- package/dist/resources/file-upload.js +24 -0
- package/dist/resources/file-upload.js.map +1 -0
- package/dist/resources/index.d.ts +30 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +58 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/resources/letters/letters.d.ts +18 -0
- package/dist/resources/letters/letters.d.ts.map +1 -0
- package/dist/resources/letters/letters.js +88 -0
- package/dist/resources/letters/letters.js.map +1 -0
- package/dist/resources/letters/response.d.ts +35 -0
- package/dist/resources/letters/response.d.ts.map +1 -0
- package/dist/resources/letters/response.js +3 -0
- package/dist/resources/letters/response.js.map +1 -0
- package/dist/resources/letters/types.d.ts +61 -0
- package/dist/resources/letters/types.d.ts.map +1 -0
- package/dist/resources/letters/types.js +3 -0
- package/dist/resources/letters/types.js.map +1 -0
- package/dist/resources/organisations/organisations.d.ts +7 -0
- package/dist/resources/organisations/organisations.d.ts.map +1 -0
- package/dist/resources/organisations/organisations.js +14 -0
- package/dist/resources/organisations/organisations.js.map +1 -0
- package/dist/resources/organisations/response.d.ts +24 -0
- package/dist/resources/organisations/response.d.ts.map +1 -0
- package/dist/resources/organisations/response.js +3 -0
- package/dist/resources/organisations/response.js.map +1 -0
- package/dist/resources/users/response.d.ts +21 -0
- package/dist/resources/users/response.d.ts.map +1 -0
- package/dist/resources/users/response.js +3 -0
- package/dist/resources/users/response.js.map +1 -0
- package/dist/resources/users/user-associations.d.ts +6 -0
- package/dist/resources/users/user-associations.d.ts.map +1 -0
- package/dist/resources/users/user-associations.js +11 -0
- package/dist/resources/users/user-associations.js.map +1 -0
- package/dist/resources/users/users.d.ts +6 -0
- package/dist/resources/users/users.d.ts.map +1 -0
- package/dist/resources/users/users.js +11 -0
- package/dist/resources/users/users.js.map +1 -0
- package/dist/resources/webhooks/enums.d.ts +8 -0
- package/dist/resources/webhooks/enums.d.ts.map +1 -0
- package/dist/resources/webhooks/enums.js +12 -0
- package/dist/resources/webhooks/enums.js.map +1 -0
- package/dist/resources/webhooks/response.d.ts +8 -0
- package/dist/resources/webhooks/response.d.ts.map +1 -0
- package/dist/resources/webhooks/response.js +3 -0
- package/dist/resources/webhooks/response.js.map +1 -0
- package/dist/resources/webhooks/types.d.ts +7 -0
- package/dist/resources/webhooks/types.d.ts.map +1 -0
- package/dist/resources/webhooks/types.js +3 -0
- package/dist/resources/webhooks/types.js.map +1 -0
- package/dist/resources/webhooks/webhooks.d.ts +10 -0
- package/dist/resources/webhooks/webhooks.d.ts.map +1 -0
- package/dist/resources/webhooks/webhooks.js +24 -0
- package/dist/resources/webhooks/webhooks.js.map +1 -0
- package/dist/utils/headers.d.ts +2 -0
- package/dist/utils/headers.d.ts.map +1 -0
- package/dist/utils/headers.js +13 -0
- package/dist/utils/headers.js.map +1 -0
- package/dist/utils/idempotency.d.ts +2 -0
- package/dist/utils/idempotency.d.ts.map +1 -0
- package/dist/utils/idempotency.js +8 -0
- package/dist/utils/idempotency.js.map +1 -0
- package/dist/utils/object.d.ts +2 -0
- package/dist/utils/object.d.ts.map +1 -0
- package/dist/utils/object.js +17 -0
- package/dist/utils/object.js.map +1 -0
- package/dist/utils/payload.d.ts +8 -0
- package/dist/utils/payload.d.ts.map +1 -0
- package/dist/utils/payload.js +20 -0
- package/dist/utils/payload.js.map +1 -0
- package/dist/utils/retry.d.ts +6 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +45 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/webhook.d.ts +7 -0
- package/dist/webhook.d.ts.map +1 -0
- package/dist/webhook.js +25 -0
- package/dist/webhook.js.map +1 -0
- package/package.json +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, pingencom
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
ADDED
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
# pingen2-sdk-js
|
|
2
|
+
|
|
3
|
+
A lightweight, fully typed Node.js SDK for the [Pingen REST API](https://api.pingen.com).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Table of contents
|
|
8
|
+
|
|
9
|
+
- [Requirements](#requirements)
|
|
10
|
+
- [Installation](#installation)
|
|
11
|
+
- [Quick start](#quick-start)
|
|
12
|
+
- [Authentication](#authentication)
|
|
13
|
+
- [Resources](#resources)
|
|
14
|
+
- [Organisations](#organisations)
|
|
15
|
+
- [Letters](#letters)
|
|
16
|
+
- [Batches](#batches)
|
|
17
|
+
- [Events](#events)
|
|
18
|
+
- [Webhooks](#webhooks)
|
|
19
|
+
- [Ebills & Emails](#ebills--emails)
|
|
20
|
+
- [Typed responses](#typed-responses)
|
|
21
|
+
- [Error handling](#error-handling)
|
|
22
|
+
- [Configuration](#configuration)
|
|
23
|
+
- [Scripts](#scripts)
|
|
24
|
+
- [Development](#development)
|
|
25
|
+
- [Versioning](#versioning)
|
|
26
|
+
- [License](#license)
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Requirements
|
|
31
|
+
|
|
32
|
+
- Node.js 18+
|
|
33
|
+
- TypeScript 5+ (optional — full typings included)
|
|
34
|
+
- A Pingen account with OAuth credentials ([how to obtain](https://api.pingen.com/documentation#section/Authentication/How-to-obtain-a-Client-ID))
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
npm install pingen2-sdk-js
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Quick start
|
|
47
|
+
|
|
48
|
+
Upload a PDF and send it as a physical letter in one call:
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
import {
|
|
52
|
+
PingenClient,
|
|
53
|
+
AddressPosition,
|
|
54
|
+
DeliveryProduct,
|
|
55
|
+
PrintMode,
|
|
56
|
+
PrintSpectrum,
|
|
57
|
+
type LetterAttributes,
|
|
58
|
+
} from 'pingen2-sdk-js';
|
|
59
|
+
|
|
60
|
+
const { PINGEN_CLIENT_ID, PINGEN_CLIENT_SECRET, PINGEN_ORG_ID } = process.env;
|
|
61
|
+
if (!PINGEN_CLIENT_ID || !PINGEN_CLIENT_SECRET || !PINGEN_ORG_ID) {
|
|
62
|
+
throw new Error('Missing PINGEN_CLIENT_ID / PINGEN_CLIENT_SECRET / PINGEN_ORG_ID');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const client = new PingenClient(PINGEN_CLIENT_ID, PINGEN_CLIENT_SECRET);
|
|
66
|
+
|
|
67
|
+
const res = await client.letters(PINGEN_ORG_ID).uploadAndCreate({
|
|
68
|
+
filePath: './invoice.pdf',
|
|
69
|
+
fileOriginalName: 'invoice.pdf',
|
|
70
|
+
addressPosition: AddressPosition.Left,
|
|
71
|
+
autoSend: true,
|
|
72
|
+
deliveryProduct: DeliveryProduct.Fast,
|
|
73
|
+
printMode: PrintMode.Simplex,
|
|
74
|
+
printSpectrum: PrintSpectrum.Color,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const letter = res.toResource<LetterAttributes>();
|
|
78
|
+
console.log(`letter ${letter.id} → status ${letter.attributes.status}`);
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
That single `uploadAndCreate` call does three things: requests a signed upload URL from Pingen, PUTs the PDF to it, and creates the letter resource with `auto_send=true` so Pingen prints and dispatches it immediately. Drop `autoSend: true` (and the three print/delivery fields) if you want to inspect the letter before sending — then call `letters.send({ letterId, … })` later.
|
|
82
|
+
|
|
83
|
+
The client handles OAuth lazily: the first request fetches a token, subsequent requests reuse it from cache, and a 401 triggers an automatic refresh.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Authentication
|
|
88
|
+
|
|
89
|
+
`PingenClient` accepts credentials in two equivalent forms — pick whichever reads cleaner at the call site.
|
|
90
|
+
|
|
91
|
+
### Positional (simple case)
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
new PingenClient('CLIENT_ID', 'CLIENT_SECRET'); // production
|
|
95
|
+
new PingenClient('CLIENT_ID', 'CLIENT_SECRET', true); // staging
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Config object (full control)
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
new PingenClient({
|
|
102
|
+
clientId: 'CLIENT_ID',
|
|
103
|
+
clientSecret: 'CLIENT_SECRET',
|
|
104
|
+
useStaging: true,
|
|
105
|
+
maxAttempts: 5,
|
|
106
|
+
timeoutMs: 30_000,
|
|
107
|
+
uploadTimeoutMs: 120_000,
|
|
108
|
+
});
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Optional: pre-fetch a token before the first request (e.g. before a long-running batch flow):
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
await client.ensureToken();
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Resources
|
|
120
|
+
|
|
121
|
+
### Organisations
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
import { OrganisationAttributes } from 'pingen2-sdk-js';
|
|
125
|
+
|
|
126
|
+
const orgs = (await client.organisations().getCollection()).toCollection<OrganisationAttributes>();
|
|
127
|
+
const org = (await client.organisations().getDetails(orgId)).toResource<OrganisationAttributes>();
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Letters
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
import {
|
|
134
|
+
AddressPosition,
|
|
135
|
+
DeliveryProduct,
|
|
136
|
+
PrintMode,
|
|
137
|
+
PrintSpectrum,
|
|
138
|
+
PaperType,
|
|
139
|
+
LetterAttributes,
|
|
140
|
+
} from 'pingen2-sdk-js';
|
|
141
|
+
|
|
142
|
+
const letters = client.letters(orgId);
|
|
143
|
+
|
|
144
|
+
// Upload + create (no auto-send)
|
|
145
|
+
const res = await letters.uploadAndCreate({
|
|
146
|
+
filePath: './invoice.pdf',
|
|
147
|
+
fileOriginalName: 'invoice.pdf',
|
|
148
|
+
addressPosition: AddressPosition.Left,
|
|
149
|
+
autoSend: false,
|
|
150
|
+
});
|
|
151
|
+
const letter = res.toResource<LetterAttributes>();
|
|
152
|
+
|
|
153
|
+
// Upload + create + auto-send
|
|
154
|
+
await letters.uploadAndCreate({
|
|
155
|
+
filePath: './invoice.pdf',
|
|
156
|
+
fileOriginalName: 'invoice.pdf',
|
|
157
|
+
addressPosition: AddressPosition.Left,
|
|
158
|
+
autoSend: true,
|
|
159
|
+
deliveryProduct: DeliveryProduct.Fast,
|
|
160
|
+
printMode: PrintMode.Simplex,
|
|
161
|
+
printSpectrum: PrintSpectrum.Color,
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
// Send an existing letter
|
|
165
|
+
await letters.send({
|
|
166
|
+
letterId,
|
|
167
|
+
deliveryProduct: DeliveryProduct.Fast,
|
|
168
|
+
printMode: PrintMode.Simplex,
|
|
169
|
+
printSpectrum: PrintSpectrum.Color,
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
// Cancel / delete / edit / download
|
|
173
|
+
await letters.cancel(letterId);
|
|
174
|
+
await letters.delete(letterId);
|
|
175
|
+
await letters.edit(letterId, [PaperType.Normal, PaperType.Qr]);
|
|
176
|
+
const pdf = await letters.getFile(letterId);
|
|
177
|
+
|
|
178
|
+
// Calculate price
|
|
179
|
+
const price = (
|
|
180
|
+
await letters.calculatePrice({
|
|
181
|
+
country: 'CH',
|
|
182
|
+
paperTypes: [PaperType.Normal],
|
|
183
|
+
printMode: PrintMode.Simplex,
|
|
184
|
+
printSpectrum: PrintSpectrum.Color,
|
|
185
|
+
deliveryProduct: DeliveryProduct.Fast,
|
|
186
|
+
})
|
|
187
|
+
).toResource<{ currency: string; price: number }>();
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Batches
|
|
191
|
+
|
|
192
|
+
```typescript
|
|
193
|
+
import {
|
|
194
|
+
AddressPosition,
|
|
195
|
+
BatchIcon,
|
|
196
|
+
GroupingType,
|
|
197
|
+
SplitType,
|
|
198
|
+
PrintMode,
|
|
199
|
+
PrintSpectrum,
|
|
200
|
+
DeliveryProduct,
|
|
201
|
+
BatchAttributes,
|
|
202
|
+
createBatchDeliveryProduct,
|
|
203
|
+
} from 'pingen2-sdk-js';
|
|
204
|
+
|
|
205
|
+
const batches = client.batches(orgId);
|
|
206
|
+
|
|
207
|
+
const res = await batches.uploadAndCreate({
|
|
208
|
+
filePath: './letters.pdf',
|
|
209
|
+
fileOriginalName: 'letters.pdf',
|
|
210
|
+
name: 'August invoices',
|
|
211
|
+
icon: BatchIcon.Campaign,
|
|
212
|
+
addressPosition: AddressPosition.Left,
|
|
213
|
+
groupingType: GroupingType.Merge,
|
|
214
|
+
splitType: SplitType.Page,
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
await batches.send({
|
|
218
|
+
batchId,
|
|
219
|
+
deliveryProducts: [
|
|
220
|
+
createBatchDeliveryProduct('CH', DeliveryProduct.Fast),
|
|
221
|
+
createBatchDeliveryProduct('DE', DeliveryProduct.Cheap),
|
|
222
|
+
],
|
|
223
|
+
printMode: PrintMode.Duplex,
|
|
224
|
+
printSpectrum: PrintSpectrum.Color,
|
|
225
|
+
});
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Events
|
|
229
|
+
|
|
230
|
+
```typescript
|
|
231
|
+
import { EventAttributes } from 'pingen2-sdk-js';
|
|
232
|
+
|
|
233
|
+
const events = (await client.letterEvents(orgId).getCollection(letterId)).toCollection<EventAttributes>();
|
|
234
|
+
|
|
235
|
+
await client.letterEvents(orgId).getIssueCollection();
|
|
236
|
+
await client.letterEvents(orgId).getDeliveredCollection();
|
|
237
|
+
await client.batchEvents(orgId).getCollection(batchId);
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Webhooks
|
|
241
|
+
|
|
242
|
+
```typescript
|
|
243
|
+
import { WebhookEventCategory, WebhookAttributes, constructWebhookEvent } from 'pingen2-sdk-js';
|
|
244
|
+
|
|
245
|
+
const webhooks = client.webhooks(orgId);
|
|
246
|
+
|
|
247
|
+
const wh = (
|
|
248
|
+
await webhooks.create({
|
|
249
|
+
eventCategory: WebhookEventCategory.Delivered,
|
|
250
|
+
url: 'https://myapp.com/webhook',
|
|
251
|
+
signingKey: 'my-signing-key',
|
|
252
|
+
})
|
|
253
|
+
).toResource<WebhookAttributes>();
|
|
254
|
+
|
|
255
|
+
await webhooks.delete(wh.id);
|
|
256
|
+
|
|
257
|
+
// Verify incoming webhook signature (constant-time comparison)
|
|
258
|
+
const event = constructWebhookEvent(rawBody, signatureHeader, 'my-signing-key');
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Ebills & Emails
|
|
262
|
+
|
|
263
|
+
```typescript
|
|
264
|
+
import { EbillAttributes, EmailAttributes, PresetRelationship } from 'pingen2-sdk-js';
|
|
265
|
+
|
|
266
|
+
const ebill = (
|
|
267
|
+
await client.ebills(orgId).uploadAndCreate({
|
|
268
|
+
filePath: './invoice.pdf',
|
|
269
|
+
fileOriginalName: 'invoice.pdf',
|
|
270
|
+
autoSend: true,
|
|
271
|
+
metaData: {
|
|
272
|
+
invoice_number: 'INV-001',
|
|
273
|
+
invoice_date: '2025-01-01',
|
|
274
|
+
invoice_due_date: '2025-02-01',
|
|
275
|
+
recipient_identifier: '411000100',
|
|
276
|
+
},
|
|
277
|
+
preset: new PresetRelationship('preset-uuid'),
|
|
278
|
+
})
|
|
279
|
+
).toResource<EbillAttributes>();
|
|
280
|
+
|
|
281
|
+
const email = (
|
|
282
|
+
await client.emails(orgId).uploadAndCreate({
|
|
283
|
+
filePath: './invoice.pdf',
|
|
284
|
+
fileOriginalName: 'invoice.pdf',
|
|
285
|
+
autoSend: true,
|
|
286
|
+
metaData: {
|
|
287
|
+
sender_name: 'ACME GmbH',
|
|
288
|
+
recipient_email: 'billing@client.com',
|
|
289
|
+
recipient_name: 'Client AG',
|
|
290
|
+
reply_email: 'billing@acme.com',
|
|
291
|
+
reply_name: 'ACME Billing',
|
|
292
|
+
subject: 'Invoice #123',
|
|
293
|
+
content: 'Please find your invoice attached.',
|
|
294
|
+
},
|
|
295
|
+
})
|
|
296
|
+
).toResource<EmailAttributes>();
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## Typed responses
|
|
302
|
+
|
|
303
|
+
Every API call returns a `PingenResponse`. Cast it with `.toResource<T>()` or `.toCollection<T>()` for type-safe access:
|
|
304
|
+
|
|
305
|
+
```typescript
|
|
306
|
+
const res = (await client.letters(orgId).getDetails(letterId)).toResource<LetterAttributes>();
|
|
307
|
+
|
|
308
|
+
res.id; // string
|
|
309
|
+
res.resourceType; // 'letters'
|
|
310
|
+
res.attributes.status; // typed
|
|
311
|
+
res.relationships; // JSON:API relationships
|
|
312
|
+
res.included; // included resources
|
|
313
|
+
res.statusCode; // HTTP status
|
|
314
|
+
res.headers; // response headers
|
|
315
|
+
|
|
316
|
+
const col = (await client.letters(orgId).getCollection({ 'page[number]': '2' })).toCollection<LetterAttributes>();
|
|
317
|
+
col.meta?.total;
|
|
318
|
+
col.meta?.current_page;
|
|
319
|
+
col.links?.next;
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## Error handling
|
|
325
|
+
|
|
326
|
+
Every SDK failure extends `PingenError`. HTTP responses dispatch to a per-status subclass so callers can match the cases they care about; everything else (local validation, missing credentials, webhook signature mismatch) shares the same base.
|
|
327
|
+
|
|
328
|
+
```typescript
|
|
329
|
+
import {
|
|
330
|
+
PingenError,
|
|
331
|
+
PingenNotFoundError,
|
|
332
|
+
PingenRateLimitError,
|
|
333
|
+
PingenUnprocessableEntityError,
|
|
334
|
+
ValidationError,
|
|
335
|
+
AuthenticationError,
|
|
336
|
+
} from 'pingen2-sdk-js';
|
|
337
|
+
|
|
338
|
+
try {
|
|
339
|
+
await client.letters(orgId).delete(letterId);
|
|
340
|
+
} catch (e) {
|
|
341
|
+
if (e instanceof ValidationError) {
|
|
342
|
+
console.log('Local check failed:', e.field, e.message);
|
|
343
|
+
} else if (e instanceof PingenNotFoundError) {
|
|
344
|
+
console.log('Letter no longer exists');
|
|
345
|
+
} else if (e instanceof PingenRateLimitError) {
|
|
346
|
+
await sleep(e.retryAfterMs ?? 1000);
|
|
347
|
+
} else if (e instanceof PingenUnprocessableEntityError) {
|
|
348
|
+
console.log('API rejected payload:', e.body);
|
|
349
|
+
} else if (e instanceof PingenError) {
|
|
350
|
+
console.log(e.status, e.body, e.requestId);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
Every error carries `.status`, `.body`, `.requestId`, and (for `429`/`503`) `.retryAfterMs`. Status-specific subclasses available: `PingenBadRequestError` (400), `PingenUnauthorizedError` (401), `PingenForbiddenError` (403), `PingenNotFoundError` (404), `PingenMethodNotAllowedError` (405), `PingenNotAcceptableError` (406), `PingenConflictError` (409), `PingenGoneError` (410), `PingenUnsupportedMediaError` (415), `PingenUnprocessableEntityError` (422), `PingenDependencyError` (424), `PingenRateLimitError` (429), `PingenServerError` (500), `PingenServiceUnavailableError` (503), `PingenTimeoutError`.
|
|
356
|
+
|
|
357
|
+
The SDK retries `429` and `5xx` automatically (with jittered exponential backoff and a reused `Idempotency-Key` for mutations). The retry budget defaults to 3 attempts and is configurable via `maxAttempts`.
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
## Configuration
|
|
362
|
+
|
|
363
|
+
```typescript
|
|
364
|
+
const client = new PingenClient({
|
|
365
|
+
clientId: 'CLIENT_ID',
|
|
366
|
+
clientSecret: 'CLIENT_SECRET',
|
|
367
|
+
useStaging: false, // default false
|
|
368
|
+
maxAttempts: 3, // retry budget for 429/5xx
|
|
369
|
+
timeoutMs: 20_000, // per-request timeout
|
|
370
|
+
uploadTimeoutMs: 60_000, // PUT to signed URL
|
|
371
|
+
});
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
The SDK identifies itself with a `User-Agent: PINGEN.SDK.NODE` header on every request.
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
378
|
+
## Scripts
|
|
379
|
+
|
|
380
|
+
```sh
|
|
381
|
+
npm test # run tests with coverage
|
|
382
|
+
npm run build # clean + compile TypeScript
|
|
383
|
+
npm run lint # ESLint
|
|
384
|
+
npm run format # Prettier (auto-fix)
|
|
385
|
+
npm run format:check # Prettier (check only)
|
|
386
|
+
npm run clean # remove dist/
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
---
|
|
390
|
+
|
|
391
|
+
## Development
|
|
392
|
+
|
|
393
|
+
The project is developed exclusively inside Docker — there is no supported local-Node workflow. All scripts (`npm test`, `npm run lint`, `npm run build`, `npm run manual-test`) are run through `docker compose exec`.
|
|
394
|
+
|
|
395
|
+
```sh
|
|
396
|
+
docker compose build
|
|
397
|
+
docker compose up -d
|
|
398
|
+
docker compose exec nodejs-sdk npm ci
|
|
399
|
+
docker compose exec nodejs-sdk npm test
|
|
400
|
+
docker compose down
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
---
|
|
404
|
+
|
|
405
|
+
## Versioning
|
|
406
|
+
|
|
407
|
+
Follows [semver](https://semver.org/). The published version is derived automatically from the latest git tag — tag a release (`git tag v1.2.3 && git push --tags`) and `npm publish` will set `package.json` accordingly via `prepublishOnly`.
|
|
408
|
+
|
|
409
|
+
---
|
|
410
|
+
|
|
411
|
+
## License
|
|
412
|
+
|
|
413
|
+
BSD 3-Clause — see [LICENSE](LICENSE)
|
|
414
|
+
|
|
415
|
+
Copyright (c) 2026, Pingen GmbH.
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Letters, Batches, LetterEvents, BatchEvents, EbillEvents, EmailEvents, Organisations, Users, UserAssociations, Webhooks, Ebills, Emails } from './resources';
|
|
2
|
+
export interface PingenClientConfig {
|
|
3
|
+
clientId: string;
|
|
4
|
+
clientSecret: string;
|
|
5
|
+
useStaging?: boolean;
|
|
6
|
+
maxAttempts?: number;
|
|
7
|
+
timeoutMs?: number;
|
|
8
|
+
uploadTimeoutMs?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare class PingenClient {
|
|
11
|
+
private readonly requestor;
|
|
12
|
+
private readonly oauth;
|
|
13
|
+
constructor(config: PingenClientConfig);
|
|
14
|
+
constructor(clientId: string, clientSecret: string, useStaging?: boolean);
|
|
15
|
+
ensureToken(): Promise<void>;
|
|
16
|
+
letters(orgId: string): Letters;
|
|
17
|
+
batches(orgId: string): Batches;
|
|
18
|
+
letterEvents(orgId: string): LetterEvents;
|
|
19
|
+
batchEvents(orgId: string): BatchEvents;
|
|
20
|
+
ebillEvents(orgId: string): EbillEvents;
|
|
21
|
+
emailEvents(orgId: string): EmailEvents;
|
|
22
|
+
organisations(): Organisations;
|
|
23
|
+
users(): Users;
|
|
24
|
+
userAssociations(): UserAssociations;
|
|
25
|
+
webhooks(orgId: string): Webhooks;
|
|
26
|
+
ebills(orgId: string): Ebills;
|
|
27
|
+
emails(orgId: string): Emails;
|
|
28
|
+
private buildRequestorOptions;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,OAAO,EACP,OAAO,EACP,YAAY,EACZ,WAAW,EACX,WAAW,EACX,WAAW,EACX,aAAa,EACb,KAAK,EACL,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,MAAM,EACP,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAe;IACzC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAQ;gBAElB,MAAM,EAAE,kBAAkB;gBAC1B,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO;IAelE,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAIlC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAG/B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAG/B,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY;IAGzC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW;IAGvC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW;IAGvC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW;IAGvC,aAAa,IAAI,aAAa;IAG9B,KAAK,IAAI,KAAK;IAGd,gBAAgB,IAAI,gBAAgB;IAGpC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ;IAGjC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAG7B,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAI7B,OAAO,CAAC,qBAAqB;CAY9B"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PingenClient = void 0;
|
|
4
|
+
const requestor_1 = require("./requestor");
|
|
5
|
+
const oauth_1 = require("./oauth");
|
|
6
|
+
const resources_1 = require("./resources");
|
|
7
|
+
class PingenClient {
|
|
8
|
+
constructor(configOrClientId, clientSecret, useStaging) {
|
|
9
|
+
const config = typeof configOrClientId === 'string'
|
|
10
|
+
? { clientId: configOrClientId, clientSecret: clientSecret, useStaging }
|
|
11
|
+
: configOrClientId;
|
|
12
|
+
this.oauth = new oauth_1.OAuth({
|
|
13
|
+
clientId: config.clientId,
|
|
14
|
+
clientSecret: config.clientSecret,
|
|
15
|
+
useStaging: config.useStaging ?? false,
|
|
16
|
+
});
|
|
17
|
+
this.requestor = new requestor_1.ApiRequestor(null, this.buildRequestorOptions(config));
|
|
18
|
+
}
|
|
19
|
+
async ensureToken() {
|
|
20
|
+
this.requestor.setAccessToken(await this.oauth.getAccessToken());
|
|
21
|
+
}
|
|
22
|
+
letters(orgId) {
|
|
23
|
+
return new resources_1.Letters(orgId, this.requestor);
|
|
24
|
+
}
|
|
25
|
+
batches(orgId) {
|
|
26
|
+
return new resources_1.Batches(orgId, this.requestor);
|
|
27
|
+
}
|
|
28
|
+
letterEvents(orgId) {
|
|
29
|
+
return new resources_1.LetterEvents(orgId, this.requestor);
|
|
30
|
+
}
|
|
31
|
+
batchEvents(orgId) {
|
|
32
|
+
return new resources_1.BatchEvents(orgId, this.requestor);
|
|
33
|
+
}
|
|
34
|
+
ebillEvents(orgId) {
|
|
35
|
+
return new resources_1.EbillEvents(orgId, this.requestor);
|
|
36
|
+
}
|
|
37
|
+
emailEvents(orgId) {
|
|
38
|
+
return new resources_1.EmailEvents(orgId, this.requestor);
|
|
39
|
+
}
|
|
40
|
+
organisations() {
|
|
41
|
+
return new resources_1.Organisations(this.requestor);
|
|
42
|
+
}
|
|
43
|
+
users() {
|
|
44
|
+
return new resources_1.Users(this.requestor);
|
|
45
|
+
}
|
|
46
|
+
userAssociations() {
|
|
47
|
+
return new resources_1.UserAssociations(this.requestor);
|
|
48
|
+
}
|
|
49
|
+
webhooks(orgId) {
|
|
50
|
+
return new resources_1.Webhooks(orgId, this.requestor);
|
|
51
|
+
}
|
|
52
|
+
ebills(orgId) {
|
|
53
|
+
return new resources_1.Ebills(orgId, this.requestor);
|
|
54
|
+
}
|
|
55
|
+
emails(orgId) {
|
|
56
|
+
return new resources_1.Emails(orgId, this.requestor);
|
|
57
|
+
}
|
|
58
|
+
buildRequestorOptions(config) {
|
|
59
|
+
return {
|
|
60
|
+
useStaging: config.useStaging,
|
|
61
|
+
maxAttempts: config.maxAttempts,
|
|
62
|
+
timeoutMs: config.timeoutMs,
|
|
63
|
+
uploadTimeoutMs: config.uploadTimeoutMs,
|
|
64
|
+
on401: async () => {
|
|
65
|
+
this.oauth.invalidate();
|
|
66
|
+
return this.oauth.getAccessToken();
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.PingenClient = PingenClient;
|
|
72
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAAA,2CAAgE;AAChE,mCAAgC;AAChC,2CAaqB;AAWrB,MAAa,YAAY;IAMvB,YAAY,gBAA6C,EAAE,YAAqB,EAAE,UAAoB;QACpG,MAAM,MAAM,GACV,OAAO,gBAAgB,KAAK,QAAQ;YAClC,CAAC,CAAC,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAsB,EAAE,UAAU,EAAE;YAClF,CAAC,CAAC,gBAAgB,CAAC;QAEvB,IAAI,CAAC,KAAK,GAAG,IAAI,aAAK,CAAC;YACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,KAAK;SACvC,CAAC,CAAC;QACH,IAAI,CAAC,SAAS,GAAG,IAAI,wBAAY,CAAC,IAAI,EAAE,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9E,CAAC;IAED,KAAK,CAAC,WAAW;QACf,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,OAAO,CAAC,KAAa;QACnB,OAAO,IAAI,mBAAO,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,CAAC,KAAa;QACnB,OAAO,IAAI,mBAAO,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC;IACD,YAAY,CAAC,KAAa;QACxB,OAAO,IAAI,wBAAY,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACjD,CAAC;IACD,WAAW,CAAC,KAAa;QACvB,OAAO,IAAI,uBAAW,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAChD,CAAC;IACD,WAAW,CAAC,KAAa;QACvB,OAAO,IAAI,uBAAW,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAChD,CAAC;IACD,WAAW,CAAC,KAAa;QACvB,OAAO,IAAI,uBAAW,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAChD,CAAC;IACD,aAAa;QACX,OAAO,IAAI,yBAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC3C,CAAC;IACD,KAAK;QACH,OAAO,IAAI,iBAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACnC,CAAC;IACD,gBAAgB;QACd,OAAO,IAAI,4BAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC;IACD,QAAQ,CAAC,KAAa;QACpB,OAAO,IAAI,oBAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC;IACD,MAAM,CAAC,KAAa;QAClB,OAAO,IAAI,kBAAM,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC3C,CAAC;IACD,MAAM,CAAC,KAAa;QAClB,OAAO,IAAI,kBAAM,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC3C,CAAC;IAEO,qBAAqB,CAAC,MAA0B;QACtD,OAAO;YACL,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,KAAK,EAAE,KAAK,IAAI,EAAE;gBAChB,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;gBACxB,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;YACrC,CAAC;SACF,CAAC;IACJ,CAAC;CACF;AAzED,oCAyEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address-position.d.ts","sourceRoot":"","sources":["../../../src/common/enums/address-position.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,IAAI,SAAS;IACb,KAAK,UAAU;CAChB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddressPosition = void 0;
|
|
4
|
+
var AddressPosition;
|
|
5
|
+
(function (AddressPosition) {
|
|
6
|
+
AddressPosition["Left"] = "left";
|
|
7
|
+
AddressPosition["Right"] = "right";
|
|
8
|
+
})(AddressPosition || (exports.AddressPosition = AddressPosition = {}));
|
|
9
|
+
//# sourceMappingURL=address-position.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address-position.js","sourceRoot":"","sources":["../../../src/common/enums/address-position.ts"],"names":[],"mappings":";;;AAAA,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,gCAAa,CAAA;IACb,kCAAe,CAAA;AACjB,CAAC,EAHW,eAAe,+BAAf,eAAe,QAG1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delivery-product.d.ts","sourceRoot":"","sources":["../../../src/common/enums/delivery-product.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,UAAU,eAAe;IACzB,IAAI,SAAS;IACb,OAAO,YAAY;CACpB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeliveryProduct = void 0;
|
|
4
|
+
var DeliveryProduct;
|
|
5
|
+
(function (DeliveryProduct) {
|
|
6
|
+
DeliveryProduct["Cheap"] = "cheap";
|
|
7
|
+
DeliveryProduct["Fast"] = "fast";
|
|
8
|
+
DeliveryProduct["Registered"] = "registered";
|
|
9
|
+
DeliveryProduct["Bulk"] = "bulk";
|
|
10
|
+
DeliveryProduct["Premium"] = "premium";
|
|
11
|
+
})(DeliveryProduct || (exports.DeliveryProduct = DeliveryProduct = {}));
|
|
12
|
+
//# sourceMappingURL=delivery-product.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delivery-product.js","sourceRoot":"","sources":["../../../src/common/enums/delivery-product.ts"],"names":[],"mappings":";;;AAAA,IAAY,eAMX;AAND,WAAY,eAAe;IACzB,kCAAe,CAAA;IACf,gCAAa,CAAA;IACb,4CAAyB,CAAA;IACzB,gCAAa,CAAA;IACb,sCAAmB,CAAA;AACrB,CAAC,EANW,eAAe,+BAAf,eAAe,QAM1B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { AddressPosition } from './address-position';
|
|
2
|
+
export { DeliveryProduct } from './delivery-product';
|
|
3
|
+
export { PaperType } from './paper-type';
|
|
4
|
+
export { PrintMode } from './print-mode';
|
|
5
|
+
export { PrintSpectrum } from './print-spectrum';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/enums/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PrintSpectrum = exports.PrintMode = exports.PaperType = exports.DeliveryProduct = exports.AddressPosition = void 0;
|
|
4
|
+
var address_position_1 = require("./address-position");
|
|
5
|
+
Object.defineProperty(exports, "AddressPosition", { enumerable: true, get: function () { return address_position_1.AddressPosition; } });
|
|
6
|
+
var delivery_product_1 = require("./delivery-product");
|
|
7
|
+
Object.defineProperty(exports, "DeliveryProduct", { enumerable: true, get: function () { return delivery_product_1.DeliveryProduct; } });
|
|
8
|
+
var paper_type_1 = require("./paper-type");
|
|
9
|
+
Object.defineProperty(exports, "PaperType", { enumerable: true, get: function () { return paper_type_1.PaperType; } });
|
|
10
|
+
var print_mode_1 = require("./print-mode");
|
|
11
|
+
Object.defineProperty(exports, "PrintMode", { enumerable: true, get: function () { return print_mode_1.PrintMode; } });
|
|
12
|
+
var print_spectrum_1 = require("./print-spectrum");
|
|
13
|
+
Object.defineProperty(exports, "PrintSpectrum", { enumerable: true, get: function () { return print_spectrum_1.PrintSpectrum; } });
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/enums/index.ts"],"names":[],"mappings":";;;AAAA,uDAAqD;AAA5C,mHAAA,eAAe,OAAA;AACxB,uDAAqD;AAA5C,mHAAA,eAAe,OAAA;AACxB,2CAAyC;AAAhC,uGAAA,SAAS,OAAA;AAClB,2CAAyC;AAAhC,uGAAA,SAAS,OAAA;AAClB,mDAAiD;AAAxC,+GAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paper-type.d.ts","sourceRoot":"","sources":["../../../src/common/enums/paper-type.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS;IACnB,MAAM,WAAW;IACjB,EAAE,OAAO;IACT,MAAM,YAAY;IAClB,MAAM,YAAY;CACnB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PaperType = void 0;
|
|
4
|
+
var PaperType;
|
|
5
|
+
(function (PaperType) {
|
|
6
|
+
PaperType["Normal"] = "normal";
|
|
7
|
+
PaperType["Qr"] = "qr";
|
|
8
|
+
PaperType["SepaAt"] = "sepa_at";
|
|
9
|
+
PaperType["SepaDe"] = "sepa_de";
|
|
10
|
+
})(PaperType || (exports.PaperType = PaperType = {}));
|
|
11
|
+
//# sourceMappingURL=paper-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paper-type.js","sourceRoot":"","sources":["../../../src/common/enums/paper-type.ts"],"names":[],"mappings":";;;AAAA,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,8BAAiB,CAAA;IACjB,sBAAS,CAAA;IACT,+BAAkB,CAAA;IAClB,+BAAkB,CAAA;AACpB,CAAC,EALW,SAAS,yBAAT,SAAS,QAKpB"}
|