ironflock 1.5.3 → 1.6.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/dist/index.d.ts CHANGED
@@ -5,6 +5,14 @@ import { StandardSchemaV1 } from '@standard-schema/spec';
5
5
  import { Subscription } from 'autobahn';
6
6
  import { tags } from 'typia';
7
7
 
8
+ /**
9
+ * Rejects a `latest` marker (or a legacy latest_flag predicate) in series
10
+ * query filters before the request reaches the backend: the series SQL path
11
+ * has no latest-per-entity mode and would generate invalid SQL. Read current
12
+ * values with getHistory and `filterAnd: [{ latest: true }]` instead.
13
+ */
14
+ export declare function assertNoLatestMarker(params: SeriesQueryParams | null | undefined): void;
15
+
8
16
  export declare type AuthPayload = {
9
17
  success: boolean;
10
18
  role: string;
@@ -87,9 +95,20 @@ export declare class ConsumedApp {
87
95
  * so caller code always sees the single-row shape.
88
96
  */
89
97
  subscribeToTable(tablename: string, handler: (...args: any[]) => void, options?: object): Promise<Subscription<any[], any, string> | undefined>;
90
- /** Queries history rows of a shared table or transform. */
98
+ /**
99
+ * Queries history rows of a shared table or transform. To read the CURRENT
100
+ * value(s), add the `latest` marker to the filters:
101
+ * `{ filterAnd: [{ latest: true }], limit: 100 }` — the provider's data
102
+ * backend derives the latest row per entity in SQL (the physical
103
+ * `latest_flag` column no longer exists).
104
+ */
91
105
  getHistory(tablename: string, queryParams?: TableQueryParams): Promise<unknown>;
92
- /** Queries down-sampled series history of a shared table (tables only — no series RPC exists for transforms). */
106
+ /**
107
+ * Queries down-sampled series history of a shared table (tables only — no
108
+ * series RPC exists for transforms). Series queries do not support the
109
+ * `latest` marker; use {@link getHistory} with
110
+ * `filterAnd: [{ latest: true }]` to read current values.
111
+ */
93
112
  getSeriesHistory(tablename: string, params: SeriesQueryParams): Promise<unknown>;
94
113
  /** Closes the underlying connection to the provider's realm. */
95
114
  close(): Promise<void>;
@@ -150,6 +169,10 @@ export declare class CrossbarConnection extends EventEmitter {
150
169
  private onOpen;
151
170
  private onClose;
152
171
  private handleManualReconnect;
172
+ /**
173
+ * Waits for an open session; `context` names the pending operation so the
174
+ * timeout error explains what could not be performed and why.
175
+ */
153
176
  private sessionWait;
154
177
  waitForConnection(): Promise<void | undefined>;
155
178
  getSession(): default_2.Session | undefined;
@@ -163,8 +186,8 @@ export declare class CrossbarConnection extends EventEmitter {
163
186
  private reregisterAll;
164
187
  register(topic: string, endpoint: default_2.RegisterEndpoint, options?: default_2.IRegisterOptions): Promise<default_2.IRegistration | undefined>;
165
188
  unregister(registration: default_2.Registration): Promise<void>;
166
- call<T>(procedure: string, args?: any[], kwargs?: object, options?: any): Promise<T | undefined>;
167
- publish(topic: string, args?: any[], kwargs?: object, options?: any): Promise<default_2.IPublication | undefined>;
189
+ call<T>(procedure: string, args?: any[], kwargs?: object, options?: any): Promise<T>;
190
+ publish(topic: string, args?: any[], kwargs?: object, options?: any): Promise<default_2.IPublication>;
168
191
  }
169
192
 
170
193
  export declare type Details = {
@@ -297,13 +320,38 @@ export declare class IronFlock {
297
320
  /** @deprecated Use registerDeviceFunction() instead. */
298
321
  registerFunction(topic: string, endpoint: (...args: any[]) => any, options?: default_2.IRegisterOptions): Promise<default_2.IRegistration<any, any[], any, string> | undefined>;
299
322
  register(topic: string, endpoint: (...args: any[]) => any, options?: default_2.IRegisterOptions): Promise<default_2.IRegistration<any, any[], any, string> | undefined>;
323
+ /**
324
+ * Queries history rows of an own table or transform via
325
+ * `history.transformed.{tablename}`.
326
+ *
327
+ * To read the CURRENT value(s) instead of raw history, add the `latest`
328
+ * marker to `filterAnd`: `{ filterAnd: [{ latest: true }], limit: 100 }`.
329
+ * The data backend then derives the latest row per entity in SQL (the
330
+ * entity key is the table's `maintainLatestFlagFor` columns; without one,
331
+ * the single most recent row is returned). The former physical
332
+ * `latest_flag` column no longer exists.
333
+ *
334
+ * @throws {Error} on invalid parameters, when the history procedure is not
335
+ * registered (table missing / data backend down), or when the call fails.
336
+ */
300
337
  getHistory(tablename: string, queryParams?: TableQueryParams): Promise<unknown>;
301
338
  /**
302
339
  * Queries down-sampled series history of an own table by calling
303
340
  * `history.transformed.series.{tablename}` (tables only — no series RPC
304
- * exists for transforms).
341
+ * exists for transforms). Series queries do not support the `latest`
342
+ * marker; use {@link getHistory} with `filterAnd: [{ latest: true }]` to
343
+ * read current values.
344
+ *
345
+ * @throws {Error} on invalid parameters, when the series procedure is not
346
+ * registered (table missing / data backend down), or when the call fails.
305
347
  */
306
348
  getSeriesHistory(tablename: string, params: SeriesQueryParams): Promise<unknown>;
349
+ /**
350
+ * Updates the device's location in the platform master data.
351
+ *
352
+ * @throws {Error} on invalid coordinates or when the location service call
353
+ * fails (e.g. not connected).
354
+ */
307
355
  setDeviceLocation(long: number, lat: number): Promise<unknown>;
308
356
  /**
309
357
  * Public URL under which a declared port (port-template.yml) is reachable
@@ -370,6 +418,20 @@ export declare interface ISOTimeRange {
370
418
  end: string & tags.Format<"date-time">;
371
419
  }
372
420
 
421
+ /**
422
+ * Mode marker for `filterAnd`: requests "latest row per entity" instead of
423
+ * adding a WHERE predicate. fleetdb derives the latest rows in SQL
424
+ * (DISTINCT ON over the entity key the table declares via
425
+ * `maintainLatestFlagFor` in its data-template; a table without an entity key
426
+ * yields the single most recent row). Replaces the removed physical
427
+ * `latest_flag` column — a legacy `{column: "latest_flag", operator: "=",
428
+ * value: true}` predicate is still accepted by the server and treated as this
429
+ * marker.
430
+ */
431
+ export declare interface LatestMarker {
432
+ latest: true;
433
+ }
434
+
373
435
  export declare interface LocationParams {
374
436
  longitude: number & tags.Minimum<-180> & tags.Maximum<180>;
375
437
  latitude: number & tags.Minimum<-90> & tags.Maximum<90>;
@@ -410,6 +472,7 @@ export declare interface SeriesQueryParams {
410
472
  /** Required — the series RPC rejects queries without a time range. */
411
473
  timeRange: SeriesTimeRange;
412
474
  groupBy?: string[] | null;
475
+ /** WHERE predicates only — the `latest` marker is not supported in series queries. */
413
476
  filterAnd?: SQLFilterAnd[] | null;
414
477
  }
415
478
 
@@ -430,6 +493,9 @@ export declare enum Stage {
430
493
  PRODUCTION = "prod"
431
494
  }
432
495
 
496
+ /** One entry of `filterAnd`: a WHERE predicate or the `latest` mode marker. */
497
+ export declare type TableFilter = SQLFilterAnd | LatestMarker;
498
+
433
499
  export declare interface TableParams {
434
500
  tablename: string & tags.MinLength<1>;
435
501
  args?: unknown[];
@@ -440,7 +506,12 @@ export declare interface TableQueryParams {
440
506
  limit: number & tags.Type<"uint32"> & tags.Minimum<1> & tags.Maximum<10000>;
441
507
  offset?: number & tags.Type<"uint32"> & tags.Minimum<0>;
442
508
  timeRange?: ISOTimeRange;
443
- filterAnd?: SQLFilterAnd[];
509
+ filterAnd?: TableFilter[];
510
+ /**
511
+ * Columns to return (the system columns tsp, device_key and authid are
512
+ * always included). Omit for all columns.
513
+ */
514
+ columns?: string[];
444
515
  }
445
516
 
446
517
  export declare const validateBulkTableParams: ((input: unknown) => default_3.IValidation<BulkTableParams>) & StandardSchemaV1<BulkTableParams, BulkTableParams>;
@@ -457,4 +528,19 @@ export declare const validateTableParams: ((input: unknown) => default_3.IValida
457
528
 
458
529
  export declare const validateTableQueryParams: ((input: unknown) => default_3.IValidation<TableQueryParams>) & StandardSchemaV1<TableQueryParams, TableQueryParams>;
459
530
 
531
+ /**
532
+ * Error thrown when a WAMP operation (call/publish/subscribe/register) is
533
+ * rejected by the router or the remote handler. autobahn rejects with a plain
534
+ * `{error: <uri>, args, kwargs}` object that is not a native Error and prints
535
+ * as "[object Object]" — this preserves the WAMP error URI and payload while
536
+ * giving callers a readable message and a stack trace.
537
+ */
538
+ export declare class WampError extends Error {
539
+ /** WAMP error URI, e.g. "wamp.error.no_such_procedure". */
540
+ readonly error: string;
541
+ readonly args: unknown[];
542
+ readonly kwargs: Record<string, unknown>;
543
+ constructor(message: string, uri: string, args?: unknown[], kwargs?: Record<string, unknown>);
544
+ }
545
+
460
546
  export { }