ksef-client-ts 0.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/LICENSE +21 -0
- package/README.md +70 -0
- package/dist/cli.js +10085 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +7341 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2009 -0
- package/dist/index.d.ts +2009 -0
- package/dist/index.js +7243 -0
- package/dist/index.js.map +1 -0
- package/package.json +80 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Flop
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# ksef-client-ts
|
|
2
|
+
|
|
3
|
+
TypeScript client for the Polish National e-Invoice System (KSeF) API v2.
|
|
4
|
+
|
|
5
|
+
**[Documentation](https://flopsstuff.github.io/ksef-client-ts)**
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Complete API coverage** — auth, sessions, invoices, permissions, tokens, certificates, QR codes, and more
|
|
10
|
+
- **Full-featured CLI** — `ksef` with many command groups and subcommands for day-to-day KSeF workflows
|
|
11
|
+
- **Full documentation** — VitePress site: Quick Start, API reference, OpenAPI spec
|
|
12
|
+
- **OpenAPI aligned** — types checked against the official KSeF spec; full spec and domain chunks in `docs/`
|
|
13
|
+
- **Comprehensive test coverage** — Vitest across HTTP, crypto, services, builders; CI on every change
|
|
14
|
+
- **Zero HTTP dependencies** — native `fetch` (Node 18+); dual ESM/CJS via tsup
|
|
15
|
+
- **Built-in cryptography** — AES-256-CBC, RSA-OAEP, ECDH, XAdES-B, self-signed certs (Node crypto)
|
|
16
|
+
- **Automatic token management** — AuthManager: token injection, 401 refresh with dedup, `loginWithToken` / `loginWithCertificate`
|
|
17
|
+
- **Typed errors & fluent builders** — `KSeFError` hierarchy (401, 403, 429, validation) and request builders
|
|
18
|
+
|
|
19
|
+
Requires **Node.js 18+**. Package not yet published — clone and build locally:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
git clone https://github.com/Flopsstuff/ksef-client-ts.git
|
|
23
|
+
cd ksef-client-ts
|
|
24
|
+
yarn install && yarn build
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { KSeFClient } from 'ksef-client-ts';
|
|
29
|
+
|
|
30
|
+
const client = new KSeFClient({ environment: 'TEST' });
|
|
31
|
+
await client.crypto.init();
|
|
32
|
+
|
|
33
|
+
const challenge = await client.auth.getChallenge();
|
|
34
|
+
// ... authenticate, open session, send invoices
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
ksef auth login --token "$KSEF_TOKEN" --nip "$KSEF_NIP"
|
|
39
|
+
ksef session open
|
|
40
|
+
ksef invoice send invoice.xml
|
|
41
|
+
ksef session close
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
See the [documentation](https://flopsstuff.github.io/ksef-client-ts) for full usage, [API reference](https://flopsstuff.github.io/ksef-client-ts/api-reference), and [CLI reference](https://flopsstuff.github.io/ksef-client-ts/cli).
|
|
45
|
+
|
|
46
|
+
## Development
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
yarn install # Install dependencies (yarn 4.x via Corepack)
|
|
50
|
+
yarn build # Build ESM + CJS + DTS via tsup
|
|
51
|
+
yarn lint # Type-check (tsc --noEmit)
|
|
52
|
+
yarn test # Run all tests (vitest)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Related
|
|
56
|
+
|
|
57
|
+
- [KSeF official docs](https://github.com/CIRFMF/ksef-docs) — official documentation (Polish)
|
|
58
|
+
- [KSeF docs translated](https://flopsstuff.github.io/ksef-docs/) — translated documentation (EN/RU/UK)
|
|
59
|
+
- [ksef-client-csharp](https://github.com/CIRFMF/ksef-client-csharp) — official C# reference client
|
|
60
|
+
- [ksef-client-java](https://github.com/CIRFMF/ksef-client-java) — official Java reference client
|
|
61
|
+
|
|
62
|
+
## Status
|
|
63
|
+
|
|
64
|
+
[](https://github.com/Flopsstuff/ksef-client-ts/actions/workflows/test.yml)
|
|
65
|
+
|
|
66
|
+

|
|
67
|
+
|
|
68
|
+
## License
|
|
69
|
+
|
|
70
|
+
[MIT](LICENSE)
|