@en-solutions/tgm-client-sdk 1.8.6 → 1.9.2

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.
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Grid Management plugin models — distribution network nodes/links and live status.
3
+ * Mirrors the backend `ca.ensolutions.tgm.grid` entities and DTOs.
4
+ */
5
+ export type GridNodeType = 'SUBSTATION' | 'DISTRIBUTION_SUBSTATION' | 'TRANSFORMER' | 'FEEDER' | 'LINE' | 'SWITCH' | 'RING_MAIN_UNIT' | 'BUSBAR' | 'POLE' | 'METER' | 'OTHER';
6
+ export type GridLinkType = 'OVERHEAD_LINE' | 'UNDERGROUND_CABLE' | 'TRANSFORMER_LINK' | 'BUSBAR_LINK' | 'OTHER';
7
+ /** Live availability state of a grid element. */
8
+ export type OperationalState = 'UP' | 'DEGRADED' | 'DOWN' | 'IMPACTED' | 'UNKNOWN';
9
+ export interface GridNode {
10
+ id?: number;
11
+ name: string;
12
+ nodeType: GridNodeType;
13
+ description?: string;
14
+ latitude?: number;
15
+ longitude?: number;
16
+ voltageLevelKv?: number;
17
+ ratedCapacityKva?: number;
18
+ parentNodeId?: number;
19
+ operationalState?: OperationalState;
20
+ stateSince?: string;
21
+ lastTelemetryAt?: string;
22
+ componentId?: number;
23
+ locationId?: number;
24
+ deviceGatewayId?: number;
25
+ aipNetworkNodeId?: number;
26
+ customFields?: Record<string, any>;
27
+ createdAt?: string;
28
+ updatedAt?: string;
29
+ }
30
+ export interface GridLink {
31
+ id?: number;
32
+ name?: string;
33
+ fromNodeId: number;
34
+ toNodeId: number;
35
+ linkType?: GridLinkType;
36
+ operationalState?: OperationalState;
37
+ lengthKm?: number;
38
+ voltageLevelKv?: number;
39
+ createdAt?: string;
40
+ updatedAt?: string;
41
+ }
42
+ /** A node's live status as returned by GET /api/grid/status and pushed on /topic/grid/status. */
43
+ export interface GridNodeStatus {
44
+ id: number;
45
+ name: string;
46
+ nodeType: GridNodeType;
47
+ latitude?: number;
48
+ longitude?: number;
49
+ voltageLevelKv?: number;
50
+ operationalState: OperationalState;
51
+ parentNodeId?: number;
52
+ lastTelemetryAt?: string;
53
+ activeAlertSeverity?: 'INFO' | 'WARNING' | 'CRITICAL' | 'EMERGENCY' | null;
54
+ reachable: boolean;
55
+ }
@@ -0,0 +1,20 @@
1
+ /** Plugin framework models — installable per-tenant modules. */
2
+ export interface PluginStatus {
3
+ id: string;
4
+ name: string;
5
+ version: string;
6
+ description: string;
7
+ requiredLicenseFeature?: string | null;
8
+ menuModuleId?: string | null;
9
+ installed: boolean;
10
+ status: 'INSTALLED' | 'DISABLED' | 'NOT_INSTALLED' | string;
11
+ installedAt?: string | null;
12
+ }
13
+ export interface InstalledPlugin {
14
+ id?: number;
15
+ pluginId: string;
16
+ version?: string;
17
+ status: 'INSTALLED' | 'DISABLED';
18
+ installedAt?: string;
19
+ installedBy?: string;
20
+ }
@@ -40,3 +40,5 @@ export * from './api/cortex-insight.models';
40
40
  export * from './api/aip.models';
41
41
  export * from './api/reservoir-websocket.models';
42
42
  export * from './api/cms.models';
43
+ export * from './api/grid.models';
44
+ export * from './api/plugin.models';
@@ -22,7 +22,8 @@ export declare class AssetLifecycleService {
22
22
  getRecommendedReplacement(): Observable<ApiResponse<AssetLifecycle[]>>;
23
23
  getDashboard(): Observable<ApiResponse<any>>;
24
24
  getStageEnums(): Observable<ApiResponse<string[]>>;
25
- /** Create a lifecycle record via the collection endpoint (wraps data in { data } if needed) */
25
+ /** Create a lifecycle record via the standard collection endpoint. The backend expects a FLAT
26
+ * payload — wrapping it in { data } makes Spring ignore every field and persist an empty record. */
26
27
  createRecord(data: Record<string, any>): Observable<ApiResponse<AssetLifecycle>>;
27
28
  static ɵfac: i0.ɵɵFactoryDeclaration<AssetLifecycleService, never>;
28
29
  static ɵprov: i0.ɵɵInjectableDeclaration<AssetLifecycleService>;
@@ -5,6 +5,10 @@ export declare class ExportService {
5
5
  private http;
6
6
  private basePath;
7
7
  constructor(http: TgmHttpClient);
8
+ /** Export the dashboard KPIs as CSV (period in days, default 30). */
9
+ exportDashboardCsv(periodDays?: number): Observable<Blob>;
10
+ /** Export the dashboard KPIs as Excel (period in days, default 30). */
11
+ exportDashboardExcel(periodDays?: number): Observable<Blob>;
8
12
  exportInspectionsExcel(ids?: number[]): Observable<Blob>;
9
13
  exportInspectionsCsv(ids?: number[]): Observable<Blob>;
10
14
  exportInspectionsPdf(ids?: number[]): Observable<Blob>;
@@ -0,0 +1,54 @@
1
+ import { Observable } from 'rxjs';
2
+ import { TgmHttpClient } from '../../core/http-client.service';
3
+ import { WebSocketService } from '../../core/websocket.service';
4
+ import { BaseCrudService } from './base-crud.service';
5
+ import { ApiResponse } from '../../models/base.models';
6
+ import { GridLink, GridNode, GridNodeStatus } from '../../models/api/grid.models';
7
+ import * as i0 from "@angular/core";
8
+ /** CRUD for grid nodes (`/api/grid/nodes`). Requires the grid-management plugin. */
9
+ export declare class GridNodeService extends BaseCrudService<GridNode> {
10
+ protected resourcePath: string;
11
+ constructor(http: TgmHttpClient);
12
+ static ɵfac: i0.ɵɵFactoryDeclaration<GridNodeService, never>;
13
+ static ɵprov: i0.ɵɵInjectableDeclaration<GridNodeService>;
14
+ }
15
+ /** CRUD for grid links/edges (`/api/grid/links`). */
16
+ export declare class GridLinkService extends BaseCrudService<GridLink> {
17
+ protected resourcePath: string;
18
+ constructor(http: TgmHttpClient);
19
+ static ɵfac: i0.ɵɵFactoryDeclaration<GridLinkService, never>;
20
+ static ɵprov: i0.ɵɵInjectableDeclaration<GridLinkService>;
21
+ }
22
+ /**
23
+ * Real-time distribution-grid view: the status snapshot that powers the map plus a live STOMP feed.
24
+ *
25
+ * Typical usage:
26
+ * ```ts
27
+ * grid.status().subscribe(r => this.render(r.data)); // initial map render
28
+ * grid.liveStatus().subscribe(snapshot => this.render(snapshot)); // live updates
29
+ * ```
30
+ */
31
+ export declare class GridService {
32
+ private http;
33
+ private ws;
34
+ private base;
35
+ static readonly TOPIC_STATUS = "/topic/grid/status";
36
+ constructor(http: TgmHttpClient, ws: WebSocketService);
37
+ /** Live status snapshot of every node (for the initial map render). */
38
+ status(): Observable<ApiResponse<GridNodeStatus[]>>;
39
+ /** All links/edges (for drawing the topology). */
40
+ links(): Observable<ApiResponse<GridLink[]>>;
41
+ /** Admin: recompute and persist live states, then broadcast over WebSocket. */
42
+ recompute(): Observable<ApiResponse<{
43
+ changed: number;
44
+ }>>;
45
+ /**
46
+ * Live stream of full status snapshots pushed on `/topic/grid/status`.
47
+ * Ensure {@link WebSocketService.connect} has been called once after login.
48
+ */
49
+ liveStatus(): Observable<GridNodeStatus[]>;
50
+ /** Live stream for a single node pushed on `/topic/grid/node/{id}`. */
51
+ liveNode(nodeId: number): Observable<GridNodeStatus>;
52
+ static ɵfac: i0.ɵɵFactoryDeclaration<GridService, never>;
53
+ static ɵprov: i0.ɵɵInjectableDeclaration<GridService>;
54
+ }
@@ -102,3 +102,5 @@ export { AuditEntryService } from './audit-entry.service';
102
102
  export { ThresholdAlertRuleService } from './threshold-alert-rule.service';
103
103
  export { CmsContentTypeService, CmsDataService } from './cms.service';
104
104
  export { CmsMenuHelper, CmsMenuItem, CmsMenuSection } from './cms-menu.helper';
105
+ export { GridService, GridNodeService, GridLinkService } from './grid.service';
106
+ export { PluginService } from './plugin.service';
@@ -0,0 +1,25 @@
1
+ import { Observable } from 'rxjs';
2
+ import { TgmHttpClient } from '../../core/http-client.service';
3
+ import { ApiResponse } from '../../models/base.models';
4
+ import { InstalledPlugin, PluginStatus } from '../../models/api/plugin.models';
5
+ import * as i0 from "@angular/core";
6
+ /**
7
+ * Installable modules (plugins) for the current organization.
8
+ *
9
+ * `list()` is readable by any authenticated user — the frontend uses it to decide which modules /
10
+ * menus to reveal. `install()` / `uninstall()` require an admin and run the plugin's isolated
11
+ * migrations on the tenant DB.
12
+ */
13
+ export declare class PluginService {
14
+ private http;
15
+ private base;
16
+ constructor(http: TgmHttpClient);
17
+ /** Catalog of all plugins with this organization's install status. */
18
+ list(): Observable<ApiResponse<PluginStatus[]>>;
19
+ /** True if the given plugin is installed for the current organization. */
20
+ isInstalled(pluginId: string): Observable<boolean>;
21
+ install(pluginId: string): Observable<ApiResponse<InstalledPlugin>>;
22
+ uninstall(pluginId: string): Observable<ApiResponse<void>>;
23
+ static ɵfac: i0.ɵɵFactoryDeclaration<PluginService, never>;
24
+ static ɵprov: i0.ɵɵInjectableDeclaration<PluginService>;
25
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@en-solutions/tgm-client-sdk",
3
- "version": "1.8.6",
3
+ "version": "1.9.2",
4
4
  "description": "TGM Manager Client SDK for Angular 18 - Type-safe services for all TGM API endpoints",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {