@en-solutions/tgm-client-sdk 1.8.3 → 1.8.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.
@@ -0,0 +1,24 @@
1
+ /**
2
+ * AI usage / cost attribution models.
3
+ * Mirrors GET /api/ai/usage/summary (backend AiUsageController).
4
+ */
5
+ /** Feature/source taxonomy used to attribute AI usage (matches backend AiFeature). */
6
+ export type AiFeature = 'AI_ASSISTANT' | 'AGENT' | 'CORTEX' | 'EMBEDDINGS' | 'SEMANTIC_SEARCH' | 'NL_SEARCH' | 'TRANSCRIPTION' | 'REPORT_GENERATION' | 'SANDBOX' | 'OTHER' | string;
7
+ /** One aggregation row (by feature, provider or model). */
8
+ export interface AiUsageRow {
9
+ key: string;
10
+ calls: number;
11
+ tokens: number;
12
+ costUsd: number;
13
+ }
14
+ /** Usage summary over a date range for the current tenant. */
15
+ export interface AiUsageSummary {
16
+ from: string;
17
+ to: string;
18
+ totalCalls: number;
19
+ totalTokens: number;
20
+ totalCostUsd: number;
21
+ byFeature: AiUsageRow[];
22
+ byProvider: AiUsageRow[];
23
+ byModel: AiUsageRow[];
24
+ }
@@ -1,6 +1,7 @@
1
1
  import { ComponentType, ComponentCategory, ComponentInfoType, ComponentInfoCategory, ComponentInfoStatus, MeteringParameterType, MeteringParameterSubType, AssetPhase } from '../enums';
2
2
  import { Failure } from './failure.models';
3
3
  import { StrapiFile } from './media.models';
4
+ import { TurbineType } from './misc.models';
4
5
  export interface Component {
5
6
  id: number;
6
7
  name: string;
@@ -76,7 +77,7 @@ export interface Component {
76
77
  failures?: Failure[];
77
78
  componentChecklistData?: any[];
78
79
  componentChecklists?: any[];
79
- turbineTypes?: any[];
80
+ turbineTypes?: TurbineType[];
80
81
  associatedAssets?: any[];
81
82
  drawings?: StrapiFile[];
82
83
  plan?: StrapiFile;
@@ -3,7 +3,7 @@ import { StrapiFile } from './media.models';
3
3
  /**
4
4
  * Location entity.
5
5
  *
6
- * Filter by type: use query param `typeOfPremise` with values: Plant, Office, Warehouse, Dam, HybridPlant, Other.
6
+ * Filter by type: use query param `typeOfPremise` with values: Plant, Office, Warehouse, Dam, HybridPlant, Substation, DistributionSubstation, Other.
7
7
  * Example: LocationService.getAll({ page: 1, pageSize: 500, typeOfPremise: 'Plant' })
8
8
  */
9
9
  export interface Location {
@@ -18,7 +18,7 @@ export interface Location {
18
18
  postalCode?: string;
19
19
  phoneNumber?: string;
20
20
  isHeadQuarters?: boolean;
21
- typeOfPremise?: 'Plant' | 'Office' | 'Warehouse' | 'Dam' | 'HybridPlant' | 'Other' | string;
21
+ typeOfPremise?: 'Plant' | 'Office' | 'Warehouse' | 'Dam' | 'HybridPlant' | 'Substation' | 'DistributionSubstation' | 'Other' | string;
22
22
  region?: 'All' | 'Africa' | 'AsiaAndOceania' | 'Europe' | 'LatinAmerica' | 'NorthAmerica' | string;
23
23
  latitude?: string;
24
24
  longitude?: string;
@@ -71,6 +71,8 @@ export interface Location {
71
71
  surgeChamberDetails?: string;
72
72
  isACascadePlant?: boolean;
73
73
  revenueStreams?: string;
74
+ substationDetails?: string;
75
+ distributionSubstationDetails?: string;
74
76
  reservoirCode?: string;
75
77
  normalPoolElevation?: number;
76
78
  maximumPoolElevation?: number;
@@ -1,3 +1,4 @@
1
1
  export * from './login.models';
2
2
  export * from './sso.models';
3
3
  export * from './totp.models';
4
+ export * from './webauthn.models';
@@ -0,0 +1,8 @@
1
+ /** A registered WebAuthn credential (passkey / security key) — mirrors the backend view. */
2
+ export interface WebAuthnCredentialView {
3
+ id: number;
4
+ deviceName: string;
5
+ discoverable: boolean;
6
+ createdAt: string;
7
+ lastUsedAt?: string | null;
8
+ }
@@ -230,6 +230,8 @@ export declare const PremiseType: {
230
230
  readonly WAREHOUSE: "WAREHOUSE";
231
231
  readonly DAM: "DAM";
232
232
  readonly HYBRID_PLANT: "HYBRID_PLANT";
233
+ readonly SUBSTATION: "SUBSTATION";
234
+ readonly DISTRIBUTION_SUBSTATION: "DISTRIBUTION_SUBSTATION";
233
235
  readonly OTHER: "OTHER";
234
236
  };
235
237
  export type PremiseType = (typeof PremiseType)[keyof typeof PremiseType];
@@ -0,0 +1,22 @@
1
+ import { Observable } from 'rxjs';
2
+ import { TgmHttpClient } from '../../core/http-client.service';
3
+ import { ApiResponse } from '../../models/base.models';
4
+ import { AiUsageSummary } from '../../models/api/ai-usage.models';
5
+ import * as i0 from "@angular/core";
6
+ /**
7
+ * AI usage & cost attribution for the current tenant.
8
+ * Backend: AiUsageController (admin-only).
9
+ */
10
+ export declare class AiUsageService {
11
+ private http;
12
+ private basePath;
13
+ constructor(http: TgmHttpClient);
14
+ /**
15
+ * Usage summary (calls, tokens, cost) broken down by feature / provider / model.
16
+ * @param from optional ISO date (yyyy-MM-dd), defaults server-side to 30 days ago
17
+ * @param to optional ISO date (yyyy-MM-dd), defaults server-side to today
18
+ */
19
+ getSummary(from?: string, to?: string): Observable<ApiResponse<AiUsageSummary>>;
20
+ static ɵfac: i0.ɵɵFactoryDeclaration<AiUsageService, never>;
21
+ static ɵprov: i0.ɵɵInjectableDeclaration<AiUsageService>;
22
+ }
@@ -1,4 +1,5 @@
1
1
  export { BaseCrudService } from './base-crud.service';
2
+ export { AiUsageService } from './ai-usage.service';
2
3
  export { CompanyService } from './company.service';
3
4
  export { UnitService } from './unit.service';
4
5
  export { ComponentService, ComponentGroupService, SubAssemblyService } from './component.service';
@@ -1,4 +1,5 @@
1
1
  export { AuthService } from './auth.service';
2
2
  export { SsoAuthService } from './sso-auth.service';
3
3
  export { TotpService } from './totp.service';
4
+ export { WebAuthnService } from './webauthn.service';
4
5
  export { PlatformAuthService } from './platform-auth.service';
@@ -0,0 +1,32 @@
1
+ import { Observable } from 'rxjs';
2
+ import { TgmHttpClient } from '../../core/http-client.service';
3
+ import { ApiResponse } from '../../models/base.models';
4
+ import { AuthResponse } from '../../models/auth/login.models';
5
+ import { WebAuthnCredentialView } from '../../models/auth/webauthn.models';
6
+ import * as i0 from "@angular/core";
7
+ /**
8
+ * WebAuthn / passkeys / security keys.
9
+ *
10
+ * Registration & key management require an authenticated session; passkey login is public.
11
+ * Uses @github/webauthn-json (the matching browser library for the backend's Yubico server).
12
+ */
13
+ export declare class WebAuthnService {
14
+ private http;
15
+ private base;
16
+ constructor(http: TgmHttpClient);
17
+ /** True if this browser supports WebAuthn. */
18
+ isSupported(): boolean;
19
+ /** Register a new passkey / security key for the current (logged-in) user. */
20
+ registerKey(deviceName?: string): Promise<void>;
21
+ /**
22
+ * Log in with a passkey. Pass a username for username-first flows, or omit it for a
23
+ * usernameless (discoverable credential) login. Stores the JWT on success.
24
+ */
25
+ loginWithPasskey(username?: string): Promise<AuthResponse>;
26
+ /** List the current user's registered keys. */
27
+ listKeys(): Observable<ApiResponse<WebAuthnCredentialView[]>>;
28
+ /** Remove a registered key. */
29
+ deleteKey(id: number): Observable<ApiResponse<void>>;
30
+ static ɵfac: i0.ɵɵFactoryDeclaration<WebAuthnService, never>;
31
+ static ɵprov: i0.ɵɵInjectableDeclaration<WebAuthnService>;
32
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@en-solutions/tgm-client-sdk",
3
- "version": "1.8.3",
3
+ "version": "1.8.6",
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": {
@@ -8,13 +8,15 @@
8
8
  "url": "https://github.com/EN-Solutions/tgm-client-sdk.git"
9
9
  },
10
10
  "publishConfig": {
11
- "registry": "https://npm.pkg.github.com"
11
+ "registry": "https://registry.npmjs.org/",
12
+ "access": "public"
12
13
  },
13
14
  "peerDependencies": {
14
15
  "@angular/common": "^18.0.0",
15
16
  "@angular/core": "^18.0.0",
16
17
  "@angular/forms": "^18.0.0",
17
- "rxjs": "^7.8.0"
18
+ "rxjs": "^7.8.0",
19
+ "@github/webauthn-json": "^2.1.1"
18
20
  },
19
21
  "dependencies": {
20
22
  "@stomp/stompjs": "^7.0.0",