@geolonia/geonicdb-sdk 0.21.0 → 0.22.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geolonia/geonicdb-sdk",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
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",
package/react/index.d.ts CHANGED
@@ -42,6 +42,18 @@ export interface GeonicDBOptions {
42
42
  */
43
43
  anonymous?: boolean;
44
44
  }
45
+ /**
46
+ * Options for {@link GeonicDB.request} and `requestRaw` (#3322).
47
+ *
48
+ * `headers` overrides the SDK defaults `Content-Type` / `Accept`
49
+ * (header names are matched case-insensitively; the caller's spelling is sent).
50
+ * `Authorization`, `DPoP`, `Fiware-Service`, and `NGSILD-Tenant` (any casing)
51
+ * are reserved and throw `TypeError` — the SDK sets those itself.
52
+ * A GET or HEAD that includes `headers` skips the ETag cache and in-flight dedup.
53
+ */
54
+ export interface RequestOptions {
55
+ headers?: Record<string, string>;
56
+ }
45
57
  /** Options for the SDK polling helper. */
46
58
  export interface PollOptions<T = unknown> {
47
59
  /** Polling interval in milliseconds (default: 5000). */
@@ -660,12 +672,12 @@ declare class GeonicDB extends EventEmitter {
660
672
  * 空だが、サーバ実装が `Content-Type: application/ld+json` を付けて返す
661
673
  * ケースがあり、そこで `res.json()` が SyntaxError を投げて止まっていた。
662
674
  */
663
- request(method: string, path: string, body?: unknown): Promise<unknown>;
675
+ request(method: string, path: string, body?: unknown, options?: RequestOptions): Promise<unknown>;
664
676
  /**
665
677
  * Make an authenticated API request and return the raw Response object.
666
678
  * Use this when you need access to response headers (e.g. NGSILD-Results-Count).
667
679
  */
668
- requestRaw(method: string, path: string, body?: unknown): Promise<Response>;
680
+ requestRaw(method: string, path: string, body?: unknown, options?: RequestOptions): Promise<Response>;
669
681
  /** Establish WebSocket connection (authentication is automatic). */
670
682
  connect(): Promise<void>;
671
683
  /** Force-reconnect (closes existing connection, preserves subscriptions). */