@geolonia/geonicdb-sdk 0.13.0 → 0.15.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 +57 -1
- package/geonicdb.cjs +38 -5
- package/geonicdb.cjs.map +2 -2
- package/geonicdb.d.ts +21 -0
- package/geonicdb.iife.js +38 -5
- package/geonicdb.iife.js.map +2 -2
- package/geonicdb.mjs +38 -5
- package/geonicdb.mjs.map +2 -2
- package/ngsi-v2/index.cjs +3 -0
- package/ngsi-v2/index.cjs.map +2 -2
- package/ngsi-v2/index.d.ts +6 -0
- package/ngsi-v2/index.mjs +3 -0
- package/ngsi-v2/index.mjs.map +2 -2
- package/package.json +1 -1
- package/react/index.d.ts +8 -1
package/ngsi-v2/index.cjs
CHANGED
|
@@ -62,6 +62,9 @@ var NgsiV2Client = class {
|
|
|
62
62
|
if (options?.offset !== void 0) sp.set("offset", String(options.offset));
|
|
63
63
|
if (options?.attrs) sp.set("attrs", options.attrs);
|
|
64
64
|
if (options?.options) sp.set("options", options.options);
|
|
65
|
+
if (options?.georel) sp.set("georel", options.georel);
|
|
66
|
+
if (options?.geometry) sp.set("geometry", options.geometry);
|
|
67
|
+
if (options?.coords) sp.set("coords", options.coords);
|
|
65
68
|
const qs = sp.toString();
|
|
66
69
|
return this.request("GET", `/v2/entities${qs ? "?" + qs : ""}`);
|
|
67
70
|
}
|
package/ngsi-v2/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/sdk/ngsi-v2/index.ts"],
|
|
4
|
-
"sourcesContent": ["// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Geolonia Inc.\n// See LICENSE in src/sdk/ for full license text.\n\n/**\n * NGSIv2 basic client \u2014 bundled per ADR\u8AD6\u70B92=a (\u6BBF\u88C1\u53EF\u78BA\u5B9A)\n *\n * Scope: basic entity CRUD only. No subscriptions, no batch ops.\n * For NGSI-LD, use the core GeonicDB client instead.\n */\n\nexport interface NgsiV2ClientConfig {\n baseUrl: string;\n /** FIWARE service (tenant) */\n service?: string;\n /** FIWARE service path */\n servicePath?: string;\n}\n\nexport interface NgsiV2Entity {\n id: string;\n type: string;\n [key: string]: string | NgsiV2Attribute | undefined;\n}\n\nexport interface NgsiV2Attribute {\n type: string;\n value: string | number | boolean | object | null;\n metadata?: Record<string, { type: string; value: unknown }>;\n}\n\nexport interface NgsiV2QueryOptions {\n type?: string;\n q?: string;\n limit?: number;\n offset?: number;\n attrs?: string;\n options?: string;\n}\n\nexport class NgsiV2Client {\n private baseUrl: string;\n private headers: Record<string, string>;\n\n constructor(config: NgsiV2ClientConfig) {\n this.baseUrl = config.baseUrl.replace(/\\/$/, '');\n this.headers = {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n };\n if (config.service) this.headers['Fiware-Service'] = config.service;\n if (config.servicePath) this.headers['Fiware-ServicePath'] = config.servicePath;\n }\n\n private async request<T>(method: string, path: string, body?: unknown): Promise<T> {\n const res = await fetch(`${this.baseUrl}${path}`, {\n method,\n headers: this.headers,\n body: body !== undefined ? JSON.stringify(body) : undefined,\n });\n if (!res.ok) {\n const err = await res.json().catch(() => ({ error: `HTTP ${res.status}` })) as Record<string, unknown>;\n const description = typeof err['description'] === 'string' ? err['description'] : undefined;\n const error = typeof err['error'] === 'string' ? err['error'] : undefined;\n throw new Error(description ?? error ?? `HTTP ${res.status}`);\n }\n if (res.status === 201 || res.status === 204) return undefined as T;\n return res.json() as Promise<T>;\n }\n\n /** List entities */\n async getEntities(options?: NgsiV2QueryOptions): Promise<NgsiV2Entity[]> {\n const sp = new URLSearchParams();\n if (options?.type) sp.set('type', options.type);\n if (options?.q) sp.set('q', options.q);\n if (options?.limit !== undefined) sp.set('limit', String(options.limit));\n if (options?.offset !== undefined) sp.set('offset', String(options.offset));\n if (options?.attrs) sp.set('attrs', options.attrs);\n if (options?.options) sp.set('options', options.options);\n const qs = sp.toString();\n return this.request<NgsiV2Entity[]>('GET', `/v2/entities${qs ? '?' + qs : ''}`);\n }\n\n /** Get single entity by ID */\n async getEntity(entityId: string, options?: { attrs?: string; options?: string }): Promise<NgsiV2Entity> {\n const sp = new URLSearchParams();\n if (options?.attrs) sp.set('attrs', options.attrs);\n if (options?.options) sp.set('options', options.options);\n const qs = sp.toString();\n return this.request<NgsiV2Entity>('GET', `/v2/entities/${encodeURIComponent(entityId)}${qs ? '?' + qs : ''}`);\n }\n\n /** Create entity */\n async createEntity(entity: NgsiV2Entity): Promise<void> {\n await this.request<void>('POST', '/v2/entities', entity);\n }\n\n /** Update entity attributes (partial) */\n async updateEntityAttributes(entityId: string, attrs: Record<string, NgsiV2Attribute>): Promise<void> {\n await this.request<void>('PATCH', `/v2/entities/${encodeURIComponent(entityId)}/attrs`, attrs);\n }\n\n /** Delete entity */\n async deleteEntity(entityId: string): Promise<void> {\n await this.request<void>('DELETE', `/v2/entities/${encodeURIComponent(entityId)}`);\n }\n}\n\nexport function createNgsiV2Client(config: NgsiV2ClientConfig): NgsiV2Client {\n return new NgsiV2Client(config);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Geolonia Inc.\n// See LICENSE in src/sdk/ for full license text.\n\n/**\n * NGSIv2 basic client \u2014 bundled per ADR\u8AD6\u70B92=a (\u6BBF\u88C1\u53EF\u78BA\u5B9A)\n *\n * Scope: basic entity CRUD only. No subscriptions, no batch ops.\n * For NGSI-LD, use the core GeonicDB client instead.\n */\n\nexport interface NgsiV2ClientConfig {\n baseUrl: string;\n /** FIWARE service (tenant) */\n service?: string;\n /** FIWARE service path */\n servicePath?: string;\n}\n\nexport interface NgsiV2Entity {\n id: string;\n type: string;\n [key: string]: string | NgsiV2Attribute | undefined;\n}\n\nexport interface NgsiV2Attribute {\n type: string;\n value: string | number | boolean | object | null;\n metadata?: Record<string, { type: string; value: unknown }>;\n}\n\nexport interface NgsiV2QueryOptions {\n type?: string;\n q?: string;\n limit?: number;\n offset?: number;\n attrs?: string;\n options?: string;\n /** Geo-relation (NGSIv2 / FIWARE Orion). Accepts compound form, e.g. 'near;maxDistance:1000' or 'coveredBy'. */\n georel?: string;\n /** Geometry type for the geo query. */\n geometry?: 'point' | 'line' | 'polygon' | 'box';\n /** WGS84 coordinate string, e.g. '35.6,139.7'. Semicolon-delimited pairs for multi-point geometries. */\n coords?: string;\n}\n\nexport class NgsiV2Client {\n private baseUrl: string;\n private headers: Record<string, string>;\n\n constructor(config: NgsiV2ClientConfig) {\n this.baseUrl = config.baseUrl.replace(/\\/$/, '');\n this.headers = {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n };\n if (config.service) this.headers['Fiware-Service'] = config.service;\n if (config.servicePath) this.headers['Fiware-ServicePath'] = config.servicePath;\n }\n\n private async request<T>(method: string, path: string, body?: unknown): Promise<T> {\n const res = await fetch(`${this.baseUrl}${path}`, {\n method,\n headers: this.headers,\n body: body !== undefined ? JSON.stringify(body) : undefined,\n });\n if (!res.ok) {\n const err = await res.json().catch(() => ({ error: `HTTP ${res.status}` })) as Record<string, unknown>;\n const description = typeof err['description'] === 'string' ? err['description'] : undefined;\n const error = typeof err['error'] === 'string' ? err['error'] : undefined;\n throw new Error(description ?? error ?? `HTTP ${res.status}`);\n }\n if (res.status === 201 || res.status === 204) return undefined as T;\n return res.json() as Promise<T>;\n }\n\n /** List entities */\n async getEntities(options?: NgsiV2QueryOptions): Promise<NgsiV2Entity[]> {\n const sp = new URLSearchParams();\n if (options?.type) sp.set('type', options.type);\n if (options?.q) sp.set('q', options.q);\n if (options?.limit !== undefined) sp.set('limit', String(options.limit));\n if (options?.offset !== undefined) sp.set('offset', String(options.offset));\n if (options?.attrs) sp.set('attrs', options.attrs);\n if (options?.options) sp.set('options', options.options);\n if (options?.georel) sp.set('georel', options.georel);\n if (options?.geometry) sp.set('geometry', options.geometry);\n if (options?.coords) sp.set('coords', options.coords);\n const qs = sp.toString();\n return this.request<NgsiV2Entity[]>('GET', `/v2/entities${qs ? '?' + qs : ''}`);\n }\n\n /** Get single entity by ID */\n async getEntity(entityId: string, options?: { attrs?: string; options?: string }): Promise<NgsiV2Entity> {\n const sp = new URLSearchParams();\n if (options?.attrs) sp.set('attrs', options.attrs);\n if (options?.options) sp.set('options', options.options);\n const qs = sp.toString();\n return this.request<NgsiV2Entity>('GET', `/v2/entities/${encodeURIComponent(entityId)}${qs ? '?' + qs : ''}`);\n }\n\n /** Create entity */\n async createEntity(entity: NgsiV2Entity): Promise<void> {\n await this.request<void>('POST', '/v2/entities', entity);\n }\n\n /** Update entity attributes (partial) */\n async updateEntityAttributes(entityId: string, attrs: Record<string, NgsiV2Attribute>): Promise<void> {\n await this.request<void>('PATCH', `/v2/entities/${encodeURIComponent(entityId)}/attrs`, attrs);\n }\n\n /** Delete entity */\n async deleteEntity(entityId: string): Promise<void> {\n await this.request<void>('DELETE', `/v2/entities/${encodeURIComponent(entityId)}`);\n }\n}\n\nexport function createNgsiV2Client(config: NgsiV2ClientConfig): NgsiV2Client {\n return new NgsiV2Client(config);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8CO,IAAM,eAAN,MAAmB;AAAA,EAIxB,YAAY,QAA4B;AAHxC,wBAAQ;AACR,wBAAQ;AAGN,SAAK,UAAU,OAAO,QAAQ,QAAQ,OAAO,EAAE;AAC/C,SAAK,UAAU;AAAA,MACb,gBAAgB;AAAA,MAChB,QAAQ;AAAA,IACV;AACA,QAAI,OAAO,QAAS,MAAK,QAAQ,gBAAgB,IAAI,OAAO;AAC5D,QAAI,OAAO,YAAa,MAAK,QAAQ,oBAAoB,IAAI,OAAO;AAAA,EACtE;AAAA,EAEA,MAAc,QAAW,QAAgB,MAAc,MAA4B;AACjF,UAAM,MAAM,MAA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AK,QAAwB,OAAO,eAAe,KAAK,MAAM,KAAK,EAAE,EAAE;AAAA,EAChF;AAAA;AAAA,EAGA,MAAM,UAAU,UAAkB,SAAuE;AACvG,UAAM,KAAK,IAAI,gBAAgB;AAC/B,QAAI,SAAS,MAAO,IAAG,IAAI,SAAS,QAAQ,KAAK;AACjD,QAAI,SAAS,QAAS,IAAG,IAAI,WAAW,QAAQ,OAAO;AACvD,UAAM,KAAK,GAAG,SAAS;AACvB,WAAO,KAAK,QAAsB,OAAO,gBAAgB,mBAAmB,QAAQ,CAAC,GAAG,KAAK,MAAM,KAAK,EAAE,EAAE;AAAA,EAC9G;AAAA;AAAA,EAGA,MAAM,aAAa,QAAqC;AACtD,UAAM,KAAK,QAAc,QAAQ,gBAAgB,MAAM;AAAA,EACzD;AAAA;AAAA,EAGA,MAAM,uBAAuB,UAAkB,OAAuD;AACpG,UAAM,KAAK,QAAc,SAAS,gBAAgB,mBAAmB,QAAQ,CAAC,UAAU,KAAK;AAAA,EAC/F;AAAA;AAAA,EAGA,MAAM,aAAa,UAAiC;AAClD,UAAM,KAAK,QAAc,UAAU,gBAAgB,mBAAmB,QAAQ,CAAC,EAAE;AAAA,EACnF;AACF;AAEO,SAAS,mBAAmB,QAA0C;AAC3E,SAAO,IAAI,aAAa,MAAM;AAChC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/ngsi-v2/index.d.ts
CHANGED
|
@@ -33,6 +33,12 @@ export interface NgsiV2QueryOptions {
|
|
|
33
33
|
offset?: number;
|
|
34
34
|
attrs?: string;
|
|
35
35
|
options?: string;
|
|
36
|
+
/** Geo-relation (NGSIv2 / FIWARE Orion). Accepts compound form, e.g. 'near;maxDistance:1000' or 'coveredBy'. */
|
|
37
|
+
georel?: string;
|
|
38
|
+
/** Geometry type for the geo query. */
|
|
39
|
+
geometry?: "point" | "line" | "polygon" | "box";
|
|
40
|
+
/** WGS84 coordinate string, e.g. '35.6,139.7'. Semicolon-delimited pairs for multi-point geometries. */
|
|
41
|
+
coords?: string;
|
|
36
42
|
}
|
|
37
43
|
export declare class NgsiV2Client {
|
|
38
44
|
private baseUrl;
|
package/ngsi-v2/index.mjs
CHANGED
|
@@ -39,6 +39,9 @@ var NgsiV2Client = class {
|
|
|
39
39
|
if (options?.offset !== void 0) sp.set("offset", String(options.offset));
|
|
40
40
|
if (options?.attrs) sp.set("attrs", options.attrs);
|
|
41
41
|
if (options?.options) sp.set("options", options.options);
|
|
42
|
+
if (options?.georel) sp.set("georel", options.georel);
|
|
43
|
+
if (options?.geometry) sp.set("geometry", options.geometry);
|
|
44
|
+
if (options?.coords) sp.set("coords", options.coords);
|
|
42
45
|
const qs = sp.toString();
|
|
43
46
|
return this.request("GET", `/v2/entities${qs ? "?" + qs : ""}`);
|
|
44
47
|
}
|
package/ngsi-v2/index.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/sdk/ngsi-v2/index.ts"],
|
|
4
|
-
"sourcesContent": ["// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Geolonia Inc.\n// See LICENSE in src/sdk/ for full license text.\n\n/**\n * NGSIv2 basic client \u2014 bundled per ADR\u8AD6\u70B92=a (\u6BBF\u88C1\u53EF\u78BA\u5B9A)\n *\n * Scope: basic entity CRUD only. No subscriptions, no batch ops.\n * For NGSI-LD, use the core GeonicDB client instead.\n */\n\nexport interface NgsiV2ClientConfig {\n baseUrl: string;\n /** FIWARE service (tenant) */\n service?: string;\n /** FIWARE service path */\n servicePath?: string;\n}\n\nexport interface NgsiV2Entity {\n id: string;\n type: string;\n [key: string]: string | NgsiV2Attribute | undefined;\n}\n\nexport interface NgsiV2Attribute {\n type: string;\n value: string | number | boolean | object | null;\n metadata?: Record<string, { type: string; value: unknown }>;\n}\n\nexport interface NgsiV2QueryOptions {\n type?: string;\n q?: string;\n limit?: number;\n offset?: number;\n attrs?: string;\n options?: string;\n}\n\nexport class NgsiV2Client {\n private baseUrl: string;\n private headers: Record<string, string>;\n\n constructor(config: NgsiV2ClientConfig) {\n this.baseUrl = config.baseUrl.replace(/\\/$/, '');\n this.headers = {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n };\n if (config.service) this.headers['Fiware-Service'] = config.service;\n if (config.servicePath) this.headers['Fiware-ServicePath'] = config.servicePath;\n }\n\n private async request<T>(method: string, path: string, body?: unknown): Promise<T> {\n const res = await fetch(`${this.baseUrl}${path}`, {\n method,\n headers: this.headers,\n body: body !== undefined ? JSON.stringify(body) : undefined,\n });\n if (!res.ok) {\n const err = await res.json().catch(() => ({ error: `HTTP ${res.status}` })) as Record<string, unknown>;\n const description = typeof err['description'] === 'string' ? err['description'] : undefined;\n const error = typeof err['error'] === 'string' ? err['error'] : undefined;\n throw new Error(description ?? error ?? `HTTP ${res.status}`);\n }\n if (res.status === 201 || res.status === 204) return undefined as T;\n return res.json() as Promise<T>;\n }\n\n /** List entities */\n async getEntities(options?: NgsiV2QueryOptions): Promise<NgsiV2Entity[]> {\n const sp = new URLSearchParams();\n if (options?.type) sp.set('type', options.type);\n if (options?.q) sp.set('q', options.q);\n if (options?.limit !== undefined) sp.set('limit', String(options.limit));\n if (options?.offset !== undefined) sp.set('offset', String(options.offset));\n if (options?.attrs) sp.set('attrs', options.attrs);\n if (options?.options) sp.set('options', options.options);\n const qs = sp.toString();\n return this.request<NgsiV2Entity[]>('GET', `/v2/entities${qs ? '?' + qs : ''}`);\n }\n\n /** Get single entity by ID */\n async getEntity(entityId: string, options?: { attrs?: string; options?: string }): Promise<NgsiV2Entity> {\n const sp = new URLSearchParams();\n if (options?.attrs) sp.set('attrs', options.attrs);\n if (options?.options) sp.set('options', options.options);\n const qs = sp.toString();\n return this.request<NgsiV2Entity>('GET', `/v2/entities/${encodeURIComponent(entityId)}${qs ? '?' + qs : ''}`);\n }\n\n /** Create entity */\n async createEntity(entity: NgsiV2Entity): Promise<void> {\n await this.request<void>('POST', '/v2/entities', entity);\n }\n\n /** Update entity attributes (partial) */\n async updateEntityAttributes(entityId: string, attrs: Record<string, NgsiV2Attribute>): Promise<void> {\n await this.request<void>('PATCH', `/v2/entities/${encodeURIComponent(entityId)}/attrs`, attrs);\n }\n\n /** Delete entity */\n async deleteEntity(entityId: string): Promise<void> {\n await this.request<void>('DELETE', `/v2/entities/${encodeURIComponent(entityId)}`);\n }\n}\n\nexport function createNgsiV2Client(config: NgsiV2ClientConfig): NgsiV2Client {\n return new NgsiV2Client(config);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;
|
|
4
|
+
"sourcesContent": ["// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Geolonia Inc.\n// See LICENSE in src/sdk/ for full license text.\n\n/**\n * NGSIv2 basic client \u2014 bundled per ADR\u8AD6\u70B92=a (\u6BBF\u88C1\u53EF\u78BA\u5B9A)\n *\n * Scope: basic entity CRUD only. No subscriptions, no batch ops.\n * For NGSI-LD, use the core GeonicDB client instead.\n */\n\nexport interface NgsiV2ClientConfig {\n baseUrl: string;\n /** FIWARE service (tenant) */\n service?: string;\n /** FIWARE service path */\n servicePath?: string;\n}\n\nexport interface NgsiV2Entity {\n id: string;\n type: string;\n [key: string]: string | NgsiV2Attribute | undefined;\n}\n\nexport interface NgsiV2Attribute {\n type: string;\n value: string | number | boolean | object | null;\n metadata?: Record<string, { type: string; value: unknown }>;\n}\n\nexport interface NgsiV2QueryOptions {\n type?: string;\n q?: string;\n limit?: number;\n offset?: number;\n attrs?: string;\n options?: string;\n /** Geo-relation (NGSIv2 / FIWARE Orion). Accepts compound form, e.g. 'near;maxDistance:1000' or 'coveredBy'. */\n georel?: string;\n /** Geometry type for the geo query. */\n geometry?: 'point' | 'line' | 'polygon' | 'box';\n /** WGS84 coordinate string, e.g. '35.6,139.7'. Semicolon-delimited pairs for multi-point geometries. */\n coords?: string;\n}\n\nexport class NgsiV2Client {\n private baseUrl: string;\n private headers: Record<string, string>;\n\n constructor(config: NgsiV2ClientConfig) {\n this.baseUrl = config.baseUrl.replace(/\\/$/, '');\n this.headers = {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n };\n if (config.service) this.headers['Fiware-Service'] = config.service;\n if (config.servicePath) this.headers['Fiware-ServicePath'] = config.servicePath;\n }\n\n private async request<T>(method: string, path: string, body?: unknown): Promise<T> {\n const res = await fetch(`${this.baseUrl}${path}`, {\n method,\n headers: this.headers,\n body: body !== undefined ? JSON.stringify(body) : undefined,\n });\n if (!res.ok) {\n const err = await res.json().catch(() => ({ error: `HTTP ${res.status}` })) as Record<string, unknown>;\n const description = typeof err['description'] === 'string' ? err['description'] : undefined;\n const error = typeof err['error'] === 'string' ? err['error'] : undefined;\n throw new Error(description ?? error ?? `HTTP ${res.status}`);\n }\n if (res.status === 201 || res.status === 204) return undefined as T;\n return res.json() as Promise<T>;\n }\n\n /** List entities */\n async getEntities(options?: NgsiV2QueryOptions): Promise<NgsiV2Entity[]> {\n const sp = new URLSearchParams();\n if (options?.type) sp.set('type', options.type);\n if (options?.q) sp.set('q', options.q);\n if (options?.limit !== undefined) sp.set('limit', String(options.limit));\n if (options?.offset !== undefined) sp.set('offset', String(options.offset));\n if (options?.attrs) sp.set('attrs', options.attrs);\n if (options?.options) sp.set('options', options.options);\n if (options?.georel) sp.set('georel', options.georel);\n if (options?.geometry) sp.set('geometry', options.geometry);\n if (options?.coords) sp.set('coords', options.coords);\n const qs = sp.toString();\n return this.request<NgsiV2Entity[]>('GET', `/v2/entities${qs ? '?' + qs : ''}`);\n }\n\n /** Get single entity by ID */\n async getEntity(entityId: string, options?: { attrs?: string; options?: string }): Promise<NgsiV2Entity> {\n const sp = new URLSearchParams();\n if (options?.attrs) sp.set('attrs', options.attrs);\n if (options?.options) sp.set('options', options.options);\n const qs = sp.toString();\n return this.request<NgsiV2Entity>('GET', `/v2/entities/${encodeURIComponent(entityId)}${qs ? '?' + qs : ''}`);\n }\n\n /** Create entity */\n async createEntity(entity: NgsiV2Entity): Promise<void> {\n await this.request<void>('POST', '/v2/entities', entity);\n }\n\n /** Update entity attributes (partial) */\n async updateEntityAttributes(entityId: string, attrs: Record<string, NgsiV2Attribute>): Promise<void> {\n await this.request<void>('PATCH', `/v2/entities/${encodeURIComponent(entityId)}/attrs`, attrs);\n }\n\n /** Delete entity */\n async deleteEntity(entityId: string): Promise<void> {\n await this.request<void>('DELETE', `/v2/entities/${encodeURIComponent(entityId)}`);\n }\n}\n\nexport function createNgsiV2Client(config: NgsiV2ClientConfig): NgsiV2Client {\n return new NgsiV2Client(config);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;AA8CO,IAAM,eAAN,MAAmB;AAAA,EAIxB,YAAY,QAA4B;AAHxC,wBAAQ;AACR,wBAAQ;AAGN,SAAK,UAAU,OAAO,QAAQ,QAAQ,OAAO,EAAE;AAC/C,SAAK,UAAU;AAAA,MACb,gBAAgB;AAAA,MAChB,QAAQ;AAAA,IACV;AACA,QAAI,OAAO,QAAS,MAAK,QAAQ,gBAAgB,IAAI,OAAO;AAC5D,QAAI,OAAO,YAAa,MAAK,QAAQ,oBAAoB,IAAI,OAAO;AAAA,EACtE;AAAA,EAEA,MAAc,QAAW,QAAgB,MAAc,MAA4B;AACjF,UAAM,MAAM,MAAM,MAAM,GAAG,KAAK,OAAO,GAAG,IAAI,IAAI;AAAA,MAChD;AAAA,MACA,SAAS,KAAK;AAAA,MACd,MAAM,SAAS,SAAY,KAAK,UAAU,IAAI,IAAI;AAAA,IACpD,CAAC;AACD,QAAI,CAAC,IAAI,IAAI;AACX,YAAM,MAAM,MAAM,IAAI,KAAK,EAAE,MAAM,OAAO,EAAE,OAAO,QAAQ,IAAI,MAAM,GAAG,EAAE;AAC1E,YAAM,cAAc,OAAO,IAAI,aAAa,MAAM,WAAW,IAAI,aAAa,IAAI;AAClF,YAAM,QAAQ,OAAO,IAAI,OAAO,MAAM,WAAW,IAAI,OAAO,IAAI;AAChE,YAAM,IAAI,MAAM,eAAe,SAAS,QAAQ,IAAI,MAAM,EAAE;AAAA,IAC9D;AACA,QAAI,IA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AA,EAGA,MAAM,uBAAuB,UAAkB,OAAuD;AACpG,UAAM,KAAK,QAAc,SAAS,gBAAgB,mBAAmB,QAAQ,CAAC,UAAU,KAAK;AAAA,EAC/F;AAAA;AAAA,EAGA,MAAM,aAAa,UAAiC;AAClD,UAAM,KAAK,QAAc,UAAU,gBAAgB,mBAAmB,QAAQ,CAAC,EAAE;AAAA,EACnF;AACF;AAEO,SAAS,mBAAmB,QAA0C;AAC3E,SAAO,IAAI,aAAa,MAAM;AAChC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
package/react/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v9.5.1
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/// <reference types="react" />
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Copyright (c) 2026 Geolonia Inc.
|
|
@@ -197,6 +197,13 @@ export interface LoginOptions {
|
|
|
197
197
|
* be sender-constrained, so it is not persisted.
|
|
198
198
|
*/
|
|
199
199
|
rememberSession?: boolean;
|
|
200
|
+
/**
|
|
201
|
+
* #1532: 管理者発行の一時パスワードで初回ログインする際に、設定する新パスワードを同梱する。
|
|
202
|
+
* 一時パスワードでのログインは、これを付けないとサーバが `PasswordResetRequired` (409) を
|
|
203
|
+
* 返す。付けると、その場で新パスワードを設定して本トークンを発行する (単発型、再ログイン不要)。
|
|
204
|
+
* 通常のログインでは指定しない。
|
|
205
|
+
*/
|
|
206
|
+
newPassword?: string;
|
|
200
207
|
}
|
|
201
208
|
/** Response from the login endpoint. */
|
|
202
209
|
export interface LoginResponse {
|