@openinc/parse-server-opendash 4.33.0 → 4.35.0
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/dist/featuremap.json +0 -1
- package/dist/features/openservice/alarms/resolveEquipment.js +4 -1
- package/dist/features/openservice/alarms/ticket/AlarmTicketTypes.d.ts +14 -0
- package/dist/features/openservice/alarms/ticket/alarmTicketDefaults.d.ts +34 -0
- package/dist/features/openservice/alarms/ticket/alarmTicketDefaults.js +80 -0
- package/dist/features/openservice/alarms/ticket/createAlarmTicket.js +66 -7
- package/dist/features/openservice/alarms/ticket/ensureAlarmTicketAction.js +21 -21
- package/dist/features/openservice/demoSeed/demoData.d.ts +51 -0
- package/dist/features/openservice/demoSeed/demoData.js +305 -0
- package/dist/features/openservice/demoSeed/demoSeed.d.ts +82 -0
- package/dist/features/openservice/demoSeed/demoSeed.js +424 -0
- package/dist/functions/openinc-openservice-demo-seed.d.ts +21 -0
- package/dist/functions/openinc-openservice-demo-seed.js +63 -0
- package/dist/hooks/Service_Schedule.js +3 -2
- package/dist/types/Service_Schedule.d.ts +0 -3
- package/dist/types/Service_Schedule.js +0 -6
- package/dist/types/Service_Tag.d.ts +3 -0
- package/dist/types/Service_Tag.js +6 -0
- package/dist/types/index.d.ts +0 -2
- package/dist/types/index.js +1 -3
- package/package.json +1 -1
- package/schema/Service_Schedule.json +0 -3
- package/schema/Service_Tag.json +3 -0
- package/dist/hooks/Service_EquipmentAnnotation.d.ts +0 -1
- package/dist/hooks/Service_EquipmentAnnotation.js +0 -15
- package/dist/types/Service_EquipmentAnnotation.d.ts +0 -35
- package/dist/types/Service_EquipmentAnnotation.js +0 -57
- package/schema/Service_EquipmentAnnotation.json +0 -57
package/dist/featuremap.json
CHANGED
|
@@ -115,7 +115,6 @@
|
|
|
115
115
|
"OD3_RAG_Request": "RAG",
|
|
116
116
|
"OD3_Report": "CORE",
|
|
117
117
|
"OD3_Service_Equipment": "SERVICE",
|
|
118
|
-
"OD3_Service_EquipmentAnnotation": "SERVICE",
|
|
119
118
|
"OD3_Service_FormConfig": "SERVICE",
|
|
120
119
|
"OD3_Service_KpiDefinition": "SERVICE",
|
|
121
120
|
"OD3_Service_MigrationMap": "SERVICE",
|
|
@@ -22,12 +22,15 @@ const index_js_1 = require("../../../types/index.js");
|
|
|
22
22
|
*/
|
|
23
23
|
async function resolveEquipment(tenant, event, equipmentId, logPrefix) {
|
|
24
24
|
if (equipmentId) {
|
|
25
|
+
// Master key reads every tenant: the alarm's tenant (from its secret) must
|
|
26
|
+
// own the machine, or a plan would point at another tenant's machine.
|
|
25
27
|
const explicit = await new node_1.default.Query(index_js_1.Service_Equipment)
|
|
26
28
|
.equalTo("objectId", equipmentId)
|
|
29
|
+
.equalTo("tenant", tenant)
|
|
27
30
|
.first({ useMasterKey: true });
|
|
28
31
|
if (explicit)
|
|
29
32
|
return explicit;
|
|
30
|
-
console.warn(`${logPrefix} Configured machine ${equipmentId} does not exist`);
|
|
33
|
+
console.warn(`${logPrefix} Configured machine ${equipmentId} does not exist for this tenant`);
|
|
31
34
|
}
|
|
32
35
|
const candidates = [event.item_id, event.item_source].filter((value) => !!value);
|
|
33
36
|
if (candidates.length === 0)
|
|
@@ -41,6 +41,20 @@ export interface AlarmTicketParams {
|
|
|
41
41
|
assignedUserIds?: string[];
|
|
42
42
|
assignedRoleIds?: string[];
|
|
43
43
|
tagIds?: string[];
|
|
44
|
+
/**
|
|
45
|
+
* Ticket form config (`OD3_Service_FormConfig`) the ticket is created
|
|
46
|
+
* through: its field defaults pre-fill the ticket, its rules run on save.
|
|
47
|
+
* Unset or not the tenant's: the tenant's default form.
|
|
48
|
+
*/
|
|
49
|
+
formConfigId?: string;
|
|
50
|
+
/**
|
|
51
|
+
* The ticket as configured with the ticket form in template mode, under
|
|
52
|
+
* {@link formConfigId}: field values keyed by ticket field, references as
|
|
53
|
+
* ids (see `readTicketDefaults`). Wins over the flat fields above, which
|
|
54
|
+
* alarms configured with the generic form carry; both win over the form
|
|
55
|
+
* config's defaults.
|
|
56
|
+
*/
|
|
57
|
+
ticket?: Record<string, unknown>;
|
|
44
58
|
/**
|
|
45
59
|
* Reopen behaviour. `false` (default) keeps **one open ticket per alarm**: a
|
|
46
60
|
* flapping sensor does not produce a hundred tickets, and closing the ticket
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Values the ticket an alarm creates starts out with — the alarm's template
|
|
3
|
+
* (the ticket form in template mode) or what its form config pre-fills
|
|
4
|
+
* (`defaultValue` of its fields). Both in the form's edit shape: field values
|
|
5
|
+
* keyed by ticket field, references as ids.
|
|
6
|
+
*
|
|
7
|
+
* Read here into exactly the fields a default may set. Dates are left out (a
|
|
8
|
+
* fixed date makes no sense for an alarm that fires later; the config's
|
|
9
|
+
* relative value rules still apply on save), and so are the fields the server
|
|
10
|
+
* owns (tenant, number, origin, closedAt …). Title and description come back
|
|
11
|
+
* apart: the alarm's own title wins over them, and the alarm's details are
|
|
12
|
+
* appended to the description (`alarmTicketFields`). Whether a referenced row
|
|
13
|
+
* belongs to the tenant is the `Service_Ticket` hook's call, as on every write
|
|
14
|
+
* path.
|
|
15
|
+
*/
|
|
16
|
+
export interface AlarmTicketDefaults {
|
|
17
|
+
title?: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
status?: string;
|
|
20
|
+
equipment?: string;
|
|
21
|
+
project?: string;
|
|
22
|
+
/** The remaining fields, ready for `ticket.set`. */
|
|
23
|
+
values: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The defaults of a form config's `fields` (its JSON column). Hidden fields
|
|
27
|
+
* count: the create form keeps them as hidden inputs and saves their default.
|
|
28
|
+
*
|
|
29
|
+
* shortcut: `visibleWhen` is not evaluated — a default of a field hidden by
|
|
30
|
+
* condition is applied anyway; read it with the ticket's values if a config
|
|
31
|
+
* ever relies on that.
|
|
32
|
+
*/
|
|
33
|
+
export declare function formConfigDefaults(fields: string | undefined): AlarmTicketDefaults;
|
|
34
|
+
export declare function readTicketDefaults(raw: unknown): AlarmTicketDefaults;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formConfigDefaults = formConfigDefaults;
|
|
4
|
+
exports.readTicketDefaults = readTicketDefaults;
|
|
5
|
+
const actionParams_js_1 = require("../actionParams.js");
|
|
6
|
+
/** Arrays of ids — the schema stores them as plain id strings. */
|
|
7
|
+
const ID_LISTS = ["tags", "assignedUsers", "assignedRoles"];
|
|
8
|
+
const NUMBERS = [
|
|
9
|
+
"priority",
|
|
10
|
+
"downtime",
|
|
11
|
+
"frequency",
|
|
12
|
+
"restriction",
|
|
13
|
+
"estimatedDuration",
|
|
14
|
+
"actualDuration",
|
|
15
|
+
];
|
|
16
|
+
/** Stored raw, as the ticket form stores them. */
|
|
17
|
+
const JSON_FIELDS = ["checklist", "material"];
|
|
18
|
+
const BOOLEANS = [
|
|
19
|
+
"excludeFromProductionDashboard",
|
|
20
|
+
"useForSimilarCases",
|
|
21
|
+
];
|
|
22
|
+
/**
|
|
23
|
+
* The defaults of a form config's `fields` (its JSON column). Hidden fields
|
|
24
|
+
* count: the create form keeps them as hidden inputs and saves their default.
|
|
25
|
+
*
|
|
26
|
+
* shortcut: `visibleWhen` is not evaluated — a default of a field hidden by
|
|
27
|
+
* condition is applied anyway; read it with the ticket's values if a config
|
|
28
|
+
* ever relies on that.
|
|
29
|
+
*/
|
|
30
|
+
function formConfigDefaults(fields) {
|
|
31
|
+
let entries;
|
|
32
|
+
try {
|
|
33
|
+
entries = JSON.parse(fields ?? "[]");
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
entries = [];
|
|
37
|
+
}
|
|
38
|
+
const raw = {};
|
|
39
|
+
for (const entry of Array.isArray(entries) ? entries : []) {
|
|
40
|
+
if (typeof entry?.key === "string" && entry.defaultValue != null) {
|
|
41
|
+
raw[entry.key] = entry.defaultValue;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return readTicketDefaults(raw);
|
|
45
|
+
}
|
|
46
|
+
function readTicketDefaults(raw) {
|
|
47
|
+
const source = raw && typeof raw === "object" && !Array.isArray(raw)
|
|
48
|
+
? raw
|
|
49
|
+
: {};
|
|
50
|
+
const values = {};
|
|
51
|
+
for (const key of ID_LISTS) {
|
|
52
|
+
const list = Array.isArray(source[key]) ? source[key] : [];
|
|
53
|
+
const ids = list
|
|
54
|
+
.map(actionParams_js_1.paramId)
|
|
55
|
+
.filter((id) => id !== undefined);
|
|
56
|
+
if (ids.length > 0)
|
|
57
|
+
values[key] = ids;
|
|
58
|
+
}
|
|
59
|
+
for (const key of NUMBERS) {
|
|
60
|
+
const value = (0, actionParams_js_1.paramNumber)(source[key]);
|
|
61
|
+
if (value !== undefined)
|
|
62
|
+
values[key] = value;
|
|
63
|
+
}
|
|
64
|
+
for (const key of JSON_FIELDS) {
|
|
65
|
+
if (source[key] != null)
|
|
66
|
+
values[key] = source[key];
|
|
67
|
+
}
|
|
68
|
+
for (const key of BOOLEANS) {
|
|
69
|
+
if (typeof source[key] === "boolean")
|
|
70
|
+
values[key] = source[key];
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
title: (0, actionParams_js_1.paramString)(source.title),
|
|
74
|
+
description: (0, actionParams_js_1.paramString)(source.description),
|
|
75
|
+
status: (0, actionParams_js_1.paramId)(source.status),
|
|
76
|
+
equipment: (0, actionParams_js_1.paramId)(source.equipment),
|
|
77
|
+
project: (0, actionParams_js_1.paramId)(source.project),
|
|
78
|
+
values,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
@@ -8,11 +8,13 @@ exports.tenantForAlarmTicket = tenantForAlarmTicket;
|
|
|
8
8
|
const node_1 = __importDefault(require("parse/node"));
|
|
9
9
|
const openservice_shared_1 = require("@opendash/openservice-shared");
|
|
10
10
|
const index_js_1 = require("../../../../types/index.js");
|
|
11
|
+
const ticketFormConfig_js_1 = require("../../tickets/ticketFormConfig.js");
|
|
11
12
|
const actionParams_js_1 = require("../actionParams.js");
|
|
12
13
|
const alarmIdentity_js_1 = require("../alarmIdentity.js");
|
|
13
14
|
const resolveEquipment_js_1 = require("../resolveEquipment.js");
|
|
14
15
|
const tenantForSecret_js_1 = require("../tenantForSecret.js");
|
|
15
16
|
const alarmTicketFields_js_1 = require("./alarmTicketFields.js");
|
|
17
|
+
const alarmTicketDefaults_js_1 = require("./alarmTicketDefaults.js");
|
|
16
18
|
const AlarmTicketTypes_js_1 = require("./AlarmTicketTypes.js");
|
|
17
19
|
/**
|
|
18
20
|
* Create the ticket a fired alarm asks for — or return the one that is already
|
|
@@ -31,13 +33,25 @@ async function createAlarmTicket(tenant, event, rawParams = {}) {
|
|
|
31
33
|
if (!(0, alarmIdentity_js_1.alarmKey)(event)) {
|
|
32
34
|
throw new node_1.default.Error(node_1.default.Error.INVALID_QUERY, "The alarm payload identifies no alarm: pass alarmId, or item_source/item_id.");
|
|
33
35
|
}
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
//
|
|
36
|
+
// The ticket is created through a form config, as in the frontend. Per
|
|
37
|
+
// field the alarm's template wins (the ticket form in template mode), then
|
|
38
|
+
// the flat fields of the generic action form, then the config's defaults.
|
|
39
|
+
// Same normalisation as the schedule action for the flat ones: references
|
|
40
|
+
// can arrive as whole objects from alarms configured before the form set a
|
|
41
|
+
// `valueField` (see `actionParams.ts`).
|
|
42
|
+
const config = await alarmFormConfig(tenant, (0, actionParams_js_1.paramId)(rawParams.formConfigId));
|
|
43
|
+
const template = (0, alarmTicketDefaults_js_1.readTicketDefaults)(rawParams.ticket);
|
|
44
|
+
const defaults = (0, alarmTicketDefaults_js_1.formConfigDefaults)(config?.fields);
|
|
37
45
|
const params = {
|
|
38
46
|
...rawParams,
|
|
39
|
-
|
|
40
|
-
|
|
47
|
+
title: template.title ?? (0, actionParams_js_1.paramString)(rawParams.title) ?? defaults.title,
|
|
48
|
+
description: template.description ??
|
|
49
|
+
(0, actionParams_js_1.paramString)(rawParams.description) ??
|
|
50
|
+
defaults.description,
|
|
51
|
+
equipmentId: template.equipment ??
|
|
52
|
+
(0, actionParams_js_1.paramId)(rawParams.equipmentId) ??
|
|
53
|
+
defaults.equipment,
|
|
54
|
+
projectId: template.project ?? (0, actionParams_js_1.paramId)(rawParams.projectId) ?? defaults.project,
|
|
41
55
|
};
|
|
42
56
|
const fields = (0, alarmTicketFields_js_1.alarmTicketFields)(event, params);
|
|
43
57
|
if (!params.duplicate) {
|
|
@@ -51,7 +65,8 @@ async function createAlarmTicket(tenant, event, rawParams = {}) {
|
|
|
51
65
|
};
|
|
52
66
|
}
|
|
53
67
|
}
|
|
54
|
-
const status = await
|
|
68
|
+
const status = (await presetStatus(tenant, template.status ?? defaults.status)) ??
|
|
69
|
+
(await resolveDefaultStatus(tenant));
|
|
55
70
|
if (!status) {
|
|
56
71
|
throw new node_1.default.Error(node_1.default.Error.INVALID_QUERY, `No "${openservice_shared_1.DEFAULT_STATUS_CATEGORY}" status configured for this tenant — cannot create a ticket.`);
|
|
57
72
|
}
|
|
@@ -68,6 +83,11 @@ async function createAlarmTicket(tenant, event, rawParams = {}) {
|
|
|
68
83
|
ticket.set("startDate", (0, alarmIdentity_js_1.firedAt)(event));
|
|
69
84
|
if (equipment)
|
|
70
85
|
ticket.set("equipment", equipment);
|
|
86
|
+
// The config's remaining defaults first: the flat fields below and the
|
|
87
|
+
// template after them override them.
|
|
88
|
+
for (const [key, value] of Object.entries(defaults.values)) {
|
|
89
|
+
ticket.set(key, value);
|
|
90
|
+
}
|
|
71
91
|
if (params.priority != null)
|
|
72
92
|
ticket.set("priority", params.priority);
|
|
73
93
|
if (params.projectId) {
|
|
@@ -85,7 +105,16 @@ async function createAlarmTicket(tenant, event, rawParams = {}) {
|
|
|
85
105
|
}
|
|
86
106
|
if (params.tagIds?.length)
|
|
87
107
|
ticket.set("tags", params.tagIds);
|
|
88
|
-
|
|
108
|
+
for (const [key, value] of Object.entries(template.values)) {
|
|
109
|
+
ticket.set(key, value);
|
|
110
|
+
}
|
|
111
|
+
// Naming the config makes the `Service_Ticket` hook run exactly its rules
|
|
112
|
+
// (priority formula, value rules, action rules). The hook also rejects master
|
|
113
|
+
// data of another tenant, as on every other way a ticket is written.
|
|
114
|
+
await ticket.save(null, {
|
|
115
|
+
useMasterKey: true,
|
|
116
|
+
context: { formConfig: config?.id },
|
|
117
|
+
});
|
|
89
118
|
return {
|
|
90
119
|
ticketId: ticket.id,
|
|
91
120
|
created: true,
|
|
@@ -114,6 +143,36 @@ async function findOpenTicket(tenant, origin) {
|
|
|
114
143
|
return !(0, openservice_shared_1.isDoneCategory)(category);
|
|
115
144
|
});
|
|
116
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* The form config the alarm names, if it is the tenant's — else the tenant's
|
|
148
|
+
* default form, the one a save without a user gets (`applicableFormConfig`).
|
|
149
|
+
*/
|
|
150
|
+
async function alarmFormConfig(tenant, id) {
|
|
151
|
+
const chosen = await (0, ticketFormConfig_js_1.configFromContext)(id, tenant, {
|
|
152
|
+
master: true,
|
|
153
|
+
sessionToken: undefined,
|
|
154
|
+
});
|
|
155
|
+
if (id && !chosen) {
|
|
156
|
+
console.warn(`[${AlarmTicketTypes_js_1.ALARM_TICKET_ACTION_ID}] Form config ${id} is not this tenant's — using the tenant's default form`);
|
|
157
|
+
}
|
|
158
|
+
return chosen ?? (await (0, ticketFormConfig_js_1.applicableFormConfig)(tenant, undefined));
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* The status the template or the form config names, if it is the tenant's or
|
|
162
|
+
* a global one.
|
|
163
|
+
*/
|
|
164
|
+
async function presetStatus(tenant, statusId) {
|
|
165
|
+
if (!statusId)
|
|
166
|
+
return undefined;
|
|
167
|
+
const status = await node_1.default.Query.or(new node_1.default.Query(index_js_1.Service_Status).equalTo("tenant", tenant), new node_1.default.Query(index_js_1.Service_Status).doesNotExist("tenant"))
|
|
168
|
+
.equalTo("objectId", statusId)
|
|
169
|
+
.equalTo("deleted", false)
|
|
170
|
+
.first({ useMasterKey: true });
|
|
171
|
+
if (!status) {
|
|
172
|
+
console.warn(`[${AlarmTicketTypes_js_1.ALARM_TICKET_ACTION_ID}] Preset status ${statusId} is not available — using the inbox`);
|
|
173
|
+
}
|
|
174
|
+
return status;
|
|
175
|
+
}
|
|
117
176
|
/** The tenant's inbox status, else a global one — never another tenant's. */
|
|
118
177
|
async function resolveDefaultStatus(tenant) {
|
|
119
178
|
// Only this tenant's and the global ones: across all tenants a plain `find`
|
|
@@ -85,22 +85,40 @@ async function ensureAlarmTicketAction() {
|
|
|
85
85
|
* `AlarmTicketParams` — the executor hands the form's values back to us as
|
|
86
86
|
* `params`.
|
|
87
87
|
*
|
|
88
|
+
* The ticket's content comes from a **ticket form** of the administration
|
|
89
|
+
* (its field defaults and rules), so the alarm only adds what is its own:
|
|
90
|
+
* title, note, machine.
|
|
91
|
+
*
|
|
88
92
|
* The machine is a plain picker rather than something derived from the sensor,
|
|
89
93
|
* because nothing in the data model links the two. Whoever sets the alarm up
|
|
90
94
|
* knows which machine it watches; guessing it later is worse than asking now.
|
|
91
95
|
*/
|
|
92
96
|
const FORM_FIELDS = [
|
|
97
|
+
{
|
|
98
|
+
key: "formConfigId",
|
|
99
|
+
label: "Ticketformular",
|
|
100
|
+
type: "select.parse",
|
|
101
|
+
settings: {
|
|
102
|
+
className: index_js_1.Service_FormConfig.className,
|
|
103
|
+
displayField: "label",
|
|
104
|
+
mode: "single",
|
|
105
|
+
// Without this the picker stores the whole selected object instead of
|
|
106
|
+
// its id — see actionParams.ts.
|
|
107
|
+
valueField: "objectId",
|
|
108
|
+
},
|
|
109
|
+
hint: "Das Ticket entsteht wie über dieses Formular: mit seinen Standardwerten und Regeln. Leer = Standardformular.",
|
|
110
|
+
},
|
|
93
111
|
{
|
|
94
112
|
key: "title",
|
|
95
113
|
label: "Titel des Tickets",
|
|
96
114
|
type: "input",
|
|
97
|
-
hint: "Platzhalter: {{alarm}}, {{sensor}}, {{value}}. Leer = Name des Alarms.",
|
|
115
|
+
hint: "Platzhalter: {{alarm}}, {{sensor}}, {{value}}. Leer = Titel aus dem Formular, sonst Name des Alarms.",
|
|
98
116
|
},
|
|
99
117
|
{
|
|
100
118
|
key: "description",
|
|
101
119
|
label: "Notiz",
|
|
102
120
|
type: "textarea",
|
|
103
|
-
hint: "
|
|
121
|
+
hint: "Leer = Beschreibung aus dem Formular. Sensor, Wert, Regel und Zeitpunkt kommen automatisch dazu.",
|
|
104
122
|
},
|
|
105
123
|
{
|
|
106
124
|
key: "equipmentId",
|
|
@@ -114,25 +132,7 @@ const FORM_FIELDS = [
|
|
|
114
132
|
// its id — see actionParams.ts.
|
|
115
133
|
valueField: "objectId",
|
|
116
134
|
},
|
|
117
|
-
hint: "Ohne Angabe wird über die Quellen-Tags der Maschine geraten
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
key: "projectId",
|
|
121
|
-
label: "Projekt",
|
|
122
|
-
type: "select.parse",
|
|
123
|
-
settings: {
|
|
124
|
-
className: "OD3_Service_Project",
|
|
125
|
-
displayField: "label",
|
|
126
|
-
mode: "single",
|
|
127
|
-
// Without this the picker stores the whole selected object instead of
|
|
128
|
-
// its id — see actionParams.ts.
|
|
129
|
-
valueField: "objectId",
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
key: "priority",
|
|
134
|
-
label: "Priorität",
|
|
135
|
-
type: "input.number",
|
|
135
|
+
hint: "Ohne Angabe die Maschine aus dem Formular, sonst wird über die Quellen-Tags der Maschine geraten.",
|
|
136
136
|
},
|
|
137
137
|
{
|
|
138
138
|
key: "duplicate",
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export interface DemoStep {
|
|
2
|
+
id: string;
|
|
3
|
+
order: number;
|
|
4
|
+
title: string;
|
|
5
|
+
description: string;
|
|
6
|
+
required: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface DemoCadence {
|
|
9
|
+
kind: "rrule" | "manual";
|
|
10
|
+
rrule?: string;
|
|
11
|
+
dtstart?: string;
|
|
12
|
+
timezone?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface DemoSchedule {
|
|
15
|
+
title: string;
|
|
16
|
+
/** Index into {@link DEMO_MACHINES}. */
|
|
17
|
+
machine: number;
|
|
18
|
+
cadence: DemoCadence;
|
|
19
|
+
color?: string;
|
|
20
|
+
leadDays?: number;
|
|
21
|
+
graceDays?: number;
|
|
22
|
+
escalationAfterDays?: number;
|
|
23
|
+
pausedUntil?: Date;
|
|
24
|
+
origin?: string;
|
|
25
|
+
asset?: Record<string, unknown>;
|
|
26
|
+
/** Completed executions, in days ago, newest first. */
|
|
27
|
+
history: number[];
|
|
28
|
+
steps: DemoStep[];
|
|
29
|
+
}
|
|
30
|
+
export interface DemoTemplate {
|
|
31
|
+
title: string;
|
|
32
|
+
description: string;
|
|
33
|
+
cadence: DemoCadence;
|
|
34
|
+
steps: DemoStep[];
|
|
35
|
+
}
|
|
36
|
+
export declare const DEMO_HALL = "Halle B";
|
|
37
|
+
export declare const DEMO_MACHINES: string[];
|
|
38
|
+
declare const daysAgo: (n: number) => Date;
|
|
39
|
+
/**
|
|
40
|
+
* Built per call: step ids must be fresh, and every date is relative to now.
|
|
41
|
+
*
|
|
42
|
+
* `history` drives the executions and is what makes the forecast card show
|
|
43
|
+
* four different answers:
|
|
44
|
+
* - a steady rhythm → a date with high confidence
|
|
45
|
+
* - shrinking gaps → a date plus "intervals getting shorter"
|
|
46
|
+
* - erratic gaps → no date, "no dependable rhythm"
|
|
47
|
+
* - fewer than four → no date, "not enough history yet"
|
|
48
|
+
*/
|
|
49
|
+
export declare function demoSchedules(): DemoSchedule[];
|
|
50
|
+
export declare function demoTemplates(): DemoTemplate[];
|
|
51
|
+
export { daysAgo as demoDaysAgo };
|