@geolonia/geonicdb-sdk 0.6.0 → 0.7.1

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.
Files changed (3) hide show
  1. package/README.md +23 -0
  2. package/geonicdb.d.ts +28 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -33,6 +33,29 @@ await db.createEntity({
33
33
  });
34
34
  ```
35
35
 
36
+ ### TypeScript
37
+
38
+ The SDK ships type definitions (`geonicdb.d.ts`) in the published package. Named imports of error classes and types resolve cleanly even under strict tsconfig settings (`strict`, `verbatimModuleSyntax`, etc.):
39
+
40
+ ```typescript
41
+ import GeonicDB, {
42
+ AuthorizationError,
43
+ AuthenticationError,
44
+ type EntityEvent,
45
+ type RefreshedCredentials,
46
+ } from '@geolonia/geonicdb-sdk';
47
+
48
+ try {
49
+ await db.deleteEntity(entityId);
50
+ } catch (err) {
51
+ if (err instanceof AuthorizationError) {
52
+ // Type-safe branch on XACML denial.
53
+ }
54
+ }
55
+ ```
56
+
57
+ See **Error Handling** below for the full list of exported error classes.
58
+
36
59
  ### Browser (script tag)
37
60
 
38
61
  ```html
package/geonicdb.d.ts CHANGED
@@ -1,2 +1,28 @@
1
- export { GeonicDB, GeonicDB as default } from './index';
2
- export type { GeonicDBOptions, CredentialsOptions, RefreshedCredentials, GetEntitiesParams, SubscribeOptions, EntityEvent, ReconnectingEvent, LoginResponse, GeonicDBEventMap } from './index';
1
+ export {
2
+ AuthenticationError,
3
+ AuthorizationError,
4
+ ConflictError,
5
+ GeonicDB,
6
+ GeonicDBError,
7
+ NetworkError,
8
+ NotFoundError,
9
+ RateLimitError,
10
+ ValidationError,
11
+ } from './index';
12
+ export type {
13
+ CacheEvent,
14
+ CountEntitiesParams,
15
+ CredentialsOptions,
16
+ EntityEvent,
17
+ GeonicDBEventMap,
18
+ GeonicDBOptions,
19
+ GetEntitiesParams,
20
+ GetTemporalEntitiesParams,
21
+ LoginResponse,
22
+ PollHandle,
23
+ PollOptions,
24
+ ReconnectingEvent,
25
+ RefreshedCredentials,
26
+ SubscribeOptions,
27
+ } from './index';
28
+ export { default } from './index';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geolonia/geonicdb-sdk",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
4
4
  "description": "GeonicDB JavaScript SDK — NGSI-LD Context Broker client for browser and Node.js",
5
5
  "main": "geonicdb.cjs",
6
6
  "module": "geonicdb.mjs",