@openinc/parse-server-opendash 4.32.6 → 4.34.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/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/features/openware/helper/mesSourceScope.d.ts +18 -0
- package/dist/features/openware/helper/mesSourceScope.js +144 -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/BDE_WorkOrder.js +26 -1
- package/dist/hooks/MES_Order.js +12 -0
- package/dist/hooks/MES_OrderPlan.js +17 -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/package.json +1 -1
- package/schema/BDE_ShiftException.json +10 -10
- package/schema/BDE_ShiftModel.json +7 -7
- package/schema/BDE_WorkOrder.json +6 -6
- package/schema/Chat_Message.json +6 -6
- package/schema/Core_RequestTemplate.json +33 -28
- package/schema/MES_RessourceOverview.json +74 -0
- package/schema/OWPlcDeviceTemplate.json +44 -0
- package/schema/RAG_Data.json +0 -5
- package/schema/Service_Schedule.json +0 -3
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.init = init;
|
|
4
4
|
const index_js_1 = require("../features/schema/index.js");
|
|
5
|
+
const mesSourceScope_js_1 = require("../features/openware/helper/mesSourceScope.js");
|
|
5
6
|
const index_js_2 = require("../types/index.js");
|
|
6
7
|
async function init() {
|
|
7
8
|
(0, index_js_1.beforeSaveHook)(index_js_2.BDE_WorkOrder, async (request) => {
|
|
@@ -10,7 +11,31 @@ async function init() {
|
|
|
10
11
|
// Workers at the BDE terminal set the status when they start, pause or
|
|
11
12
|
// complete a work order.
|
|
12
13
|
await (0, index_js_1.defaultAclHandler)(request, { allowTenantUserWrite: true });
|
|
13
|
-
//
|
|
14
|
+
// A work order of an order plan runs on the plan's source or below it.
|
|
15
|
+
const planId = object.get("orderPlan")?.id;
|
|
16
|
+
if (planId) {
|
|
17
|
+
// `sources` is a relation: the save carries what is added and removed.
|
|
18
|
+
const op = object.op("sources");
|
|
19
|
+
let sourceIds = op?.relationsToAdd ?? [];
|
|
20
|
+
// Moved to another plan: the sources it already has count as well.
|
|
21
|
+
if (original && original.get("orderPlan")?.id !== planId) {
|
|
22
|
+
const removed = new Set(op?.relationsToRemove ?? []);
|
|
23
|
+
const current = await object
|
|
24
|
+
.relation("sources")
|
|
25
|
+
.query()
|
|
26
|
+
.limit(1000)
|
|
27
|
+
.find({ useMasterKey: true });
|
|
28
|
+
sourceIds = [
|
|
29
|
+
...sourceIds,
|
|
30
|
+
...current
|
|
31
|
+
.map((source) => source.id)
|
|
32
|
+
.filter((id) => !!id && !removed.has(id)),
|
|
33
|
+
];
|
|
34
|
+
}
|
|
35
|
+
if (sourceIds.length) {
|
|
36
|
+
await (0, mesSourceScope_js_1.assertWithinScope)(sourceIds, await (0, mesSourceScope_js_1.planScope)(planId), "A work order");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
14
39
|
});
|
|
15
40
|
(0, index_js_1.afterSaveHook)(index_js_2.BDE_WorkOrder, async (request) => {
|
|
16
41
|
const { object, original, user } = request;
|
package/dist/hooks/MES_Order.js
CHANGED
|
@@ -41,6 +41,7 @@ const node_1 = __importDefault(require("parse/node"));
|
|
|
41
41
|
const cron = __importStar(require("cron"));
|
|
42
42
|
const cron_1 = require("cron");
|
|
43
43
|
const index_js_1 = require("../features/openware/index.js");
|
|
44
|
+
const mesSourceScope_js_1 = require("../features/openware/helper/mesSourceScope.js");
|
|
44
45
|
const index_js_2 = require("../features/schema/index.js");
|
|
45
46
|
const index_js_3 = require("../types/index.js");
|
|
46
47
|
// Tolerance for client/server clock skew when comparing `start` against `now`.
|
|
@@ -85,6 +86,17 @@ async function init() {
|
|
|
85
86
|
allowCustomACL: true,
|
|
86
87
|
allowTenantUserWrite: true,
|
|
87
88
|
});
|
|
89
|
+
// A production order of an order plan runs on the plan's source or below
|
|
90
|
+
// it. Checked first: further down, a running order ends other orders.
|
|
91
|
+
const planId = object.get("orderPlan")?.id;
|
|
92
|
+
const sourceId = object.get("source")?.id;
|
|
93
|
+
if (planId &&
|
|
94
|
+
sourceId &&
|
|
95
|
+
(!original ||
|
|
96
|
+
original.get("orderPlan")?.id !== planId ||
|
|
97
|
+
original.get("source")?.id !== sourceId)) {
|
|
98
|
+
await (0, mesSourceScope_js_1.assertWithinScope)([sourceId], await (0, mesSourceScope_js_1.planScope)(planId), "A production order");
|
|
99
|
+
}
|
|
88
100
|
if (!object.tag) {
|
|
89
101
|
const source = await object.get("source")?.fetch({ useMasterKey: true });
|
|
90
102
|
if (!source || !source.tag) {
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.init = init;
|
|
7
7
|
const node_1 = __importDefault(require("parse/node"));
|
|
8
8
|
const index_js_1 = require("../features/schema/index.js");
|
|
9
|
+
const mesSourceScope_js_1 = require("../features/openware/helper/mesSourceScope.js");
|
|
9
10
|
const index_js_2 = require("../types/index.js");
|
|
10
11
|
/** Upper bound for walking up the order tree; guards against corrupt data. */
|
|
11
12
|
const MAX_DEPTH = 50;
|
|
@@ -20,6 +21,22 @@ async function init() {
|
|
|
20
21
|
if (object.dirty("parentOrder")) {
|
|
21
22
|
await assertNoCycle(object);
|
|
22
23
|
}
|
|
24
|
+
// A sub order stays within the source of its parent plan, and a plan's
|
|
25
|
+
// new source (or parent) still has to hold everything below it.
|
|
26
|
+
const sourceId = object.get("source")?.id;
|
|
27
|
+
const parentId = object.get("parentOrder")?.id;
|
|
28
|
+
const sourceChanged = !original || original.get("source")?.id !== sourceId;
|
|
29
|
+
const parentChanged = !original || original.get("parentOrder")?.id !== parentId;
|
|
30
|
+
if (sourceChanged || parentChanged) {
|
|
31
|
+
const parentScope = await (0, mesSourceScope_js_1.planScope)(parentId);
|
|
32
|
+
if (sourceId) {
|
|
33
|
+
await (0, mesSourceScope_js_1.assertWithinScope)([sourceId], parentScope, "A sub order");
|
|
34
|
+
}
|
|
35
|
+
// With a source of its own, a new parent leaves the scope unchanged.
|
|
36
|
+
if (original && object.id && (sourceChanged || !sourceId)) {
|
|
37
|
+
await (0, mesSourceScope_js_1.assertContentWithinScope)(object.id, sourceId ?? parentScope);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
23
40
|
});
|
|
24
41
|
(0, index_js_1.afterSaveHook)(index_js_2.MES_OrderPlan, async (request) => {
|
|
25
42
|
const { object, original, user } = request;
|
|
@@ -9,6 +9,7 @@ const index_js_1 = require("../features/schema/index.js");
|
|
|
9
9
|
const Permissions_js_1 = require("../features/permissions/types/Permissions.js");
|
|
10
10
|
const index_js_2 = require("../features/permissions/index.js");
|
|
11
11
|
const assignmentAcl_js_1 = require("../features/openservice/serviceSchedules/assignmentAcl.js");
|
|
12
|
+
const demoSeed_js_1 = require("../features/openservice/demoSeed/demoSeed.js");
|
|
12
13
|
const index_js_3 = require("../features/openservice/serviceSchedules/calendarSync/index.js");
|
|
13
14
|
const index_js_4 = require("../types/index.js");
|
|
14
15
|
async function init() {
|
|
@@ -80,8 +81,8 @@ async function init() {
|
|
|
80
81
|
// poller marks its own writes with this flag.
|
|
81
82
|
if (context?.[index_js_3.CALENDAR_SYNC_CONTEXT_FLAG])
|
|
82
83
|
return;
|
|
83
|
-
//
|
|
84
|
-
if (
|
|
84
|
+
// Demo data belongs to a demo tenant, not in anybody's calendar.
|
|
85
|
+
if (context?.[demoSeed_js_1.DEMO_SEED_CONTEXT_FLAG])
|
|
85
86
|
return;
|
|
86
87
|
if (!original || calendarRelevantChange(object, original)) {
|
|
87
88
|
// Deliberately not awaited: the calendar is a downstream system, and a
|
|
@@ -26,7 +26,6 @@ export interface Service_ScheduleAttributes {
|
|
|
26
26
|
notifications: any[];
|
|
27
27
|
origin?: string | undefined;
|
|
28
28
|
pausedUntil?: Date | undefined;
|
|
29
|
-
seed?: boolean | undefined;
|
|
30
29
|
serviceProviders?: any[] | undefined;
|
|
31
30
|
steps: any[];
|
|
32
31
|
tenant: Tenant;
|
|
@@ -69,8 +68,6 @@ export declare class Service_Schedule extends Parse.Object<Service_ScheduleAttri
|
|
|
69
68
|
set origin(value: string | undefined);
|
|
70
69
|
get pausedUntil(): Date | undefined;
|
|
71
70
|
set pausedUntil(value: Date | undefined);
|
|
72
|
-
get seed(): boolean | undefined;
|
|
73
|
-
set seed(value: boolean | undefined);
|
|
74
71
|
get serviceProviders(): any[] | undefined;
|
|
75
72
|
set serviceProviders(value: any[] | undefined);
|
|
76
73
|
get steps(): any[];
|
|
@@ -109,12 +109,6 @@ class Service_Schedule extends node_1.default.Object {
|
|
|
109
109
|
set pausedUntil(value) {
|
|
110
110
|
super.set("pausedUntil", value);
|
|
111
111
|
}
|
|
112
|
-
get seed() {
|
|
113
|
-
return super.get("seed");
|
|
114
|
-
}
|
|
115
|
-
set seed(value) {
|
|
116
|
-
super.set("seed", value);
|
|
117
|
-
}
|
|
118
112
|
get serviceProviders() {
|
|
119
113
|
return super.get("serviceProviders");
|
|
120
114
|
}
|
package/package.json
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"fields": {
|
|
3
|
-
"
|
|
4
|
-
"type": "
|
|
5
|
-
"required":
|
|
3
|
+
"end": {
|
|
4
|
+
"type": "Date",
|
|
5
|
+
"required": true
|
|
6
6
|
},
|
|
7
7
|
"kind": {
|
|
8
8
|
"type": "String",
|
|
9
9
|
"required": true
|
|
10
10
|
},
|
|
11
|
-
"
|
|
12
|
-
"type": "
|
|
13
|
-
"required":
|
|
14
|
-
},
|
|
15
|
-
"end": {
|
|
16
|
-
"type": "Date",
|
|
17
|
-
"required": true
|
|
11
|
+
"label": {
|
|
12
|
+
"type": "String",
|
|
13
|
+
"required": false
|
|
18
14
|
},
|
|
19
15
|
"sources": {
|
|
20
16
|
"type": "Array",
|
|
21
17
|
"required": false,
|
|
22
18
|
"defaultValue": []
|
|
23
19
|
},
|
|
20
|
+
"start": {
|
|
21
|
+
"type": "Date",
|
|
22
|
+
"required": true
|
|
23
|
+
},
|
|
24
24
|
"tenant": {
|
|
25
25
|
"type": "Pointer",
|
|
26
26
|
"targetClass": "{{PREFIX}}Tenant",
|
|
@@ -14,23 +14,23 @@
|
|
|
14
14
|
"required": false,
|
|
15
15
|
"defaultValue": []
|
|
16
16
|
},
|
|
17
|
-
"
|
|
18
|
-
"type": "
|
|
17
|
+
"tenant": {
|
|
18
|
+
"type": "Pointer",
|
|
19
|
+
"targetClass": "{{PREFIX}}Tenant",
|
|
19
20
|
"required": false
|
|
20
21
|
},
|
|
21
22
|
"timezone": {
|
|
22
23
|
"type": "String",
|
|
23
24
|
"required": false
|
|
24
25
|
},
|
|
25
|
-
"tenant": {
|
|
26
|
-
"type": "Pointer",
|
|
27
|
-
"targetClass": "{{PREFIX}}Tenant",
|
|
28
|
-
"required": false
|
|
29
|
-
},
|
|
30
26
|
"user": {
|
|
31
27
|
"type": "Pointer",
|
|
32
28
|
"targetClass": "_User",
|
|
33
29
|
"required": false
|
|
30
|
+
},
|
|
31
|
+
"validFrom": {
|
|
32
|
+
"type": "Date",
|
|
33
|
+
"required": false
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"classLevelPermissions": {
|
|
@@ -56,12 +56,6 @@
|
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
"classLevelPermissions": {
|
|
59
|
-
"ACL": {
|
|
60
|
-
"*": {
|
|
61
|
-
"read": true,
|
|
62
|
-
"write": true
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
59
|
"find": {
|
|
66
60
|
"*": true
|
|
67
61
|
},
|
|
@@ -85,6 +79,12 @@
|
|
|
85
79
|
},
|
|
86
80
|
"protectedFields": {
|
|
87
81
|
"*": []
|
|
82
|
+
},
|
|
83
|
+
"ACL": {
|
|
84
|
+
"*": {
|
|
85
|
+
"read": true,
|
|
86
|
+
"write": true
|
|
87
|
+
}
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
}
|
package/schema/Chat_Message.json
CHANGED
|
@@ -54,12 +54,6 @@
|
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"classLevelPermissions": {
|
|
57
|
-
"ACL": {
|
|
58
|
-
"*": {
|
|
59
|
-
"read": true,
|
|
60
|
-
"write": true
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
57
|
"find": {
|
|
64
58
|
"*": true
|
|
65
59
|
},
|
|
@@ -83,6 +77,12 @@
|
|
|
83
77
|
},
|
|
84
78
|
"protectedFields": {
|
|
85
79
|
"*": []
|
|
80
|
+
},
|
|
81
|
+
"ACL": {
|
|
82
|
+
"*": {
|
|
83
|
+
"read": true,
|
|
84
|
+
"write": true
|
|
85
|
+
}
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
}
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"fields": {
|
|
3
|
-
"
|
|
4
|
-
"type": "
|
|
5
|
-
"required":
|
|
3
|
+
"allowedMethods": {
|
|
4
|
+
"type": "Array",
|
|
5
|
+
"required": false
|
|
6
6
|
},
|
|
7
|
-
"
|
|
8
|
-
"type": "
|
|
9
|
-
"required":
|
|
10
|
-
"defaultValue":
|
|
7
|
+
"allowPath": {
|
|
8
|
+
"type": "Boolean",
|
|
9
|
+
"required": false,
|
|
10
|
+
"defaultValue": false
|
|
11
|
+
},
|
|
12
|
+
"body": {
|
|
13
|
+
"type": "Object",
|
|
14
|
+
"required": false
|
|
11
15
|
},
|
|
12
16
|
"description": {
|
|
13
17
|
"type": "String",
|
|
14
18
|
"required": false
|
|
15
19
|
},
|
|
16
|
-
"
|
|
20
|
+
"headers": {
|
|
21
|
+
"type": "Object",
|
|
22
|
+
"required": false
|
|
23
|
+
},
|
|
24
|
+
"identifier": {
|
|
17
25
|
"type": "String",
|
|
18
26
|
"required": true
|
|
19
27
|
},
|
|
@@ -21,39 +29,31 @@
|
|
|
21
29
|
"type": "String",
|
|
22
30
|
"required": false
|
|
23
31
|
},
|
|
24
|
-
"
|
|
25
|
-
"type": "
|
|
26
|
-
"required":
|
|
27
|
-
|
|
28
|
-
"allowPath": {
|
|
29
|
-
"type": "Boolean",
|
|
30
|
-
"required": false,
|
|
31
|
-
"defaultValue": false
|
|
32
|
-
},
|
|
33
|
-
"headers": {
|
|
34
|
-
"type": "Object",
|
|
35
|
-
"required": false
|
|
32
|
+
"priority": {
|
|
33
|
+
"type": "Number",
|
|
34
|
+
"required": true,
|
|
35
|
+
"defaultValue": 0
|
|
36
36
|
},
|
|
37
37
|
"query": {
|
|
38
38
|
"type": "Object",
|
|
39
39
|
"required": false
|
|
40
40
|
},
|
|
41
|
-
"
|
|
41
|
+
"secrets": {
|
|
42
42
|
"type": "Object",
|
|
43
43
|
"required": false
|
|
44
44
|
},
|
|
45
|
-
"
|
|
46
|
-
"type": "
|
|
45
|
+
"tenant": {
|
|
46
|
+
"type": "Pointer",
|
|
47
|
+
"targetClass": "{{PREFIX}}Tenant",
|
|
47
48
|
"required": false
|
|
48
49
|
},
|
|
49
50
|
"timeout": {
|
|
50
51
|
"type": "Number",
|
|
51
52
|
"required": false
|
|
52
53
|
},
|
|
53
|
-
"
|
|
54
|
-
"type": "
|
|
55
|
-
"
|
|
56
|
-
"required": false
|
|
54
|
+
"url": {
|
|
55
|
+
"type": "String",
|
|
56
|
+
"required": true
|
|
57
57
|
},
|
|
58
58
|
"user": {
|
|
59
59
|
"type": "Pointer",
|
|
@@ -82,7 +82,12 @@
|
|
|
82
82
|
},
|
|
83
83
|
"addField": {},
|
|
84
84
|
"protectedFields": {
|
|
85
|
-
"*": [
|
|
85
|
+
"*": [
|
|
86
|
+
"secrets",
|
|
87
|
+
"headers",
|
|
88
|
+
"query",
|
|
89
|
+
"body"
|
|
90
|
+
],
|
|
86
91
|
"role:od-admin": []
|
|
87
92
|
}
|
|
88
93
|
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"fields": {
|
|
3
|
+
"description": {
|
|
4
|
+
"type": "String",
|
|
5
|
+
"required": false
|
|
6
|
+
},
|
|
7
|
+
"image": {
|
|
8
|
+
"type": "File",
|
|
9
|
+
"required": false
|
|
10
|
+
|
|
11
|
+
},
|
|
12
|
+
"kpis": {
|
|
13
|
+
"type": "Array",
|
|
14
|
+
"required": false,
|
|
15
|
+
"defaultValue": []
|
|
16
|
+
},
|
|
17
|
+
"overviewDashboard": {
|
|
18
|
+
"type": "Pointer",
|
|
19
|
+
"targetClass": "{{PREFIX}}Dashboard",
|
|
20
|
+
"required": false
|
|
21
|
+
},
|
|
22
|
+
"priority": {
|
|
23
|
+
"type": "Number",
|
|
24
|
+
"required": true,
|
|
25
|
+
"defaultValue": 0
|
|
26
|
+
},
|
|
27
|
+
"source": {
|
|
28
|
+
"type": "Pointer",
|
|
29
|
+
"targetClass": "{{PREFIX}}Source",
|
|
30
|
+
"required": true
|
|
31
|
+
},
|
|
32
|
+
"stateConfing": {
|
|
33
|
+
"type": "Object",
|
|
34
|
+
"required": false
|
|
35
|
+
},
|
|
36
|
+
"tenant": {
|
|
37
|
+
"type": "Pointer",
|
|
38
|
+
"targetClass": "{{PREFIX}}Tenant",
|
|
39
|
+
"required": false
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"classLevelPermissions": {
|
|
43
|
+
"ACL": {
|
|
44
|
+
"*": {
|
|
45
|
+
"read": true,
|
|
46
|
+
"write": true
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"find": {
|
|
50
|
+
"*": true
|
|
51
|
+
},
|
|
52
|
+
"count": {
|
|
53
|
+
"*": true
|
|
54
|
+
},
|
|
55
|
+
"get": {
|
|
56
|
+
"*": true
|
|
57
|
+
},
|
|
58
|
+
"create": {
|
|
59
|
+
"*": true
|
|
60
|
+
},
|
|
61
|
+
"update": {
|
|
62
|
+
"*": true
|
|
63
|
+
},
|
|
64
|
+
"delete": {
|
|
65
|
+
"*": true
|
|
66
|
+
},
|
|
67
|
+
"addField": {
|
|
68
|
+
"*": true
|
|
69
|
+
},
|
|
70
|
+
"protectedFields": {
|
|
71
|
+
"*": []
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"fields": {
|
|
3
|
+
"description": {
|
|
4
|
+
"type": "String"
|
|
5
|
+
},
|
|
6
|
+
"device": {
|
|
7
|
+
"type": "Object",
|
|
8
|
+
"required": true
|
|
9
|
+
},
|
|
10
|
+
"items": {
|
|
11
|
+
"type": "Array",
|
|
12
|
+
"required": true,
|
|
13
|
+
"defaultValue": []
|
|
14
|
+
},
|
|
15
|
+
"name": {
|
|
16
|
+
"type": "String",
|
|
17
|
+
"required": true
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"classLevelPermissions": {
|
|
21
|
+
"find": {
|
|
22
|
+
"requiresAuthentication": true
|
|
23
|
+
},
|
|
24
|
+
"count": {
|
|
25
|
+
"requiresAuthentication": true
|
|
26
|
+
},
|
|
27
|
+
"get": {
|
|
28
|
+
"requiresAuthentication": true
|
|
29
|
+
},
|
|
30
|
+
"create": {
|
|
31
|
+
"requiresAuthentication": true
|
|
32
|
+
},
|
|
33
|
+
"update": {
|
|
34
|
+
"requiresAuthentication": true
|
|
35
|
+
},
|
|
36
|
+
"delete": {
|
|
37
|
+
"requiresAuthentication": true
|
|
38
|
+
},
|
|
39
|
+
"addField": {},
|
|
40
|
+
"protectedFields": {
|
|
41
|
+
"*": []
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
package/schema/RAG_Data.json
CHANGED