@en-solutions/tgm-client-sdk 1.8.4 → 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.
- package/esm2022/lib/models/api/ai-usage.models.mjs +6 -0
- package/esm2022/lib/models/auth/index.mjs +2 -1
- package/esm2022/lib/models/auth/webauthn.models.mjs +2 -0
- package/esm2022/lib/services/api/ai-usage.service.mjs +36 -0
- package/esm2022/lib/services/api/index.mjs +2 -1
- package/esm2022/lib/services/auth/index.mjs +2 -1
- package/esm2022/lib/services/auth/webauthn.service.mjs +63 -0
- package/fesm2022/en-solutions-tgm-client-sdk.mjs +94 -2
- package/fesm2022/en-solutions-tgm-client-sdk.mjs.map +1 -1
- package/lib/models/api/ai-usage.models.d.ts +24 -0
- package/lib/models/auth/index.d.ts +1 -0
- package/lib/models/auth/webauthn.models.d.ts +8 -0
- package/lib/services/api/ai-usage.service.d.ts +22 -0
- package/lib/services/api/index.d.ts +1 -0
- package/lib/services/auth/index.d.ts +1 -0
- package/lib/services/auth/webauthn.service.d.ts +32 -0
- package/package.json +5 -3
|
@@ -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
|
+
}
|
|
@@ -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';
|
|
@@ -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
|
+
"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://
|
|
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",
|