@geolonia/geonicdb-sdk 0.16.0 → 0.17.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 +39 -8
- package/geonicdb.cjs +28 -8
- package/geonicdb.cjs.map +2 -2
- package/geonicdb.d.ts +115 -10
- package/geonicdb.iife.js +28 -8
- package/geonicdb.iife.js.map +2 -2
- package/geonicdb.mjs +28 -8
- package/geonicdb.mjs.map +2 -2
- package/package.json +1 -1
- package/react/index.d.ts +115 -10
package/package.json
CHANGED
package/react/index.d.ts
CHANGED
|
@@ -105,6 +105,12 @@ export interface GetEntitiesParams {
|
|
|
105
105
|
geometry?: string;
|
|
106
106
|
/** Coordinates string (semicolon-delimited pairs or flat comma-separated) */
|
|
107
107
|
coordinates?: string;
|
|
108
|
+
/**
|
|
109
|
+
* 多重属性のインスタンス絞り込み (`datasetId` クエリ、ETSI GS CIM 009 clause 4.5.5.1)。
|
|
110
|
+
* カンマ区切りで複数指定可。既定インスタンスは `@none`。一致が 1 件なら単一要素、
|
|
111
|
+
* 0 件ならその属性は応答から落ちる。
|
|
112
|
+
*/
|
|
113
|
+
datasetId?: string;
|
|
108
114
|
/** Comma-separated attribute names to retrieve */
|
|
109
115
|
attrs?: string;
|
|
110
116
|
/** Comma-separated attribute names to keep (alternative to attrs) */
|
|
@@ -126,13 +132,24 @@ export interface GetEntitiesParams {
|
|
|
126
132
|
/**
|
|
127
133
|
* NGSI-LD representation options (`options` query param)。カンマ区切りで複数指定可。
|
|
128
134
|
* - `sysAttrs` — システム属性 (`createdAt` / `modifiedAt`) を含める
|
|
129
|
-
* - `keyValues` — 簡易表現 (属性を値だけに圧縮)
|
|
135
|
+
* - `keyValues` — 簡易表現 (属性を値だけに圧縮)。多重属性 (`datasetId` 付きインスタンス) は
|
|
136
|
+
* 一致が複数のときだけ `dataset` マップになる (既定インスタンスのキーは `@none`)。
|
|
137
|
+
* 1 件なら素の値 (ETSI GS CIM 009 clause 4.5.4 / 4.5.5.1)
|
|
130
138
|
* - `concise` — concise 表現
|
|
131
139
|
* - `normalized` — 正規化表現 (デフォルト)
|
|
132
140
|
*
|
|
133
141
|
* 例: `'sysAttrs'`, `'keyValues,sysAttrs'`。
|
|
134
142
|
*/
|
|
135
143
|
options?: string;
|
|
144
|
+
/**
|
|
145
|
+
* ローカルスコープに限定する (`local` クエリパラメータ、ETSI GS CIM 009 clause 5.5.13 / Table 6.3.18-1)。
|
|
146
|
+
*
|
|
147
|
+
* **#2278**: `GET /ngsi-ld/v1/entities` は clause 5.7.2.4 により
|
|
148
|
+
* `type` / `attrs` (非システム属性を含む) / `q` (非システム属性を含む) / geoquery / local scope の
|
|
149
|
+
* いずれかを必須とする。**絞り込み無しで全件を取りたい場合は `local: true` を指定する**
|
|
150
|
+
* (指定しないと `400 BadRequestData` = too wide query)。
|
|
151
|
+
*/
|
|
152
|
+
local?: boolean;
|
|
136
153
|
}
|
|
137
154
|
/** Parameters for counting entities. */
|
|
138
155
|
export interface CountEntitiesParams {
|
|
@@ -142,15 +159,42 @@ export interface CountEntitiesParams {
|
|
|
142
159
|
q?: string;
|
|
143
160
|
/** NGSI-LD scope query expression (#1132) */
|
|
144
161
|
scopeQ?: string;
|
|
162
|
+
/**
|
|
163
|
+
* ローカルスコープに限定する (`local` クエリパラメータ、ETSI GS CIM 009 clause 5.5.13 / Table 6.3.18-1)。
|
|
164
|
+
*
|
|
165
|
+
* **#2278**: `GET /ngsi-ld/v1/entities` は clause 5.7.2.4 により
|
|
166
|
+
* `type` / `attrs` (非システム属性を含む) / `q` (非システム属性を含む) / geoquery / local scope の
|
|
167
|
+
* いずれかを必須とする。**絞り込み無しで全件を取りたい場合は `local: true` を指定する**
|
|
168
|
+
* (指定しないと `400 BadRequestData` = too wide query)。
|
|
169
|
+
*/
|
|
170
|
+
local?: boolean;
|
|
145
171
|
}
|
|
146
172
|
/** Options for subscribing to entity events via WebSocket. */
|
|
147
173
|
export interface SubscribeOptions {
|
|
148
|
-
/**
|
|
174
|
+
/**
|
|
175
|
+
* Entity types to subscribe to.
|
|
176
|
+
*
|
|
177
|
+
* **#2055.** Matched against the canonical stored form: the supplied `@context` is
|
|
178
|
+
* resolved once at `subscribe` time and these names are expanded before matching,
|
|
179
|
+
* so a term defined by a custom `@context` changes which entities match.
|
|
180
|
+
*/
|
|
149
181
|
entityTypes?: string[];
|
|
150
|
-
/** Entity ID regex pattern */
|
|
182
|
+
/** Entity ID regex pattern. Matched against the stored form verbatim (no `@context` expansion). */
|
|
151
183
|
idPattern?: string;
|
|
152
184
|
/** NGSI-LD scope query expression (#1132). Server-side filter; only events whose entity scope matches are delivered. */
|
|
153
185
|
scopeQ?: string;
|
|
186
|
+
/**
|
|
187
|
+
* JSON-LD `@context` used to render delivered events (#2026).
|
|
188
|
+
*
|
|
189
|
+
* The entity type and attribute names are compacted against it (ETSI GS CIM 009 clause 5.5.7)
|
|
190
|
+
* and the value is echoed back in each event's `@context`. Omit for the core `@context`.
|
|
191
|
+
* URL string / array of URL strings only — inline context objects are rejected.
|
|
192
|
+
*
|
|
193
|
+
* **#2055: it also governs `entityTypes` matching** — the context is resolved once at
|
|
194
|
+
* `subscribe` time to expand `entityTypes` into the canonical stored form. `idPattern`
|
|
195
|
+
* alone is matched against the stored form verbatim.
|
|
196
|
+
*/
|
|
197
|
+
"@context"?: string | string[];
|
|
154
198
|
}
|
|
155
199
|
/** Entity event received via WebSocket. */
|
|
156
200
|
export interface EntityEvent {
|
|
@@ -162,14 +206,20 @@ export interface EntityEvent {
|
|
|
162
206
|
servicePath: string;
|
|
163
207
|
/** Entity ID */
|
|
164
208
|
entityId: string;
|
|
165
|
-
/** Entity type */
|
|
209
|
+
/** Entity type, compacted with the subscription `@context` (#2026) */
|
|
166
210
|
entityType: string;
|
|
167
|
-
/**
|
|
211
|
+
/**
|
|
212
|
+
* Entity attributes in NGSI-LD normalized representation (clause 4.5.2, #2026 / #2044).
|
|
213
|
+
* Attribute names are compacted with the subscription `@context`; sub-attributes are inline;
|
|
214
|
+
* multi-attributes appear as an instance array carrying `datasetId` (clause 4.5.5).
|
|
215
|
+
*/
|
|
168
216
|
data: Record<string, unknown>;
|
|
169
217
|
/** Complete NGSI-LD entity (id + type + attributes from data). Undefined when data is unavailable (e.g. some delete events). */
|
|
170
218
|
entity?: Record<string, unknown>;
|
|
171
219
|
/** Changed attribute names (update only) */
|
|
172
220
|
changedAttributes?: string[];
|
|
221
|
+
/** Vocabulary the names in this event were rendered with (#2026) */
|
|
222
|
+
"@context"?: string | string[];
|
|
173
223
|
/** ISO 8601 timestamp */
|
|
174
224
|
timestamp: string;
|
|
175
225
|
}
|
|
@@ -237,6 +287,14 @@ export interface GeonicDBEventMap {
|
|
|
237
287
|
};
|
|
238
288
|
disconnected: undefined;
|
|
239
289
|
reconnecting: ReconnectingEvent;
|
|
290
|
+
/**
|
|
291
|
+
* #2055: 購読フィルタがサーバ側で有効になった (`{"type":"subscribed"}` の受信)。
|
|
292
|
+
*
|
|
293
|
+
* `subscribe()` の適用は非同期 — サーバは渡された `@context` を解決して `entityTypes` を
|
|
294
|
+
* 照合用の canonical 形へ展開する (ETSI GS CIM 009 clause 5.5.7)。このイベントより前に
|
|
295
|
+
* 発生した更新は配信が保証されない。
|
|
296
|
+
*/
|
|
297
|
+
subscribed: undefined;
|
|
240
298
|
error: Error;
|
|
241
299
|
message: Record<string, unknown>;
|
|
242
300
|
tokenRefresh: RefreshedCredentials;
|
|
@@ -275,13 +333,46 @@ export interface GetTemporalEntitiesParams {
|
|
|
275
333
|
offset?: number;
|
|
276
334
|
/**
|
|
277
335
|
* NGSI-LD representation options (`options` query param)。カンマ区切りで複数指定可。
|
|
278
|
-
* - `sysAttrs` — システム属性 (`createdAt` / `modifiedAt`) を含める
|
|
279
336
|
* - `temporalValues` — 時系列を簡易配列表現で返す
|
|
280
|
-
* - `
|
|
337
|
+
* - `simplified` — `temporalValues` の同義語 (GeonicDB 拡張)
|
|
338
|
+
* - `aggregatedValues` — 集約表現で返す (ETSI clause 4.5.19 の「メソッド名をキー +
|
|
339
|
+
* [値, 開始, 終了] の 3 要素配列」形。#1815 で独自形から是正)
|
|
340
|
+
* - `sysAttrs` — システム時相属性 (`createdAt` / `modifiedAt`、TTL 設定時は `expiresAt`) を
|
|
341
|
+
* normalized 表現の各インスタンスへ含める (ETSI 6.3.11、#1817)。簡易表現・集約表現には
|
|
342
|
+
* 載せる場所が無いため受理して無視される (400 にはならない)
|
|
281
343
|
*
|
|
282
|
-
*
|
|
344
|
+
* 注:
|
|
345
|
+
* - この SDK では `aggregatedValues` は `options` で指定し、`aggrMethods` との併用が必須
|
|
346
|
+
* - サーバ側では `format=aggregatedValues` に対しても同じ必須条件が適用される
|
|
347
|
+
* - `options` は ETSI 6.3.12 で deprecated。`format` を併用した場合は **`format` が優先される**
|
|
348
|
+
*
|
|
349
|
+
* 例: `'temporalValues'`, `'aggregatedValues'`。
|
|
283
350
|
*/
|
|
284
351
|
options?: string;
|
|
352
|
+
/**
|
|
353
|
+
* #1814: 表現形式 (`format` query param、ETSI GS CIM 009 clause 6.3.12)。
|
|
354
|
+
* `'temporalValues'` / `'aggregatedValues'` のいずれか (`'simplified'` は `'temporalValues'` の
|
|
355
|
+
* 別名として受理される GeonicDB 拡張)。**未知値はサーバが 400 InvalidRequest で拒否する。**
|
|
356
|
+
* `options` と併用した場合は **`format` が優先される**。
|
|
357
|
+
*
|
|
358
|
+
* SDK は npm 向けに単独ビルドされ本体の `@config/defaults` を import しないため、
|
|
359
|
+
* 許可値はここでリテラル union として持つ。**本体の
|
|
360
|
+
* `NGSI_LD.TEMPORAL_REPRESENTATION_FORMATS` を変えたらこの union も同期すること**
|
|
361
|
+
* (SDK Consistency)。
|
|
362
|
+
*/
|
|
363
|
+
format?: "temporalValues" | "aggregatedValues" | "simplified";
|
|
364
|
+
/**
|
|
365
|
+
* #1815: 集約メソッド (カンマ区切り)。`totalCount` / `distinctCount` / `sum` / `avg` / `min` /
|
|
366
|
+
* `max` / `stddev` / `sumsq`。`aggregatedValues` を `format` か `options` で指定する場合は必須。
|
|
367
|
+
* 応答は clause 4.5.19 形 (メソッド名がキー、各期間は `[値, 開始, 終了]` の 3 要素配列)。
|
|
368
|
+
*/
|
|
369
|
+
aggrMethods?: string;
|
|
370
|
+
/**
|
|
371
|
+
* 集約期間 (ISO 8601 duration。例 `'PT1H'`)。
|
|
372
|
+
* ETSI GS CIM 009 Table 5.2.21-1 の cardinality は 0..1 で**任意**。省略時は `PT0S` として
|
|
373
|
+
* 扱われ、クエリの時間範囲全体が 1 期間として集約される (clause 4.5.19.1)。
|
|
374
|
+
*/
|
|
375
|
+
aggrPeriodDuration?: string;
|
|
285
376
|
}
|
|
286
377
|
/**
|
|
287
378
|
* `GET /ngsi-ld/v1/types`(`details` 未指定)のレスポンス。
|
|
@@ -454,8 +545,22 @@ declare class GeonicDB extends EventEmitter {
|
|
|
454
545
|
getTemporalEntity(entityId: string): Promise<Record<string, unknown>>;
|
|
455
546
|
/** Create multiple entities in a single request. */
|
|
456
547
|
batchCreate(entities: Record<string, unknown>[]): Promise<Record<string, unknown>>;
|
|
457
|
-
/**
|
|
458
|
-
|
|
548
|
+
/**
|
|
549
|
+
* Upsert multiple entities in a single request.
|
|
550
|
+
*
|
|
551
|
+
* #1742: the server follows ETSI GS CIM 009 clause 5.6.8.5 / Table 6.15.3.1-1:
|
|
552
|
+
* - **201** with a `string[]` of the **created** entity IDs, when at least one entity
|
|
553
|
+
* was newly created and none failed (merely updated entities are not listed);
|
|
554
|
+
* - **204** with no body, when every entity already existed and was updated
|
|
555
|
+
* (`_jsonPost` maps this to `{}`);
|
|
556
|
+
* - **207** with a `BatchOperationResult` (`{ created, updated, errors }`), on partial
|
|
557
|
+
* or total failure.
|
|
558
|
+
*
|
|
559
|
+
* The return type reflects all three shapes. Narrow with `Array.isArray(result)` to
|
|
560
|
+
* detect the "something was created" case.
|
|
561
|
+
* https://cim.etsi.org/NGSI-LD/official/clause-6.html
|
|
562
|
+
*/
|
|
563
|
+
batchUpsert(entities: Record<string, unknown>[]): Promise<string[] | Record<string, unknown>>;
|
|
459
564
|
/** Update multiple entities in a single request. */
|
|
460
565
|
batchUpdate(entities: Record<string, unknown>[]): Promise<Record<string, unknown>>;
|
|
461
566
|
/** Delete multiple entities by ID. */
|