cepik-api-client 0.0.3 โ 0.0.6
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 +98 -0
- package/dist/cepik-address-resolver.d.ts +17 -0
- package/dist/cepik-address-resolver.js +62 -0
- package/dist/cepik-address-resolver.js.map +1 -0
- package/dist/cepik-address-resolver.spec.d.ts +1 -0
- package/dist/cepik-address-resolver.spec.js +17 -0
- package/dist/cepik-address-resolver.spec.js.map +1 -0
- package/dist/cepik-client.js.map +1 -1
- package/dist/enums.d.ts +16 -1
- package/dist/enums.js +32 -1
- package/dist/enums.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,101 @@
|
|
|
1
1
|
# cepik-api-client
|
|
2
2
|
|
|
3
3
|
A modern TypeScript/JavaScript library for retrieving data from the public API of the Polish National Vehicles Database (CEPIK).
|
|
4
|
+
|
|
5
|
+
## ๐ฆ Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install cepik-client
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
yarn add cepik-client
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add cepik-client
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## ๐ Quick Start
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { CEPIKClient } from "cepik-client";
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### ๐ ๏ธ Development
|
|
28
|
+
|
|
29
|
+
To run the full quality suite locally:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install
|
|
33
|
+
npm run build # compile TypeScript to dist/
|
|
34
|
+
npm run lint # static analysis
|
|
35
|
+
npm run test # run unit tests
|
|
36
|
+
npm run coverage # generate coverage report
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The package also includes a `prepare` script so that if you install directly
|
|
40
|
+
directly from the Git repository (e.g. `npm install username/nbp-api-client`),
|
|
41
|
+
it will compile automatically.
|
|
42
|
+
|
|
43
|
+
### ๐ค Contributing
|
|
44
|
+
|
|
45
|
+
Please open issues for bugs or feature requests and send pull requests with
|
|
46
|
+
clear descriptions. The library follows semantic versioning; bump the
|
|
47
|
+
version in `package.json` and update the changelog when adding features or
|
|
48
|
+
fixes.
|
|
49
|
+
|
|
50
|
+
## ๐ Types and Enums
|
|
51
|
+
|
|
52
|
+
### Enums
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import {
|
|
56
|
+
} from "nbp-api-client";
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Types
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
import type {
|
|
63
|
+
} from "nbp-api-client";
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## ๐งช Testing
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npm run test
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## ๐ Linting
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npm run lint
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## ๐๏ธ Building
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
npm run build
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The compiled code is located in the `dist/` directory.
|
|
85
|
+
|
|
86
|
+
## ๐ Resources
|
|
87
|
+
|
|
88
|
+
- [Official CEPIK API](https://www.gov.pl/web/cepik/api-dla-centralnej-ewidencji-pojazdow-i-kierowcow-api-do-cepik)
|
|
89
|
+
- [CEPIK API Documentation](https://api.cepik.gov.pl/doc) - Details about endpoints, formats and limitations.
|
|
90
|
+
- [Dictionaries](https://api.cepik.gov.pl/slowniki) - all enums used in the project.
|
|
91
|
+
|
|
92
|
+
## ๐ License
|
|
93
|
+
|
|
94
|
+
[MIT ยฉ 2026](./LICENSE) [miqel-dll](https://github.com/miqel-dll)
|
|
95
|
+
|
|
96
|
+
## ๐ค Support
|
|
97
|
+
|
|
98
|
+
If you encounter a problem or have a suggestion, please open an [issue on GitHub](https://github.com/miqel-dll/nbp-api-client/issues).
|
|
99
|
+
|
|
100
|
+
Author: [miqel-dll](https://github.com/miqel-dll)
|
|
101
|
+
Version: 0.0.6
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare class CepikAddressResolver {
|
|
2
|
+
private static decode;
|
|
3
|
+
private static get host();
|
|
4
|
+
static get vehiclesEndpoint(): string;
|
|
5
|
+
static getEndpointForVehicle(vehicleId: string): string;
|
|
6
|
+
static get filesEndpoint(): string;
|
|
7
|
+
static getEndpointForFile(fileId: string): string;
|
|
8
|
+
static get drivingLicencesEndpoint(): string;
|
|
9
|
+
static getEndpointForDrivingLicence(licenceId: string): string;
|
|
10
|
+
static get permissionsEndpoint(): string;
|
|
11
|
+
static getEndpointForPermission(permissionId: string): string;
|
|
12
|
+
static get dictionariesEndpoint(): string;
|
|
13
|
+
static getEndpointForDictionary(dictionaryId: string): string;
|
|
14
|
+
static get statisticsEndpoint(): string;
|
|
15
|
+
static get versionEndpoint(): string;
|
|
16
|
+
static get v1VersionEndpoint(): string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export class CepikAddressResolver {
|
|
2
|
+
static decode(b64name) {
|
|
3
|
+
return Buffer.from(b64name, `base64`).toString(`utf-8`);
|
|
4
|
+
}
|
|
5
|
+
static get host() {
|
|
6
|
+
return this.decode(`aHR0cHM6Ly9hcGkuY2VwaWsuZ292LnBsLw==`);
|
|
7
|
+
}
|
|
8
|
+
;
|
|
9
|
+
static get vehiclesEndpoint() {
|
|
10
|
+
return `${this.host}/${this.decode(`cG9qYXpkeQ==`)}`;
|
|
11
|
+
}
|
|
12
|
+
;
|
|
13
|
+
static getEndpointForVehicle(vehicleId) {
|
|
14
|
+
return `${this.vehiclesEndpoint}/${vehicleId}`;
|
|
15
|
+
}
|
|
16
|
+
;
|
|
17
|
+
static get filesEndpoint() {
|
|
18
|
+
return `${this.host}/${this.decode(`cGxpa2k=`)}`;
|
|
19
|
+
}
|
|
20
|
+
static getEndpointForFile(fileId) {
|
|
21
|
+
return `${this.filesEndpoint}/${fileId}`;
|
|
22
|
+
}
|
|
23
|
+
;
|
|
24
|
+
static get drivingLicencesEndpoint() {
|
|
25
|
+
return `${this.host}/${this.decode(`cHJhd2EtamF6ZHk=`)}`;
|
|
26
|
+
}
|
|
27
|
+
;
|
|
28
|
+
static getEndpointForDrivingLicence(licenceId) {
|
|
29
|
+
return `${this.drivingLicencesEndpoint}/${licenceId}`;
|
|
30
|
+
}
|
|
31
|
+
;
|
|
32
|
+
static get permissionsEndpoint() {
|
|
33
|
+
return `${this.host}/${this.decode(`dXByYXduaWVuaWE=`)}`;
|
|
34
|
+
}
|
|
35
|
+
;
|
|
36
|
+
static getEndpointForPermission(permissionId) {
|
|
37
|
+
return `${this.permissionsEndpoint}/${permissionId}`;
|
|
38
|
+
}
|
|
39
|
+
;
|
|
40
|
+
static get dictionariesEndpoint() {
|
|
41
|
+
return `${this.host}/${this.decode(`c2xvd25pa2k=`)}`;
|
|
42
|
+
}
|
|
43
|
+
;
|
|
44
|
+
static getEndpointForDictionary(dictionaryId) {
|
|
45
|
+
return `${this.dictionariesEndpoint}/${dictionaryId}`;
|
|
46
|
+
}
|
|
47
|
+
;
|
|
48
|
+
static get statisticsEndpoint() {
|
|
49
|
+
return `${this.host}/${this.decode(`c3RhdHlzdHlraQ==`)}`;
|
|
50
|
+
}
|
|
51
|
+
;
|
|
52
|
+
static get versionEndpoint() {
|
|
53
|
+
return `${this.host}/${this.decode(`dmVyc2lvbg==`)}`;
|
|
54
|
+
}
|
|
55
|
+
;
|
|
56
|
+
static get v1VersionEndpoint() {
|
|
57
|
+
return `${this.host}/${this.decode(`djEvdmVyc2lvbg==`)}`;
|
|
58
|
+
}
|
|
59
|
+
;
|
|
60
|
+
}
|
|
61
|
+
;
|
|
62
|
+
//# sourceMappingURL=cepik-address-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cepik-address-resolver.js","sourceRoot":"","sources":["../src/cepik-address-resolver.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,oBAAoB;IAErB,MAAM,CAAC,MAAM,CAAC,OAAe;QACjC,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC5D,CAAC;IAEO,MAAM,KAAK,IAAI;QACnB,OAAO,IAAI,CAAC,MAAM,CAAC,sCAAsC,CAAC,CAAC;IAC/D,CAAC;IAAA,CAAC;IAEK,MAAM,KAAK,gBAAgB;QAC9B,OAAO,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,CAAC;IACzD,CAAC;IAAA,CAAC;IAEK,MAAM,CAAC,qBAAqB,CAAC,SAAiB;QACjD,OAAO,GAAG,IAAI,CAAC,gBAAgB,IAAI,SAAS,EAAE,CAAC;IACnD,CAAC;IAAA,CAAC;IAEK,MAAM,KAAK,aAAa;QAC3B,OAAO,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAA;IACpD,CAAC;IAEM,MAAM,CAAC,kBAAkB,CAAC,MAAc;QAC3C,OAAO,GAAG,IAAI,CAAC,aAAa,IAAI,MAAM,EAAE,CAAC;IAC7C,CAAC;IAAA,CAAC;IAEK,MAAM,KAAK,uBAAuB;QACrC,OAAO,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,EAAE,CAAC;IAC7D,CAAC;IAAA,CAAC;IAEK,MAAM,CAAC,4BAA4B,CAAC,SAAiB;QACxD,OAAO,GAAG,IAAI,CAAC,uBAAuB,IAAI,SAAS,EAAE,CAAC;IAC1D,CAAC;IAAA,CAAC;IAEK,MAAM,KAAK,mBAAmB;QACjC,OAAO,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,EAAE,CAAC;IAC7D,CAAC;IAAA,CAAC;IAEK,MAAM,CAAC,wBAAwB,CAAC,YAAoB;QACvD,OAAO,GAAG,IAAI,CAAC,mBAAmB,IAAI,YAAY,EAAE,CAAC;IACzD,CAAC;IAAA,CAAC;IAEK,MAAM,KAAK,oBAAoB;QAClC,OAAO,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,CAAC;IACzD,CAAC;IAAA,CAAC;IAEK,MAAM,CAAC,wBAAwB,CAAC,YAAoB;QACvD,OAAO,GAAG,IAAI,CAAC,oBAAoB,IAAI,YAAY,EAAE,CAAA;IACzD,CAAC;IAAA,CAAC;IAEK,MAAM,KAAK,kBAAkB;QAChC,OAAO,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,EAAE,CAAC;IAC7D,CAAC;IAAA,CAAC;IAEK,MAAM,KAAK,eAAe;QAC7B,OAAO,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,CAAC;IACzD,CAAC;IAAA,CAAC;IAEK,MAAM,KAAK,iBAAiB;QAC/B,OAAO,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,EAAE,CAAC;IAC7D,CAAC;IAAA,CAAC;CAEL;AAAA,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CepikAddressResolver } from "./cepik-address-resolver.js";
|
|
2
|
+
global.fetch = jest.fn();
|
|
3
|
+
const mockFetch = global.fetch;
|
|
4
|
+
describe("CEPIKClient", () => {
|
|
5
|
+
let client;
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
mockFetch.mockClear();
|
|
8
|
+
client = new CepikAddressResolver();
|
|
9
|
+
});
|
|
10
|
+
describe("constructor", () => {
|
|
11
|
+
it("Should initialize", () => {
|
|
12
|
+
const newClient = new CepikAddressResolver();
|
|
13
|
+
expect(newClient).toBeInstanceOf(CepikAddressResolver);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=cepik-address-resolver.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cepik-address-resolver.spec.js","sourceRoot":"","sources":["../src/cepik-address-resolver.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAGnE,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AACzB,MAAM,SAAS,GAAG,MAAM,CAAC,KAA0C,CAAC;AAEpE,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAEzB,IAAI,MAA4B,CAAC;IAEjC,UAAU,CAAC,GAAG,EAAE;QACZ,SAAS,CAAC,SAAS,EAAE,CAAC;QACtB,MAAM,GAAG,IAAI,oBAAoB,EAAE,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAEzB,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;YACzB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;YAC7C,MAAM,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;IAEP,CAAC,CAAC,CAAC;AAEP,CAAC,CAAC,CAAC"}
|
package/dist/cepik-client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cepik-client.js","sourceRoot":"","sources":["../src/cepik-client.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,WAAW;
|
|
1
|
+
{"version":3,"file":"cepik-client.js","sourceRoot":"","sources":["../src/cepik-client.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,WAAW;CAGvB"}
|
package/dist/enums.d.ts
CHANGED
|
@@ -1 +1,16 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export declare enum VoivodeshipEnum {
|
|
2
|
+
}
|
|
3
|
+
export declare enum BrandEnum {
|
|
4
|
+
}
|
|
5
|
+
export declare enum DictionariesEnum {
|
|
6
|
+
}
|
|
7
|
+
export declare enum VehicleBrandEnum {
|
|
8
|
+
}
|
|
9
|
+
export declare enum FuelTypeEnum {
|
|
10
|
+
}
|
|
11
|
+
export declare enum VehicleManufacturingCountryEnum {
|
|
12
|
+
}
|
|
13
|
+
export declare enum VehicleProductionMethodEnum {
|
|
14
|
+
}
|
|
15
|
+
export declare enum StatisticsSubjects {
|
|
16
|
+
}
|
package/dist/enums.js
CHANGED
|
@@ -1,2 +1,33 @@
|
|
|
1
|
-
export
|
|
1
|
+
export var VoivodeshipEnum;
|
|
2
|
+
(function (VoivodeshipEnum) {
|
|
3
|
+
})(VoivodeshipEnum || (VoivodeshipEnum = {}));
|
|
4
|
+
;
|
|
5
|
+
export var BrandEnum;
|
|
6
|
+
(function (BrandEnum) {
|
|
7
|
+
})(BrandEnum || (BrandEnum = {}));
|
|
8
|
+
;
|
|
9
|
+
export var DictionariesEnum;
|
|
10
|
+
(function (DictionariesEnum) {
|
|
11
|
+
})(DictionariesEnum || (DictionariesEnum = {}));
|
|
12
|
+
;
|
|
13
|
+
export var VehicleBrandEnum;
|
|
14
|
+
(function (VehicleBrandEnum) {
|
|
15
|
+
})(VehicleBrandEnum || (VehicleBrandEnum = {}));
|
|
16
|
+
;
|
|
17
|
+
export var FuelTypeEnum;
|
|
18
|
+
(function (FuelTypeEnum) {
|
|
19
|
+
})(FuelTypeEnum || (FuelTypeEnum = {}));
|
|
20
|
+
;
|
|
21
|
+
export var VehicleManufacturingCountryEnum;
|
|
22
|
+
(function (VehicleManufacturingCountryEnum) {
|
|
23
|
+
})(VehicleManufacturingCountryEnum || (VehicleManufacturingCountryEnum = {}));
|
|
24
|
+
;
|
|
25
|
+
export var VehicleProductionMethodEnum;
|
|
26
|
+
(function (VehicleProductionMethodEnum) {
|
|
27
|
+
})(VehicleProductionMethodEnum || (VehicleProductionMethodEnum = {}));
|
|
28
|
+
;
|
|
29
|
+
export var StatisticsSubjects;
|
|
30
|
+
(function (StatisticsSubjects) {
|
|
31
|
+
})(StatisticsSubjects || (StatisticsSubjects = {}));
|
|
32
|
+
;
|
|
2
33
|
//# sourceMappingURL=enums.js.map
|
package/dist/enums.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,eAEX;AAFD,WAAY,eAAe;AAE3B,CAAC,EAFW,eAAe,KAAf,eAAe,QAE1B;AAAA,CAAC;AAEF,MAAM,CAAN,IAAY,SAEX;AAFD,WAAY,SAAS;AAErB,CAAC,EAFW,SAAS,KAAT,SAAS,QAEpB;AAAA,CAAC;AAEF,MAAM,CAAN,IAAY,gBAEX;AAFD,WAAY,gBAAgB;AAE5B,CAAC,EAFW,gBAAgB,KAAhB,gBAAgB,QAE3B;AAAA,CAAC;AAEF,MAAM,CAAN,IAAY,gBAEX;AAFD,WAAY,gBAAgB;AAE5B,CAAC,EAFW,gBAAgB,KAAhB,gBAAgB,QAE3B;AAAA,CAAC;AAEF,MAAM,CAAN,IAAY,YAEX;AAFD,WAAY,YAAY;AAExB,CAAC,EAFW,YAAY,KAAZ,YAAY,QAEvB;AAAA,CAAC;AAEF,MAAM,CAAN,IAAY,+BAEX;AAFD,WAAY,+BAA+B;AAE3C,CAAC,EAFW,+BAA+B,KAA/B,+BAA+B,QAE1C;AAAA,CAAC;AAEF,MAAM,CAAN,IAAY,2BAEX;AAFD,WAAY,2BAA2B;AAEvC,CAAC,EAFW,2BAA2B,KAA3B,2BAA2B,QAEtC;AAAA,CAAC;AAEF,MAAM,CAAN,IAAY,kBAEX;AAFD,WAAY,kBAAkB;AAE9B,CAAC,EAFW,kBAAkB,KAAlB,kBAAkB,QAE7B;AAAA,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cepik-api-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "A modern TypeScript/JavaScript library for retrieving data from the public API of the Polish National Vehicles Database (CEPIK).",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|