@en-solutions/tgm-client-sdk 1.8.6 → 1.9.6
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/esm2022/lib/models/api/energy.models.mjs +1 -1
- package/esm2022/lib/models/api/grid.models.mjs +6 -0
- package/esm2022/lib/models/api/plugin.models.mjs +3 -0
- package/esm2022/lib/models/enums/status.enums.mjs +12 -2
- package/esm2022/lib/models/index.mjs +3 -1
- package/esm2022/lib/services/api/asset-lifecycle.service.mjs +7 -4
- package/esm2022/lib/services/api/energy.service.mjs +18 -1
- package/esm2022/lib/services/api/export.service.mjs +14 -1
- package/esm2022/lib/services/api/grid.service.mjs +87 -0
- package/esm2022/lib/services/api/index.mjs +3 -1
- package/esm2022/lib/services/api/plugin.service.mjs +71 -0
- package/fesm2022/en-solutions-tgm-client-sdk.mjs +205 -6
- package/fesm2022/en-solutions-tgm-client-sdk.mjs.map +1 -1
- package/lib/models/api/energy.models.d.ts +34 -0
- package/lib/models/api/grid.models.d.ts +57 -0
- package/lib/models/api/plugin.models.d.ts +43 -0
- package/lib/models/enums/status.enums.d.ts +3 -0
- package/lib/models/index.d.ts +2 -0
- package/lib/services/api/asset-lifecycle.service.d.ts +2 -1
- package/lib/services/api/energy.service.d.ts +13 -2
- package/lib/services/api/export.service.d.ts +4 -0
- package/lib/services/api/grid.service.d.ts +61 -0
- package/lib/services/api/index.d.ts +2 -0
- package/lib/services/api/plugin.service.d.ts +36 -0
- package/package.json +1 -1
|
@@ -84,6 +84,10 @@ export interface OutageEvent {
|
|
|
84
84
|
status?: OutageStatus;
|
|
85
85
|
unitId?: number;
|
|
86
86
|
failureId?: number;
|
|
87
|
+
/** Grid Management: the grid node this outage concerns (set for grid outages). */
|
|
88
|
+
gridNodeId?: number;
|
|
89
|
+
/** True when auto-created by the grid auto-response (vs entered manually). */
|
|
90
|
+
autoGenerated?: boolean;
|
|
87
91
|
plannedStart?: string;
|
|
88
92
|
plannedEnd?: string;
|
|
89
93
|
actualStart?: string;
|
|
@@ -104,6 +108,36 @@ export interface OutageEvent {
|
|
|
104
108
|
createdAt?: string;
|
|
105
109
|
updatedAt?: string;
|
|
106
110
|
}
|
|
111
|
+
/** Per-resource-type roll-up inside an {@link OutageAnalysis} (backend: ResourceSummaryDTO). */
|
|
112
|
+
export interface OutageResourceSummary {
|
|
113
|
+
resourceType?: string;
|
|
114
|
+
count: number;
|
|
115
|
+
estimatedHours: number;
|
|
116
|
+
actualHours: number;
|
|
117
|
+
variance: number;
|
|
118
|
+
}
|
|
119
|
+
/** Post-outage analysis contract (backend: PostOutageAnalysisDTO) returned by `getAnalysis(id)`. */
|
|
120
|
+
export interface OutageAnalysis {
|
|
121
|
+
outageId: number;
|
|
122
|
+
outageNumber?: string;
|
|
123
|
+
title?: string;
|
|
124
|
+
status?: string;
|
|
125
|
+
plannedDurationHours?: number;
|
|
126
|
+
actualDurationHours?: number;
|
|
127
|
+
durationVarianceHours?: number;
|
|
128
|
+
durationVariancePercent?: number;
|
|
129
|
+
estimatedCost?: number;
|
|
130
|
+
actualCost?: number;
|
|
131
|
+
costVariance?: number;
|
|
132
|
+
costVariancePercent?: number;
|
|
133
|
+
lostRevenue?: number;
|
|
134
|
+
lostCapacityMw?: number;
|
|
135
|
+
totalResourcesAssigned?: number;
|
|
136
|
+
totalEstimatedHours?: number;
|
|
137
|
+
totalActualHours?: number;
|
|
138
|
+
resourceHoursVariance?: number;
|
|
139
|
+
resourceBreakdown?: OutageResourceSummary[];
|
|
140
|
+
}
|
|
107
141
|
export interface OperatingEvent {
|
|
108
142
|
id: number;
|
|
109
143
|
name?: string;
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
/** Id of the worst active SensorAlert on this node — pass to acknowledge/resolve/escalate. */
|
|
55
|
+
activeAlertId?: number | null;
|
|
56
|
+
reachable: boolean;
|
|
57
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
/**
|
|
14
|
+
* Full detail of one plugin = descriptor + curated rich content + this organization's install status.
|
|
15
|
+
* Returned by `GET /api/plugins/{id}`; everything a plugin detail page needs (pure JSON, no backend UI).
|
|
16
|
+
*/
|
|
17
|
+
export interface PluginDetail {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
version: string;
|
|
21
|
+
category: string;
|
|
22
|
+
description: string;
|
|
23
|
+
tagline: string;
|
|
24
|
+
longDescription: string;
|
|
25
|
+
features: string[];
|
|
26
|
+
dataModel: string[];
|
|
27
|
+
endpoints: string[];
|
|
28
|
+
useCases: string[];
|
|
29
|
+
dependsOn: string[];
|
|
30
|
+
requiredLicenseFeature?: string | null;
|
|
31
|
+
menuModuleId?: string | null;
|
|
32
|
+
installed: boolean;
|
|
33
|
+
status: 'INSTALLED' | 'DISABLED' | 'NOT_INSTALLED' | string;
|
|
34
|
+
installedAt?: string | null;
|
|
35
|
+
}
|
|
36
|
+
export interface InstalledPlugin {
|
|
37
|
+
id?: number;
|
|
38
|
+
pluginId: string;
|
|
39
|
+
version?: string;
|
|
40
|
+
status: 'INSTALLED' | 'DISABLED';
|
|
41
|
+
installedAt?: string;
|
|
42
|
+
installedBy?: string;
|
|
43
|
+
}
|
|
@@ -278,6 +278,9 @@ export declare const WorkflowStatus: {
|
|
|
278
278
|
};
|
|
279
279
|
export type WorkflowStatus = (typeof WorkflowStatus)[keyof typeof WorkflowStatus];
|
|
280
280
|
export declare const InterventionRequestStatus: {
|
|
281
|
+
readonly PENDING: "PENDING";
|
|
282
|
+
readonly THREATED: "THREATED";
|
|
283
|
+
readonly CANCELLED: "CANCELLED";
|
|
281
284
|
readonly ON_HOLD: "OnHold";
|
|
282
285
|
readonly ACCEPTED: "Accepted";
|
|
283
286
|
readonly REJECTED: "Rejected";
|
package/lib/models/index.d.ts
CHANGED
|
@@ -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
|
|
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>;
|
|
@@ -2,7 +2,7 @@ import { Observable } from 'rxjs';
|
|
|
2
2
|
import { TgmHttpClient } from '../../core/http-client.service';
|
|
3
3
|
import { BaseCrudService } from './base-crud.service';
|
|
4
4
|
import { ApiResponse } from '../../models/base.models';
|
|
5
|
-
import { AncillaryService, GridConnection, CurtailmentEvent, OutageEvent, OperatingEvent, SiteAssessment } from '../../models/api/energy.models';
|
|
5
|
+
import { AncillaryService, GridConnection, CurtailmentEvent, OutageEvent, OutageAnalysis, OperatingEvent, SiteAssessment } from '../../models/api/energy.models';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
7
|
export declare class AncillaryServiceCrudService extends BaseCrudService<AncillaryService> {
|
|
8
8
|
protected resourcePath: string;
|
|
@@ -26,9 +26,20 @@ export declare class OutageEventService extends BaseCrudService<OutageEvent> {
|
|
|
26
26
|
protected resourcePath: string;
|
|
27
27
|
constructor(http: TgmHttpClient);
|
|
28
28
|
getGantt(start: string, end: string): Observable<ApiResponse<any>>;
|
|
29
|
-
|
|
29
|
+
/** Post-outage impact analysis (backend: PostOutageAnalysisDTO). */
|
|
30
|
+
getAnalysis(id: number): Observable<ApiResponse<OutageAnalysis>>;
|
|
31
|
+
/** Schedule overlaps (backend: OverlapDTO[]). */
|
|
30
32
|
getOverlaps(id: number): Observable<ApiResponse<any[]>>;
|
|
33
|
+
/** Resource conflicts (backend: ResourceConflictDTO[]). */
|
|
31
34
|
getResourceConflicts(id: number): Observable<ApiResponse<any[]>>;
|
|
35
|
+
/**
|
|
36
|
+
* Lifecycle actions (backend: `POST /api/outages/{id}/approve|complete|cancel`).
|
|
37
|
+
* NB: `approve` drives the separate `approvalStatus` field (PENDING → APPROVED), while
|
|
38
|
+
* `complete`/`cancel` drive `status` (ACTIVE → COMPLETED/CANCELLED).
|
|
39
|
+
*/
|
|
40
|
+
approve(id: number, notes?: string): Observable<ApiResponse<OutageEvent>>;
|
|
41
|
+
complete(id: number, notes?: string): Observable<ApiResponse<OutageEvent>>;
|
|
42
|
+
cancel(id: number): Observable<ApiResponse<OutageEvent>>;
|
|
32
43
|
static ɵfac: i0.ɵɵFactoryDeclaration<OutageEventService, never>;
|
|
33
44
|
static ɵprov: i0.ɵɵInjectableDeclaration<OutageEventService>;
|
|
34
45
|
}
|
|
@@ -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,61 @@
|
|
|
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
|
+
* Admin: run the grid auto-response — opens/closes `OutageEvent`s (and maintenance tickets) from the
|
|
47
|
+
* current derived states. This is more than `recompute()` (which only persists/broadcasts states).
|
|
48
|
+
*/
|
|
49
|
+
autoResponse(): Observable<ApiResponse<{
|
|
50
|
+
changed: number;
|
|
51
|
+
}>>;
|
|
52
|
+
/**
|
|
53
|
+
* Live stream of full status snapshots pushed on `/topic/grid/status`.
|
|
54
|
+
* Ensure {@link WebSocketService.connect} has been called once after login.
|
|
55
|
+
*/
|
|
56
|
+
liveStatus(): Observable<GridNodeStatus[]>;
|
|
57
|
+
/** Live stream for a single node pushed on `/topic/grid/node/{id}`. */
|
|
58
|
+
liveNode(nodeId: number): Observable<GridNodeStatus>;
|
|
59
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GridService, never>;
|
|
60
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<GridService>;
|
|
61
|
+
}
|
|
@@ -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,36 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { TgmHttpClient } from '../../core/http-client.service';
|
|
3
|
+
import { ApiResponse } from '../../models/base.models';
|
|
4
|
+
import { InstalledPlugin, PluginDetail, 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
|
+
/** Full detail of one plugin (rich content + this organization's install status) — for a detail page. */
|
|
20
|
+
detail(pluginId: string): Observable<ApiResponse<PluginDetail>>;
|
|
21
|
+
/** True if the given plugin is installed for the current organization. */
|
|
22
|
+
isInstalled(pluginId: string): Observable<boolean>;
|
|
23
|
+
install(pluginId: string): Observable<ApiResponse<InstalledPlugin>>;
|
|
24
|
+
uninstall(pluginId: string): Observable<ApiResponse<void>>;
|
|
25
|
+
private platformBase;
|
|
26
|
+
/** Tenant-agnostic plugin catalog (descriptors). */
|
|
27
|
+
platformCatalog(): Observable<ApiResponse<PluginStatus[]>>;
|
|
28
|
+
/** Plugins with a specific client's install status. */
|
|
29
|
+
platformListForClient(clientId: string): Observable<ApiResponse<PluginStatus[]>>;
|
|
30
|
+
/** Install a plugin for a specific client. */
|
|
31
|
+
platformInstall(clientId: string, pluginId: string): Observable<ApiResponse<InstalledPlugin>>;
|
|
32
|
+
/** Disable a plugin for a specific client (data retained). */
|
|
33
|
+
platformUninstall(clientId: string, pluginId: string): Observable<ApiResponse<void>>;
|
|
34
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PluginService, never>;
|
|
35
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<PluginService>;
|
|
36
|
+
}
|
package/package.json
CHANGED