@topconsultnpm/sdkui-react 6.22.0-dev2.18 → 6.22.0-dev2.19
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.
|
@@ -164,6 +164,34 @@ export declare class CaseFlowService {
|
|
|
164
164
|
* cftid quando non passato (come per la bacheca).
|
|
165
165
|
*/
|
|
166
166
|
private static participantsAddOrRemove;
|
|
167
|
+
/** Istanze marcate come preferite dall'utente corrente. */
|
|
168
|
+
static getFavorites(): Promise<CaseFlowInstanceDescriptor[]>;
|
|
169
|
+
/**
|
|
170
|
+
* Aggiunge o rimuove l'istanza dai preferiti dell'utente corrente tramite
|
|
171
|
+
* FavoritesAddOrRemoveAsync(cftid, id, remove).
|
|
172
|
+
*/
|
|
173
|
+
static setFavorite(caseFlowId: number, favorite: boolean, cftid?: number): Promise<void>;
|
|
174
|
+
/**
|
|
175
|
+
* Inizia o smette di seguire l'istanza tramite
|
|
176
|
+
* FollowAddOrRemoveAsync(cftid, id, remove).
|
|
177
|
+
*/
|
|
178
|
+
static setFollow(caseFlowId: number, follow: boolean, cftid?: number): Promise<void>;
|
|
179
|
+
/**
|
|
180
|
+
* Stato "l'utente corrente segue questa pratica" letto dal descrittore.
|
|
181
|
+
*
|
|
182
|
+
* Restituisce `undefined` quando il descrittore non porta l'informazione —
|
|
183
|
+
* cioè SEMPRE, finché il backend non aggiunge `IsFollow` in output a
|
|
184
|
+
* `usp_Cfi_RetrieveAll`/`usp_Cfi_Retrieve` e la relativa proprietà al
|
|
185
|
+
* contratto. Il tipo è tollerante perché la colonna è un BIT/NUMBER e può
|
|
186
|
+
* arrivare come booleano, come 0/1 o come stringa.
|
|
187
|
+
*
|
|
188
|
+
* Da NON dedurre dalla bacheca Home come fanno pratiche-dossier e gruppi di
|
|
189
|
+
* lavoro (filtro su `HomeBlogPost.classID`): quella query prende `TOP 30`
|
|
190
|
+
* righe e il solo ultimo post non di sistema per oggetto, quindi chi segue
|
|
191
|
+
* un oggetto senza post risulta "non seguace"; per le istanze di CaseFlow,
|
|
192
|
+
* poi, non esiste nemmeno un ramo nella UNION.
|
|
193
|
+
*/
|
|
194
|
+
static readFollowFlag(cf: CaseFlowInstanceDescriptor): boolean | undefined;
|
|
167
195
|
/** Completa (approva) un workitem. La nota facoltativa viene pubblicata in bacheca dal backend. */
|
|
168
196
|
static completeWorkItem(caseFlowId: number, workItemId: number, response?: string, cftid?: number): Promise<void>;
|
|
169
197
|
/**
|
|
@@ -415,6 +415,76 @@ export class CaseFlowService {
|
|
|
415
415
|
throw new Error(`Impossibile risolvere il template (cftid) per l'istanza id=${caseFlowId}.`);
|
|
416
416
|
await engine.ParticipantsAddOrRemoveAsync(resolvedCftid, caseFlowId, participant, remove);
|
|
417
417
|
}
|
|
418
|
+
// ----- Azioni personali dell'utente (Preferiti / Segui) -------------------
|
|
419
|
+
//
|
|
420
|
+
// Riguardano la relazione fra UTENTE e istanza, non il ciclo di vita della
|
|
421
|
+
// pratica. Come per documenti e partecipanti, l'engine espone un'unica API
|
|
422
|
+
// add-or-remove per ciascuna delle due.
|
|
423
|
+
//
|
|
424
|
+
// ATTENZIONE all'asimmetria: dei Preferiti si può leggere l'elenco
|
|
425
|
+
// (FavoritesRetrieveAllAsync), del Segui NO. Nessuna API dice se l'utente
|
|
426
|
+
// corrente segue una pratica: le `FollowAddOrRemove` sono di sola scrittura,
|
|
427
|
+
// qui come per pratiche-dossier e gruppi di lavoro. Finché il backend non
|
|
428
|
+
// esporrà `IsFollow` sul descrittore d'istanza, lo stato del comando Segui
|
|
429
|
+
// resta a carico del chiamante.
|
|
430
|
+
/** Istanze marcate come preferite dall'utente corrente. */
|
|
431
|
+
static async getFavorites() {
|
|
432
|
+
const engine = SDK_Globals.tmSession?.NewCaseFlowInstanceEngine();
|
|
433
|
+
if (!engine)
|
|
434
|
+
throw new Error('Motore delle istanze CaseFlow non disponibile.');
|
|
435
|
+
return await engine.FavoritesRetrieveAllAsync() ?? [];
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Aggiunge o rimuove l'istanza dai preferiti dell'utente corrente tramite
|
|
439
|
+
* FavoritesAddOrRemoveAsync(cftid, id, remove).
|
|
440
|
+
*/
|
|
441
|
+
static async setFavorite(caseFlowId, favorite, cftid) {
|
|
442
|
+
const engine = SDK_Globals.tmSession?.NewCaseFlowInstanceEngine();
|
|
443
|
+
if (!engine)
|
|
444
|
+
throw new Error('Motore delle istanze CaseFlow non disponibile.');
|
|
445
|
+
const resolvedCftid = cftid ?? (await this.getCaseflow(caseFlowId))?.cftid;
|
|
446
|
+
if (resolvedCftid == null)
|
|
447
|
+
throw new Error(`Impossibile risolvere il template (cftid) per l'istanza id=${caseFlowId}.`);
|
|
448
|
+
await engine.FavoritesAddOrRemoveAsync(resolvedCftid, caseFlowId, !favorite);
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Inizia o smette di seguire l'istanza tramite
|
|
452
|
+
* FollowAddOrRemoveAsync(cftid, id, remove).
|
|
453
|
+
*/
|
|
454
|
+
static async setFollow(caseFlowId, follow, cftid) {
|
|
455
|
+
const engine = SDK_Globals.tmSession?.NewCaseFlowInstanceEngine();
|
|
456
|
+
if (!engine)
|
|
457
|
+
throw new Error('Motore delle istanze CaseFlow non disponibile.');
|
|
458
|
+
const resolvedCftid = cftid ?? (await this.getCaseflow(caseFlowId))?.cftid;
|
|
459
|
+
if (resolvedCftid == null)
|
|
460
|
+
throw new Error(`Impossibile risolvere il template (cftid) per l'istanza id=${caseFlowId}.`);
|
|
461
|
+
await engine.FollowAddOrRemoveAsync(resolvedCftid, caseFlowId, !follow);
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Stato "l'utente corrente segue questa pratica" letto dal descrittore.
|
|
465
|
+
*
|
|
466
|
+
* Restituisce `undefined` quando il descrittore non porta l'informazione —
|
|
467
|
+
* cioè SEMPRE, finché il backend non aggiunge `IsFollow` in output a
|
|
468
|
+
* `usp_Cfi_RetrieveAll`/`usp_Cfi_Retrieve` e la relativa proprietà al
|
|
469
|
+
* contratto. Il tipo è tollerante perché la colonna è un BIT/NUMBER e può
|
|
470
|
+
* arrivare come booleano, come 0/1 o come stringa.
|
|
471
|
+
*
|
|
472
|
+
* Da NON dedurre dalla bacheca Home come fanno pratiche-dossier e gruppi di
|
|
473
|
+
* lavoro (filtro su `HomeBlogPost.classID`): quella query prende `TOP 30`
|
|
474
|
+
* righe e il solo ultimo post non di sistema per oggetto, quindi chi segue
|
|
475
|
+
* un oggetto senza post risulta "non seguace"; per le istanze di CaseFlow,
|
|
476
|
+
* poi, non esiste nemmeno un ramo nella UNION.
|
|
477
|
+
*/
|
|
478
|
+
static readFollowFlag(cf) {
|
|
479
|
+
const raw = cf.isFollow;
|
|
480
|
+
if (typeof raw === 'boolean')
|
|
481
|
+
return raw;
|
|
482
|
+
if (typeof raw === 'number')
|
|
483
|
+
return raw !== 0;
|
|
484
|
+
if (raw === '0' || raw === '1')
|
|
485
|
+
return raw === '1';
|
|
486
|
+
return undefined;
|
|
487
|
+
}
|
|
418
488
|
// ----- Workitem: movimentazione del flusso -------------------------------
|
|
419
489
|
//
|
|
420
490
|
// L'engine espone UNA sola API per la movimentazione dei workitem,
|