@smarterplan/ngx-smarterplan-core 1.4.28 → 1.4.29
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/components/inventory-runs/inventory-files.component.mjs +135 -48
- package/esm2022/lib/components/inventory-runs/inventory-launch.component.mjs +301 -25
- package/esm2022/lib/components/inventory-runs/inventory-runs.component.mjs +14 -3
- package/esm2022/lib/services/models/equipment.service.mjs +30 -23
- package/esm2022/lib/services/models/inventory-storage.mjs +21 -0
- package/esm2022/lib/services/models/inventory.service.mjs +50 -3
- package/esm2022/lib/services/models/operation.service.mjs +19 -5
- package/esm2022/lib/services/retry-when-throttled.mjs +31 -0
- package/fesm2022/smarterplan-ngx-smarterplan-core.mjs +585 -96
- package/fesm2022/smarterplan-ngx-smarterplan-core.mjs.map +1 -1
- package/lib/components/inventory-runs/inventory-files.component.d.ts +37 -8
- package/lib/components/inventory-runs/inventory-launch.component.d.ts +69 -2
- package/lib/components/inventory-runs/inventory-runs.component.d.ts +7 -0
- package/lib/services/models/equipment.service.d.ts +9 -1
- package/lib/services/models/inventory-storage.d.ts +9 -0
- package/lib/services/models/inventory.service.d.ts +14 -2
- package/lib/services/models/operation.service.d.ts +10 -0
- package/lib/services/retry-when-throttled.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1,23 +1,52 @@
|
|
|
1
1
|
import { EventEmitter } from "@angular/core";
|
|
2
2
|
import { InventoryFiles } from "../../services/models/inventory.service";
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
|
+
/** A file of the visit's inventory folder that can be sent, replaced or deleted from here. */
|
|
5
|
+
export interface InventoryEditableFile {
|
|
6
|
+
/** Where the inventory's task looks for it, whatever the file sent was called. */
|
|
7
|
+
name: "model.obj" | "data.json";
|
|
8
|
+
field: "modelObj" | "dataJson";
|
|
9
|
+
accept: string;
|
|
10
|
+
extension: RegExp;
|
|
11
|
+
type: string;
|
|
12
|
+
/** The button when the visit does not have it, as a key to translate. */
|
|
13
|
+
send: string;
|
|
14
|
+
/** Why a file chosen was refused, as a key to translate. */
|
|
15
|
+
wrongFile: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const INVENTORY_MESH_FILE: InventoryEditableFile;
|
|
18
|
+
export declare const INVENTORY_POSITIONS_FILE: InventoryEditableFile;
|
|
4
19
|
/**
|
|
5
20
|
* What a visit has of what its AI inventory needs (InventoryService.checkFiles), and where what is
|
|
6
|
-
* missing comes from, for the screens to show before launching one. The mesh
|
|
7
|
-
*
|
|
21
|
+
* missing comes from, for the screens to show before launching one. The mesh and the panoramas'
|
|
22
|
+
* positions can be sent, replaced or deleted from here; the panoramas come from the visit's import.
|
|
8
23
|
*/
|
|
9
24
|
export declare class InventoryFilesComponent {
|
|
10
25
|
files: InventoryFiles;
|
|
11
|
-
/** Said when the visit
|
|
26
|
+
/** Said when a file of the visit is sent, replaced or deleted from here: [(files)]. */
|
|
12
27
|
filesChange: EventEmitter<InventoryFiles>;
|
|
13
28
|
/** The visit's Matterport model, the folder of its files. */
|
|
14
29
|
model3D: string;
|
|
15
|
-
/**
|
|
30
|
+
/** While an inventory runs or is launched: it reads these files, which must not change. */
|
|
31
|
+
disabled: boolean;
|
|
32
|
+
meshFile: InventoryEditableFile;
|
|
33
|
+
positionsFile: InventoryEditableFile;
|
|
34
|
+
/** The file being sent. */
|
|
35
|
+
sending: InventoryEditableFile;
|
|
36
|
+
/** How much of it is sent, from 0 to 100. */
|
|
16
37
|
uploadPercent: number;
|
|
17
38
|
uploadName: string;
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
|
|
39
|
+
/** The file whose deletion is waiting to be confirmed. */
|
|
40
|
+
confirmingDelete: InventoryEditableFile;
|
|
41
|
+
deletingFile: InventoryEditableFile;
|
|
42
|
+
/** What went wrong, as a key to translate, and with which file. */
|
|
43
|
+
error: string;
|
|
44
|
+
errorFile: InventoryEditableFile;
|
|
45
|
+
/** Whether the files cannot be changed for now. */
|
|
46
|
+
get locked(): boolean;
|
|
47
|
+
private fail;
|
|
48
|
+
onFileSelected(target: InventoryEditableFile, event: Event): Promise<void>;
|
|
49
|
+
onDeleteConfirmed(target: InventoryEditableFile): Promise<void>;
|
|
21
50
|
static ɵfac: i0.ɵɵFactoryDeclaration<InventoryFilesComponent, never>;
|
|
22
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<InventoryFilesComponent, "lib-inventory-files", never, { "files": { "alias": "files"; "required": false; }; "model3D": { "alias": "model3D"; "required": false; }; }, { "filesChange": "filesChange"; }, never, never, false, never>;
|
|
51
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<InventoryFilesComponent, "lib-inventory-files", never, { "files": { "alias": "files"; "required": false; }; "model3D": { "alias": "model3D"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "filesChange": "filesChange"; }, never, never, false, never>;
|
|
23
52
|
}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { EventEmitter, OnChanges, OnInit, SimpleChanges } from "@angular/core";
|
|
2
2
|
import { EquipmentService } from "../../services/models/equipment.service";
|
|
3
|
-
import {
|
|
3
|
+
import { NavigationService } from "../../services/models/navigation.service";
|
|
4
|
+
import { InventoryFiles, InventoryModel, InventoryRun, InventoryService } from "../../services/models/inventory.service";
|
|
4
5
|
import * as i0 from "@angular/core";
|
|
6
|
+
/**
|
|
7
|
+
* How many equipment of the previous inventory are deleted at a time. All at once, hundreds of them
|
|
8
|
+
* at three or more requests each, the API refused part of them and the launch stopped half way; a
|
|
9
|
+
* request it refuses for coming too fast is now sent again (EquipmentService.deleteEquipment).
|
|
10
|
+
*/
|
|
11
|
+
export declare const INVENTORY_DELETE_AT_ONCE = 15;
|
|
5
12
|
/** A visit the AI inventory can look at: its node, its Matterport model (the folder of its files) and its name. */
|
|
6
13
|
export interface InventoryVisit {
|
|
7
14
|
nodeID: string;
|
|
@@ -17,6 +24,7 @@ export interface InventoryVisit {
|
|
|
17
24
|
export declare class InventoryLaunchComponent implements OnInit, OnChanges {
|
|
18
25
|
private inventoryService;
|
|
19
26
|
private equipmentService;
|
|
27
|
+
private navigationService;
|
|
20
28
|
spaceID: string;
|
|
21
29
|
visits: InventoryVisit[];
|
|
22
30
|
/** Only this panorama of the visit, as it is named: 110ee452_sweep.jpeg. */
|
|
@@ -34,21 +42,80 @@ export declare class InventoryLaunchComponent implements OnInit, OnChanges {
|
|
|
34
42
|
deletePrevious: boolean;
|
|
35
43
|
/** How many of the location's equipment the AI added, which deletePrevious deletes. */
|
|
36
44
|
aiEquipmentCount: number;
|
|
45
|
+
/** While the previous inventory is deleted: how many of its equipment are done, of how many. */
|
|
46
|
+
deleting: {
|
|
47
|
+
done: number;
|
|
48
|
+
total: number;
|
|
49
|
+
};
|
|
50
|
+
/** How many equipment of the previous inventory could not be deleted, for the message. */
|
|
51
|
+
notDeleted: number;
|
|
52
|
+
/** Each visit's latest inventory when it is done and all its detections are still kept. */
|
|
53
|
+
reusable: Record<string, InventoryRun>;
|
|
54
|
+
/**
|
|
55
|
+
* The visits with detections kept that nothing is waiting for: their latest inventory is done.
|
|
56
|
+
* A stopped one needs them to resume.
|
|
57
|
+
*/
|
|
58
|
+
discardable: InventoryVisit[];
|
|
59
|
+
confirmingDiscard: boolean;
|
|
60
|
+
discarding: boolean;
|
|
61
|
+
/** Whether the saved detections were just discarded, for the panel to say so. */
|
|
62
|
+
discarded: boolean;
|
|
63
|
+
/** The latest reading of the kept detections: an older one answering late is ignored. */
|
|
64
|
+
private keptCheck;
|
|
65
|
+
/** The latest count of the previous inventory, for the same reason. */
|
|
66
|
+
private countCheck;
|
|
67
|
+
/**
|
|
68
|
+
* Whether the launch places the latest inventories' detections again, with the cutoff chosen,
|
|
69
|
+
* instead of analysing the panoramas: minutes instead of hours.
|
|
70
|
+
*/
|
|
71
|
+
reuseDetections: boolean;
|
|
37
72
|
/** What each visit has of what the inventory needs, by its node; null when the bucket could not be read. */
|
|
38
73
|
visitFiles: Record<string, InventoryFiles>;
|
|
39
74
|
checkingFiles: boolean;
|
|
40
75
|
launching: boolean;
|
|
41
76
|
/** What went wrong, or why nothing was launched, as a key to translate. */
|
|
42
77
|
message: string;
|
|
43
|
-
constructor(inventoryService: InventoryService, equipmentService: EquipmentService);
|
|
78
|
+
constructor(inventoryService: InventoryService, equipmentService: EquipmentService, navigationService: NavigationService);
|
|
44
79
|
ngOnInit(): Promise<void>;
|
|
80
|
+
/** The model and the cutoff score last launched with, from either screen; null when unknown. */
|
|
81
|
+
private lastSettings;
|
|
82
|
+
private keepSettings;
|
|
45
83
|
ngOnChanges(changes: SimpleChanges): void;
|
|
84
|
+
/** Whether the inventory's detections of all its panoramas are among those kept. */
|
|
85
|
+
private keptAll;
|
|
86
|
+
/** What the bucket has of the visits' detections, for their latest inventories that are done. */
|
|
87
|
+
private readKept;
|
|
88
|
+
private findReusable;
|
|
89
|
+
/**
|
|
90
|
+
* Every visit to analyse has a finished inventory of all its panoramas, with all its detections
|
|
91
|
+
* kept: placing them again takes minutes, and analyses nothing. They are placed again under one
|
|
92
|
+
* model, so all must come from the same.
|
|
93
|
+
*/
|
|
94
|
+
get canReuse(): boolean;
|
|
95
|
+
/** The model of the detections placed again: the one the launch uses when it reuses them. */
|
|
96
|
+
get reusedModelName(): string;
|
|
97
|
+
onFilesChange(visit: InventoryVisit, files: InventoryFiles): void;
|
|
98
|
+
/** Deletes the detections kept for the visits whose inventory is done. The equipment stays. */
|
|
99
|
+
onConfirmDiscard(): Promise<void>;
|
|
100
|
+
onReuseChange(reuse: boolean): void;
|
|
46
101
|
private checkFiles;
|
|
47
102
|
/** The visits that will be analysed: those with nothing known to be missing. */
|
|
48
103
|
get launchableVisits(): InventoryVisit[];
|
|
49
104
|
get canLaunch(): boolean;
|
|
50
105
|
onDeletePreviousChange(deletePrevious: boolean): Promise<void>;
|
|
106
|
+
/** Counts what the launch would delete: it depends on the visits analysed. */
|
|
107
|
+
private countPrevious;
|
|
108
|
+
/**
|
|
109
|
+
* The equipment the AI added to the visits analysed, known by the panoramas their tags are at:
|
|
110
|
+
* a visit left out, for a missing file, keeps its own. One whose tag has no panorama cannot be
|
|
111
|
+
* told apart, and is deleted only when every visit is analysed again.
|
|
112
|
+
*/
|
|
51
113
|
private aiEquipments;
|
|
114
|
+
/**
|
|
115
|
+
* Deletes the equipment a few at a time, going on past one that fails (its error logged), and
|
|
116
|
+
* says how many could not be deleted.
|
|
117
|
+
*/
|
|
118
|
+
private deleteFewAtATime;
|
|
52
119
|
onLaunchClick(): Promise<void>;
|
|
53
120
|
static ɵfac: i0.ɵɵFactoryDeclaration<InventoryLaunchComponent, never>;
|
|
54
121
|
static ɵcmp: i0.ɵɵComponentDeclaration<InventoryLaunchComponent, "lib-inventory-launch", never, { "spaceID": { "alias": "spaceID"; "required": false; }; "visits": { "alias": "visits"; "required": false; }; "panorama": { "alias": "panorama"; "required": false; }; "running": { "alias": "running"; "required": false; }; }, { "cancelled": "cancelled"; "launched": "launched"; }, never, never, false, never>;
|
|
@@ -19,6 +19,8 @@ export declare class InventoryRunsComponent implements OnChanges, OnDestroy {
|
|
|
19
19
|
/** Whether one of the inventories shown is running: said when it changes. */
|
|
20
20
|
runningChange: EventEmitter<boolean>;
|
|
21
21
|
runs: InventoryRun[];
|
|
22
|
+
/** Every inventory of the space by its id, for where one that places detections again took them. */
|
|
23
|
+
private byId;
|
|
22
24
|
/** The inventory whose cancelling waits for its confirmation. */
|
|
23
25
|
confirmingCancel: string;
|
|
24
26
|
/** The inventory being cancelled or resumed, its buttons disabled meanwhile. */
|
|
@@ -36,6 +38,11 @@ export declare class InventoryRunsComponent implements OnChanges, OnDestroy {
|
|
|
36
38
|
ngOnChanges(): void;
|
|
37
39
|
ngOnDestroy(): void;
|
|
38
40
|
refresh(): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* The finished inventory whose detections this one places again with its own cutoff, analysing
|
|
43
|
+
* no panorama; null when it analyses them, resuming a stopped one included.
|
|
44
|
+
*/
|
|
45
|
+
reusedFrom(run: InventoryRun): InventoryRun;
|
|
39
46
|
/**
|
|
40
47
|
* About how many minutes the panoramas left will take, at the pace seen since the inventory
|
|
41
48
|
* was first seen analysing them; null until a panorama has been done meanwhile.
|
|
@@ -85,7 +85,15 @@ export declare class EquipmentService extends BaseObjectService {
|
|
|
85
85
|
getPrefixDoc(type: TypeNote): any;
|
|
86
86
|
uploadDocForAllEquipments(equipments: Equipment[], documentFile: File, type: TypeNote): Promise<any[]>;
|
|
87
87
|
uploadDoc(equipment: Equipment, documentFile: File, type: TypeNote): Promise<Note>;
|
|
88
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Deletes an equipment with what hangs on it: every one of its POIs (its tags in the visits), its
|
|
90
|
+
* notes and their files, its operations. Those go first: when one of them fails, the equipment is
|
|
91
|
+
* still there to be deleted again, instead of tags left pointing at an equipment that is gone.
|
|
92
|
+
* A request the API refuses for coming too fast is sent again a little later. justLoaded: the
|
|
93
|
+
* equipment comes from a list loaded just before, whose operations can be trusted, so none there
|
|
94
|
+
* means no request for them.
|
|
95
|
+
*/
|
|
96
|
+
deleteEquipment(equip: Equipment, justLoaded?: boolean): Promise<Equipment>;
|
|
89
97
|
updateEquipmentLocation(equip: Equipment, tagData: MattertagData): Promise<POI>;
|
|
90
98
|
removeTicketFromEquipment(ticket: Ticket, equip: Equipment): Promise<Operation>;
|
|
91
99
|
initEquips(): Promise<void>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deletes one file of a visit's AI inventory, and nothing outside it.
|
|
3
|
+
*
|
|
4
|
+
* The inventory's only S3 delete. It lives here, out of the library's public API, rather than as a
|
|
5
|
+
* generic helper beside the other S3 functions, so that no other code picks it up for something
|
|
6
|
+
* else: it refuses any key outside `visits/<model3D>/inventory/`, and logs every deletion with the
|
|
7
|
+
* reason its caller gives. Rejects when the key is refused or the file could not be deleted.
|
|
8
|
+
*/
|
|
9
|
+
export declare function removeInventoryFile(model3D: string, key: string, reason: string): Promise<void>;
|
|
@@ -70,6 +70,16 @@ export declare class InventoryService {
|
|
|
70
70
|
checkFiles(model3D: string): Promise<InventoryFiles>;
|
|
71
71
|
/** Whether the visit has all its inventory needs. */
|
|
72
72
|
isComplete(files: InventoryFiles): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* How many panoramas' detections each inventory of the visit kept in the bucket, by inventory
|
|
75
|
+
* (machine-learning: inventory_job.py); null when the bucket could not be read.
|
|
76
|
+
*/
|
|
77
|
+
keptDetections(model3D: string): Promise<Record<string, number>>;
|
|
78
|
+
/**
|
|
79
|
+
* Deletes all the detections kept for the visit, going on past a file that fails, and says how
|
|
80
|
+
* many could not be deleted. The equipment placed from them stays.
|
|
81
|
+
*/
|
|
82
|
+
discardDetections(model3D: string): Promise<number>;
|
|
73
83
|
/** The latest inventory of each visit, the latest first. */
|
|
74
84
|
latestOfEachVisit(runs: InventoryRun[]): InventoryRun[];
|
|
75
85
|
isToRun(run: InventoryRun): boolean;
|
|
@@ -104,9 +114,11 @@ export declare class InventoryService {
|
|
|
104
114
|
/**
|
|
105
115
|
* Launches an inventory of each of the visits, unless one is already running in the space:
|
|
106
116
|
* of all their panoramas, or of the one of `sweep` (the first 8 characters of its sweep, as
|
|
107
|
-
* the panoramas are named) when it is given.
|
|
117
|
+
* the panoramas are named) when it is given. A visit given an inventory in `resumeFrom` starts
|
|
118
|
+
* from that one's detections: with all its panoramas analysed, only the placing is done again,
|
|
119
|
+
* with this cutoff.
|
|
108
120
|
*/
|
|
109
|
-
launch(spaceID: string, nodeIDs: string[], model: InventoryModel, cutoffScore: number, sweep?: string): Promise<"LAUNCHED" | "ALREADY_RUNNING">;
|
|
121
|
+
launch(spaceID: string, nodeIDs: string[], model: InventoryModel, cutoffScore: number, sweep?: string, resumeFrom?: Record<string, string>): Promise<"LAUNCHED" | "ALREADY_RUNNING">;
|
|
110
122
|
static ɵfac: i0.ɵɵFactoryDeclaration<InventoryService, never>;
|
|
111
123
|
static ɵprov: i0.ɵɵInjectableDeclaration<InventoryService>;
|
|
112
124
|
}
|
|
@@ -8,11 +8,21 @@ export declare class OperationService {
|
|
|
8
8
|
getOperationsByTicketID(id: string): Promise<Operation[]>;
|
|
9
9
|
getOperationsByEquipmentID(id: string): Promise<Operation[]>;
|
|
10
10
|
getTicketsByEquipmentID(id: string): Promise<Ticket[]>;
|
|
11
|
+
/** Whether a loaded equipment's list query shows it has no operation, none linked since. */
|
|
12
|
+
private loadedWithoutOperations;
|
|
11
13
|
/** Tickets of a loaded equipment, without a request when its list query shows it has no operation. */
|
|
12
14
|
getTicketsForEquipment(equip: {
|
|
13
15
|
id?: string;
|
|
14
16
|
operations?: any;
|
|
15
17
|
}): Promise<Ticket[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Deletes a loaded equipment's operations, without a request when its list query shows it has
|
|
20
|
+
* none: for an equipment loaded just before, as one loaded long ago may have some since.
|
|
21
|
+
*/
|
|
22
|
+
deleteOperationsForLoadedEquipment(equip: {
|
|
23
|
+
id?: string;
|
|
24
|
+
operations?: any;
|
|
25
|
+
}): Promise<Operation[]>;
|
|
16
26
|
deleteOperationsForEquipment(equipID: string): Promise<Operation[]>;
|
|
17
27
|
deleteOperationsForTicket(ticketID: string): Promise<void>;
|
|
18
28
|
deleteOperation(operationID: string): Promise<Operation>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function isThrottled(error: any): boolean;
|
|
2
|
+
/** How long to wait before each new try, give or take half, so that requests do not come back together. */
|
|
3
|
+
export declare const THROTTLED_WAITS_MS: number[];
|
|
4
|
+
/** Sends the request again, a little later each time, while the API refuses it for coming too fast. */
|
|
5
|
+
export declare function retryWhenThrottled<T>(request: () => Promise<T>, waitsMs?: number[]): Promise<T>;
|