@omnizoek/sdk 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/README.md +234 -0
- package/dist/index.cjs +448 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +410 -0
- package/dist/index.d.ts +410 -0
- package/dist/index.js +446 -0
- package/dist/index.js.map +1 -0
- package/package.json +58 -0
package/README.md
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# @omnizoek/sdk
|
|
2
|
+
|
|
3
|
+
Official TypeScript/JavaScript SDK for the [OmniZoek API](https://omnizoek.nl) — Dutch government data in one clean REST API.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@omnizoek/sdk)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- **Full TypeScript support** — every request and response is typed
|
|
13
|
+
- **ESM + CJS dual output** — works in Node.js, Deno, Bun, and browser bundles
|
|
14
|
+
- **Automatic retries** — exponential back-off on `429 Rate Limit` responses
|
|
15
|
+
- **Typed errors** — `OmniAuthError`, `OmniNotFoundError`, `OmniRateLimitError` etc.
|
|
16
|
+
- **Zero dependencies** — uses the native `fetch` API (Node ≥ 18)
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install @omnizoek/sdk
|
|
24
|
+
# or
|
|
25
|
+
pnpm add @omnizoek/sdk
|
|
26
|
+
# or
|
|
27
|
+
yarn add @omnizoek/sdk
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Quick start
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { OmniClient } from "@omnizoek/sdk";
|
|
36
|
+
|
|
37
|
+
const omni = new OmniClient({ apiKey: "omni_live_…" });
|
|
38
|
+
|
|
39
|
+
// Enrich a Dutch address
|
|
40
|
+
const address = await omni.geo.enrichAddress({
|
|
41
|
+
postcode: "1012LG",
|
|
42
|
+
houseNumber: "1",
|
|
43
|
+
});
|
|
44
|
+
console.log(address.city); // "Amsterdam"
|
|
45
|
+
|
|
46
|
+
// Get the statutory minimum wage for a 21-year-old
|
|
47
|
+
const wage = await omni.hr.minimumWage({ age: 21 });
|
|
48
|
+
console.log(wage.hourly_eur); // e.g. 13.27
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## API key
|
|
54
|
+
|
|
55
|
+
Get a free **sandbox key** instantly — no sign-up required:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
curl -X POST https://api.omnizoek.nl/v1/keys/test
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Or visit [omnizoek.nl/playground](https://omnizoek.nl/playground) to try every endpoint live.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Endpoints
|
|
66
|
+
|
|
67
|
+
### `omni.geo` — Geographic enrichment
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
const result = await omni.geo.enrichAddress({
|
|
71
|
+
postcode: "1012LG",
|
|
72
|
+
houseNumber: "1",
|
|
73
|
+
// energy?: boolean — include EP-Online energy label (default: true)
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Returns: full BAG address, coordinates, municipality, province, energy label.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
### `omni.finance` — Financial utilities
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
// IBAN → BIC
|
|
85
|
+
const bic = await omni.finance.ibanToBic({ iban: "NL91ABNA0417164300" });
|
|
86
|
+
// result: { iban, bic, bank_name, country_code }
|
|
87
|
+
|
|
88
|
+
// VAT number verification (EU VIES)
|
|
89
|
+
const vat = await omni.finance.vatVerify({
|
|
90
|
+
countryCode: "NL",
|
|
91
|
+
vatNumber: "123456782B01",
|
|
92
|
+
});
|
|
93
|
+
// result: { valid, status, company_name, address, checked_at, … }
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
### `omni.compliance` — Compliance checks
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
// Validate a BSN or IBAN checksum
|
|
102
|
+
const result = await omni.compliance.validateFinance({
|
|
103
|
+
type: "iban", // "bsn" | "iban"
|
|
104
|
+
number: "NL91ABNA0417164300",
|
|
105
|
+
});
|
|
106
|
+
// result: { valid, type, number, algorithm, detail }
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
### `omni.hr` — HR calculations
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
// Statutory minimum wage (WML)
|
|
115
|
+
const wage = await omni.hr.minimumWage({ age: 21, date: "2024-07-01" });
|
|
116
|
+
// result: { age, date, hourly_eur, daily_eur, monthly_eur, law_reference }
|
|
117
|
+
|
|
118
|
+
// Holiday/public-holiday surcharge
|
|
119
|
+
const surcharge = await omni.hr.holidaySurcharge({
|
|
120
|
+
date: "2024-12-25",
|
|
121
|
+
industry: "retail",
|
|
122
|
+
});
|
|
123
|
+
// result: { is_holiday, holiday_name, surcharge_multiplier, … }
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
### `omni.realEstate` — Real estate
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
// EP-Online energy label
|
|
132
|
+
const label = await omni.realEstate.energyLabel({
|
|
133
|
+
postcode: "1012LG",
|
|
134
|
+
houseNumber: "1",
|
|
135
|
+
});
|
|
136
|
+
// result: { energy_label, label_class, registered_at, valid_until, … }
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
### `omni.logistics` — Logistics
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
// Zero-emission zone check
|
|
145
|
+
const ze = await omni.logistics.emissionZone({ kenteken: "AB123C" });
|
|
146
|
+
// result: { ze_compliant, fuel_types, euro_standard, zones_checked, … }
|
|
147
|
+
|
|
148
|
+
// NS train disruptions
|
|
149
|
+
const disruptions = await omni.logistics.transitDisruptions({ stationCode: "ASD" });
|
|
150
|
+
// result: { station_code, disruptions: [{ type, title, cause, start, end }], … }
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
### `omni.energy` — Energy grid
|
|
156
|
+
|
|
157
|
+
```ts
|
|
158
|
+
// ENTSO-E negative price / grid trigger
|
|
159
|
+
const grid = await omni.energy.gridTrigger(); // defaults to NL
|
|
160
|
+
// result: { negative_price, trigger, current_price_eur_mwh, period_start, … }
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
### `omni.webhooks` — Outbound webhooks
|
|
166
|
+
|
|
167
|
+
```ts
|
|
168
|
+
// Register
|
|
169
|
+
const wh = await omni.webhooks.register({
|
|
170
|
+
url: "https://example.com/hook",
|
|
171
|
+
events: ["quota.warning", "quota.exceeded"],
|
|
172
|
+
});
|
|
173
|
+
// result: { webhook_id, secret } ← store secret for HMAC verification
|
|
174
|
+
|
|
175
|
+
// List all
|
|
176
|
+
const { webhooks } = await omni.webhooks.list();
|
|
177
|
+
|
|
178
|
+
// Delete
|
|
179
|
+
await omni.webhooks.delete(wh.webhook_id);
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Error handling
|
|
185
|
+
|
|
186
|
+
All errors extend `OmniError`:
|
|
187
|
+
|
|
188
|
+
```ts
|
|
189
|
+
import {
|
|
190
|
+
OmniAuthError,
|
|
191
|
+
OmniNotFoundError,
|
|
192
|
+
OmniRateLimitError,
|
|
193
|
+
OmniUpstreamError,
|
|
194
|
+
OmniNetworkError,
|
|
195
|
+
} from "@omnizoek/sdk";
|
|
196
|
+
|
|
197
|
+
try {
|
|
198
|
+
const result = await omni.geo.enrichAddress({ postcode: "0000XX", houseNumber: "0" });
|
|
199
|
+
} catch (err) {
|
|
200
|
+
if (err instanceof OmniAuthError) console.error("Invalid API key");
|
|
201
|
+
if (err instanceof OmniNotFoundError) console.error("Address not found");
|
|
202
|
+
if (err instanceof OmniRateLimitError) console.error("Rate limited — retry after", err.retryAfterMs, "ms");
|
|
203
|
+
if (err instanceof OmniUpstreamError) console.error("Upstream data source unavailable");
|
|
204
|
+
if (err instanceof OmniNetworkError) console.error("Network error", err.cause);
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Client options
|
|
211
|
+
|
|
212
|
+
```ts
|
|
213
|
+
const omni = new OmniClient({
|
|
214
|
+
apiKey: "omni_live_…", // required
|
|
215
|
+
baseUrl: "https://api.omnizoek.nl", // optional override
|
|
216
|
+
maxRetries: 3, // max 429 retries (default: 3)
|
|
217
|
+
retryDelayMs: 500, // base back-off delay (default: 500 ms)
|
|
218
|
+
timeoutMs: 20_000, // request timeout (default: 20 s)
|
|
219
|
+
});
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Requirements
|
|
225
|
+
|
|
226
|
+
- **Node.js ≥ 18** (native `fetch`)
|
|
227
|
+
- Browsers and edge runtimes with `fetch` support
|
|
228
|
+
- TypeScript 5.x (optional, for types)
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## License
|
|
233
|
+
|
|
234
|
+
MIT — see [LICENSE](LICENSE).
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __esm = (fn, res) => function __init() {
|
|
6
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
7
|
+
};
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// src/errors.ts
|
|
14
|
+
var errors_exports = {};
|
|
15
|
+
__export(errors_exports, {
|
|
16
|
+
OmniAuthError: () => exports.OmniAuthError,
|
|
17
|
+
OmniError: () => exports.OmniError,
|
|
18
|
+
OmniNetworkError: () => exports.OmniNetworkError,
|
|
19
|
+
OmniNotFoundError: () => exports.OmniNotFoundError,
|
|
20
|
+
OmniRateLimitError: () => exports.OmniRateLimitError,
|
|
21
|
+
OmniUpstreamError: () => exports.OmniUpstreamError,
|
|
22
|
+
OmniValidationError: () => exports.OmniValidationError
|
|
23
|
+
});
|
|
24
|
+
exports.OmniError = void 0; exports.OmniAuthError = void 0; exports.OmniNotFoundError = void 0; exports.OmniValidationError = void 0; exports.OmniRateLimitError = void 0; exports.OmniUpstreamError = void 0; exports.OmniNetworkError = void 0;
|
|
25
|
+
var init_errors = __esm({
|
|
26
|
+
"src/errors.ts"() {
|
|
27
|
+
exports.OmniError = class extends Error {
|
|
28
|
+
constructor(message, status, code, detail) {
|
|
29
|
+
super(message);
|
|
30
|
+
this.status = status;
|
|
31
|
+
this.code = code;
|
|
32
|
+
this.detail = detail;
|
|
33
|
+
this.name = "OmniError";
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
exports.OmniAuthError = class extends exports.OmniError {
|
|
37
|
+
constructor(detail) {
|
|
38
|
+
super(`Authentication failed: ${detail}`, 401, "auth_error", detail);
|
|
39
|
+
this.name = "OmniAuthError";
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
exports.OmniNotFoundError = class extends exports.OmniError {
|
|
43
|
+
constructor(detail) {
|
|
44
|
+
super(`Not found: ${detail}`, 404, "not_found", detail);
|
|
45
|
+
this.name = "OmniNotFoundError";
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
exports.OmniValidationError = class extends exports.OmniError {
|
|
49
|
+
constructor(detail) {
|
|
50
|
+
super(`Validation error: ${detail}`, 422, "validation_error", detail);
|
|
51
|
+
this.name = "OmniValidationError";
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
exports.OmniRateLimitError = class extends exports.OmniError {
|
|
55
|
+
constructor(retryAfterMs) {
|
|
56
|
+
super(
|
|
57
|
+
`Rate limit exceeded. Retry after ${retryAfterMs}ms.`,
|
|
58
|
+
429,
|
|
59
|
+
"rate_limit",
|
|
60
|
+
`Retry after ${retryAfterMs}ms`
|
|
61
|
+
);
|
|
62
|
+
this.retryAfterMs = retryAfterMs;
|
|
63
|
+
this.name = "OmniRateLimitError";
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
exports.OmniUpstreamError = class extends exports.OmniError {
|
|
67
|
+
constructor(detail) {
|
|
68
|
+
super(`Upstream error: ${detail}`, 503, "upstream_error", detail);
|
|
69
|
+
this.name = "OmniUpstreamError";
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
exports.OmniNetworkError = class extends Error {
|
|
73
|
+
constructor(cause) {
|
|
74
|
+
super(`Network error: ${cause instanceof Error ? cause.message : String(cause)}`);
|
|
75
|
+
this.name = "OmniNetworkError";
|
|
76
|
+
if (cause instanceof Error) this.cause = cause;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// src/client.ts
|
|
83
|
+
init_errors();
|
|
84
|
+
var DEFAULT_BASE_URL = "https://api.omnizoek.nl";
|
|
85
|
+
var DEFAULT_MAX_RETRIES = 3;
|
|
86
|
+
var DEFAULT_RETRY_DELAY_MS = 500;
|
|
87
|
+
var DEFAULT_TIMEOUT_MS = 2e4;
|
|
88
|
+
function sleep(ms) {
|
|
89
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
90
|
+
}
|
|
91
|
+
var HttpClient = class {
|
|
92
|
+
constructor(options) {
|
|
93
|
+
this.apiKey = options.apiKey;
|
|
94
|
+
this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/$/, "");
|
|
95
|
+
this.maxRetries = options.maxRetries ?? DEFAULT_MAX_RETRIES;
|
|
96
|
+
this.retryDelayMs = options.retryDelayMs ?? DEFAULT_RETRY_DELAY_MS;
|
|
97
|
+
this.timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
98
|
+
}
|
|
99
|
+
async get(path, params) {
|
|
100
|
+
const url = new URL(this.baseUrl + path);
|
|
101
|
+
if (params) {
|
|
102
|
+
for (const [key, value] of Object.entries(params)) {
|
|
103
|
+
if (value !== void 0) {
|
|
104
|
+
url.searchParams.set(key, String(value));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
let attempt = 0;
|
|
109
|
+
while (true) {
|
|
110
|
+
let response;
|
|
111
|
+
try {
|
|
112
|
+
const controller = new AbortController();
|
|
113
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
114
|
+
response = await fetch(url.toString(), {
|
|
115
|
+
method: "GET",
|
|
116
|
+
headers: {
|
|
117
|
+
"X-API-Key": this.apiKey,
|
|
118
|
+
"Accept": "application/json",
|
|
119
|
+
"User-Agent": "@omnizoek/sdk/0.1.0"
|
|
120
|
+
},
|
|
121
|
+
signal: controller.signal
|
|
122
|
+
});
|
|
123
|
+
clearTimeout(timeoutId);
|
|
124
|
+
} catch (err) {
|
|
125
|
+
throw new exports.OmniNetworkError(err);
|
|
126
|
+
}
|
|
127
|
+
if (response.status === 429 && attempt < this.maxRetries) {
|
|
128
|
+
const retryAfter = Number(response.headers.get("Retry-After") ?? 0);
|
|
129
|
+
const delay = retryAfter > 0 ? retryAfter * 1e3 : this.retryDelayMs * Math.pow(2, attempt);
|
|
130
|
+
attempt++;
|
|
131
|
+
await sleep(delay);
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
if (!response.ok) {
|
|
135
|
+
await this._throwFromResponse(response);
|
|
136
|
+
}
|
|
137
|
+
return response.json();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
async post(path, body) {
|
|
141
|
+
let response;
|
|
142
|
+
try {
|
|
143
|
+
const controller = new AbortController();
|
|
144
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
145
|
+
response = await fetch(this.baseUrl + path, {
|
|
146
|
+
method: "POST",
|
|
147
|
+
headers: {
|
|
148
|
+
"X-API-Key": this.apiKey,
|
|
149
|
+
"Accept": "application/json",
|
|
150
|
+
"Content-Type": "application/json",
|
|
151
|
+
"User-Agent": "@omnizoek/sdk/0.1.0"
|
|
152
|
+
},
|
|
153
|
+
body: body !== void 0 ? JSON.stringify(body) : void 0,
|
|
154
|
+
signal: controller.signal
|
|
155
|
+
});
|
|
156
|
+
clearTimeout(timeoutId);
|
|
157
|
+
} catch (err) {
|
|
158
|
+
throw new exports.OmniNetworkError(err);
|
|
159
|
+
}
|
|
160
|
+
if (!response.ok) {
|
|
161
|
+
await this._throwFromResponse(response);
|
|
162
|
+
}
|
|
163
|
+
return response.json();
|
|
164
|
+
}
|
|
165
|
+
async delete(path) {
|
|
166
|
+
let response;
|
|
167
|
+
try {
|
|
168
|
+
const controller = new AbortController();
|
|
169
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
170
|
+
response = await fetch(this.baseUrl + path, {
|
|
171
|
+
method: "DELETE",
|
|
172
|
+
headers: {
|
|
173
|
+
"X-API-Key": this.apiKey,
|
|
174
|
+
"User-Agent": "@omnizoek/sdk/0.1.0"
|
|
175
|
+
},
|
|
176
|
+
signal: controller.signal
|
|
177
|
+
});
|
|
178
|
+
clearTimeout(timeoutId);
|
|
179
|
+
} catch (err) {
|
|
180
|
+
throw new exports.OmniNetworkError(err);
|
|
181
|
+
}
|
|
182
|
+
if (!response.ok) {
|
|
183
|
+
await this._throwFromResponse(response);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
async _throwFromResponse(response) {
|
|
187
|
+
let detail = response.statusText;
|
|
188
|
+
try {
|
|
189
|
+
const body = await response.json();
|
|
190
|
+
detail = body.detail ?? body.error ?? detail;
|
|
191
|
+
} catch {
|
|
192
|
+
}
|
|
193
|
+
switch (response.status) {
|
|
194
|
+
case 401:
|
|
195
|
+
throw new exports.OmniAuthError(detail);
|
|
196
|
+
case 404:
|
|
197
|
+
throw new exports.OmniNotFoundError(detail);
|
|
198
|
+
case 422:
|
|
199
|
+
throw new exports.OmniValidationError(detail);
|
|
200
|
+
case 429:
|
|
201
|
+
throw new exports.OmniRateLimitError(0);
|
|
202
|
+
case 503:
|
|
203
|
+
throw new exports.OmniUpstreamError(detail);
|
|
204
|
+
default: {
|
|
205
|
+
const { OmniError: OmniError2 } = await Promise.resolve().then(() => (init_errors(), errors_exports));
|
|
206
|
+
throw new OmniError2(
|
|
207
|
+
`API error ${response.status}: ${detail}`,
|
|
208
|
+
response.status,
|
|
209
|
+
"api_error",
|
|
210
|
+
detail
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
// src/geo.ts
|
|
218
|
+
var GeoModule = class {
|
|
219
|
+
constructor(http) {
|
|
220
|
+
this.http = http;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Enrich a Dutch address with BAG data, coordinates, neighbourhood
|
|
224
|
+
* statistics, energy labels and more.
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* const result = await omni.geo.enrichAddress({ postcode: "1012LG", houseNumber: 1 });
|
|
228
|
+
*/
|
|
229
|
+
async enrichAddress(params) {
|
|
230
|
+
return this.http.get("/v1/geo/enrich-address", {
|
|
231
|
+
postcode: params.postcode,
|
|
232
|
+
house_number: params.houseNumber
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
// src/finance.ts
|
|
238
|
+
var FinanceModule = class {
|
|
239
|
+
constructor(http) {
|
|
240
|
+
this.http = http;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Resolve an IBAN to its BIC/SWIFT code and bank name.
|
|
244
|
+
*
|
|
245
|
+
* @example
|
|
246
|
+
* const result = await omni.finance.ibanToBic({ iban: "NL91ABNA0417164300" });
|
|
247
|
+
*/
|
|
248
|
+
async ibanToBic(params) {
|
|
249
|
+
return this.http.get("/v1/finance/iban-to-bic", {
|
|
250
|
+
iban: params.iban
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Verify a Dutch BTW (VAT) number via the EU VIES service and return
|
|
255
|
+
* company metadata.
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* const result = await omni.finance.vatVerify({ vatNumber: "NL123456782B01" });
|
|
259
|
+
*/
|
|
260
|
+
async vatVerify(params) {
|
|
261
|
+
return this.http.get("/v1/finance/vat-verify", {
|
|
262
|
+
vat_number: params.vatNumber
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
// src/compliance.ts
|
|
268
|
+
var ComplianceModule = class {
|
|
269
|
+
constructor(http) {
|
|
270
|
+
this.http = http;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Validate a Dutch BSN or IBAN number using checksum algorithms.
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* const result = await omni.compliance.validateFinance({ type: "iban", number: "NL91ABNA0417164300" });
|
|
277
|
+
*/
|
|
278
|
+
async validateFinance(params) {
|
|
279
|
+
return this.http.get("/v1/compliance/validate-finance", {
|
|
280
|
+
type: params.type,
|
|
281
|
+
number: params.number
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
// src/hr.ts
|
|
287
|
+
var HrModule = class {
|
|
288
|
+
constructor(http) {
|
|
289
|
+
this.http = http;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Look up the current Dutch statutory minimum wage for a given age.
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* const result = await omni.hr.minimumWage({ age: 21 });
|
|
296
|
+
*/
|
|
297
|
+
async minimumWage(params) {
|
|
298
|
+
return this.http.get("/v1/hr/minimum-wage", {
|
|
299
|
+
age: params.age
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Check whether a given date is a public holiday (and get the applicable
|
|
304
|
+
* surcharge multiplier for a given industry).
|
|
305
|
+
*
|
|
306
|
+
* @example
|
|
307
|
+
* const result = await omni.hr.holidaySurcharge({ date: "2024-12-25", industry: "retail" });
|
|
308
|
+
*/
|
|
309
|
+
async holidaySurcharge(params) {
|
|
310
|
+
return this.http.get("/v1/hr/holiday-surcharge", {
|
|
311
|
+
date: params.date,
|
|
312
|
+
industry: params.industry
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
// src/realEstate.ts
|
|
318
|
+
var RealEstateModule = class {
|
|
319
|
+
constructor(http) {
|
|
320
|
+
this.http = http;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Retrieve the official EP-Online energy label for a Dutch address.
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* const result = await omni.realEstate.energyLabel({ postcode: "1012LG", houseNumber: 1 });
|
|
327
|
+
*/
|
|
328
|
+
async energyLabel(params) {
|
|
329
|
+
return this.http.get("/v1/real-estate/energy-label", {
|
|
330
|
+
postcode: params.postcode,
|
|
331
|
+
house_number: params.houseNumber
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
// src/logistics.ts
|
|
337
|
+
var LogisticsModule = class {
|
|
338
|
+
constructor(http) {
|
|
339
|
+
this.http = http;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Check whether a vehicle (by Dutch licence plate / kenteken) is allowed
|
|
343
|
+
* in a zero-emission zone (ZE-zone).
|
|
344
|
+
*
|
|
345
|
+
* @example
|
|
346
|
+
* const result = await omni.logistics.emissionZone({ kenteken: "AB123C" });
|
|
347
|
+
*/
|
|
348
|
+
async emissionZone(params) {
|
|
349
|
+
return this.http.get("/v1/logistics/emission-zone", {
|
|
350
|
+
kenteken: params.kenteken
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Retrieve current and upcoming NS train disruptions, optionally filtered
|
|
355
|
+
* by station code.
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* const result = await omni.logistics.transitDisruptions({ stationCode: "ASD" });
|
|
359
|
+
*/
|
|
360
|
+
async transitDisruptions(params) {
|
|
361
|
+
return this.http.get("/v1/logistics/transit-disruptions", {
|
|
362
|
+
station_code: params?.stationCode
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
// src/energy.ts
|
|
368
|
+
var EnergyModule = class {
|
|
369
|
+
constructor(http) {
|
|
370
|
+
this.http = http;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Retrieve the current Dutch electricity grid congestion status for a
|
|
374
|
+
* given postal code / province.
|
|
375
|
+
*
|
|
376
|
+
* @example
|
|
377
|
+
* const result = await omni.energy.gridTrigger();
|
|
378
|
+
* const result = await omni.energy.gridTrigger({ countryCode: "NL" });
|
|
379
|
+
*/
|
|
380
|
+
async gridTrigger(params) {
|
|
381
|
+
return this.http.get("/v1/energy/grid-trigger", {
|
|
382
|
+
country_code: params?.countryCode
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
// src/webhooks.ts
|
|
388
|
+
var WebhooksModule = class {
|
|
389
|
+
constructor(http) {
|
|
390
|
+
this.http = http;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Register a new outbound webhook. OmniZoek will POST to `url` whenever
|
|
394
|
+
* any of the specified `events` fire.
|
|
395
|
+
*
|
|
396
|
+
* @example
|
|
397
|
+
* const wh = await omni.webhooks.register({
|
|
398
|
+
* url: "https://example.com/hook",
|
|
399
|
+
* events: ["quota.warning"],
|
|
400
|
+
* });
|
|
401
|
+
*/
|
|
402
|
+
async register(params) {
|
|
403
|
+
return this.http.post("/v1/webhooks", {
|
|
404
|
+
url: params.url,
|
|
405
|
+
events: params.events
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* List all registered webhooks for this API key.
|
|
410
|
+
*
|
|
411
|
+
* @example
|
|
412
|
+
* const { webhooks } = await omni.webhooks.list();
|
|
413
|
+
*/
|
|
414
|
+
async list() {
|
|
415
|
+
return this.http.get("/v1/webhooks");
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Delete a webhook by its ID.
|
|
419
|
+
*
|
|
420
|
+
* @example
|
|
421
|
+
* await omni.webhooks.delete("wh_abc123");
|
|
422
|
+
*/
|
|
423
|
+
async delete(webhookId) {
|
|
424
|
+
return this.http.delete(`/v1/webhooks/${encodeURIComponent(webhookId)}`);
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
// src/OmniClient.ts
|
|
429
|
+
var OmniClient = class {
|
|
430
|
+
constructor(options) {
|
|
431
|
+
const http = new HttpClient(options);
|
|
432
|
+
this.geo = new GeoModule(http);
|
|
433
|
+
this.finance = new FinanceModule(http);
|
|
434
|
+
this.compliance = new ComplianceModule(http);
|
|
435
|
+
this.hr = new HrModule(http);
|
|
436
|
+
this.realEstate = new RealEstateModule(http);
|
|
437
|
+
this.logistics = new LogisticsModule(http);
|
|
438
|
+
this.energy = new EnergyModule(http);
|
|
439
|
+
this.webhooks = new WebhooksModule(http);
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
// src/index.ts
|
|
444
|
+
init_errors();
|
|
445
|
+
|
|
446
|
+
exports.OmniClient = OmniClient;
|
|
447
|
+
//# sourceMappingURL=index.cjs.map
|
|
448
|
+
//# sourceMappingURL=index.cjs.map
|