@openinc/parse-server-opendash 4.32.5 → 4.33.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.
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Source that bounds the plan with the given id: its own, otherwise the one of
3
+ * the nearest parent plan. Undefined when no plan up the tree has a source.
4
+ */
5
+ export declare function planScope(planId: string | undefined): Promise<string | undefined>;
6
+ /** Whether `sourceId` is the source `scopeId` or lies somewhere below it. */
7
+ export declare function isWithinSource(sourceId: string, scopeId: string): Promise<boolean>;
8
+ /**
9
+ * Rejects the save unless every source lies within the scope. `what` names
10
+ * the object in the message, e.g. "A production order".
11
+ */
12
+ export declare function assertWithinScope(sourceIds: string[], scopeId: string | undefined, what: string): Promise<void>;
13
+ /**
14
+ * Rejects a new scope of an existing plan (another source or another parent)
15
+ * that would leave sub plans, production orders or work orders below the
16
+ * plan outside of it.
17
+ */
18
+ export declare function assertContentWithinScope(planId: string, scopeId: string | undefined): Promise<void>;
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.planScope = planScope;
7
+ exports.isWithinSource = isWithinSource;
8
+ exports.assertWithinScope = assertWithinScope;
9
+ exports.assertContentWithinScope = assertContentWithinScope;
10
+ const node_1 = __importDefault(require("parse/node"));
11
+ const index_js_1 = require("../../../types/index.js");
12
+ /**
13
+ * Order plans (operational orders) are bound to the source tree: everything
14
+ * below a plan — sub plans, production orders and work orders — has to run on
15
+ * the plan's source or on a source below it. A plan without a source of its
16
+ * own inherits the one of the nearest parent plan that has one; a tree
17
+ * without any source is not bound.
18
+ */
19
+ /** Upper bound for walking the source and order trees; guards against corrupt data. */
20
+ const MAX_DEPTH = 50;
21
+ /**
22
+ * Source that bounds the plan with the given id: its own, otherwise the one of
23
+ * the nearest parent plan. Undefined when no plan up the tree has a source.
24
+ */
25
+ async function planScope(planId) {
26
+ let id = planId;
27
+ for (let depth = 0; id && depth < MAX_DEPTH; depth++) {
28
+ const plan = await new node_1.default.Query(index_js_1.MES_OrderPlan)
29
+ .select("source", "parentOrder")
30
+ .get(id, { useMasterKey: true })
31
+ .catch(() => undefined);
32
+ if (!plan)
33
+ return undefined;
34
+ const sourceId = plan.get("source")?.id;
35
+ if (sourceId)
36
+ return sourceId;
37
+ id = plan.get("parentOrder")?.id;
38
+ }
39
+ return undefined;
40
+ }
41
+ /** Whether `sourceId` is the source `scopeId` or lies somewhere below it. */
42
+ async function isWithinSource(sourceId, scopeId) {
43
+ let id = sourceId;
44
+ for (let depth = 0; id && depth < MAX_DEPTH; depth++) {
45
+ if (id === scopeId)
46
+ return true;
47
+ const source = await new node_1.default.Query(index_js_1.Source)
48
+ .select("parent")
49
+ .get(id, { useMasterKey: true })
50
+ .catch(() => undefined);
51
+ id = source?.get("parent")?.id;
52
+ }
53
+ return false;
54
+ }
55
+ /**
56
+ * Rejects the save unless every source lies within the scope. `what` names
57
+ * the object in the message, e.g. "A production order".
58
+ */
59
+ async function assertWithinScope(sourceIds, scopeId, what) {
60
+ if (!scopeId)
61
+ return;
62
+ for (const sourceId of new Set(sourceIds)) {
63
+ if (!(await isWithinSource(sourceId, scopeId))) {
64
+ throw new node_1.default.Error(node_1.default.Error.VALIDATION_ERROR, `${what} has to run on the source "${await sourceLabel(scopeId)}" of its order plan or on a source below it, not on "${await sourceLabel(sourceId)}".`);
65
+ }
66
+ }
67
+ }
68
+ /**
69
+ * Rejects a new scope of an existing plan (another source or another parent)
70
+ * that would leave sub plans, production orders or work orders below the
71
+ * plan outside of it.
72
+ */
73
+ async function assertContentWithinScope(planId, scopeId) {
74
+ if (!scopeId)
75
+ return;
76
+ const allowed = await sourceSubtree(scopeId);
77
+ const plans = [
78
+ index_js_1.MES_OrderPlan.createWithoutData(planId),
79
+ ...(await planSubtree(planId)),
80
+ ];
81
+ const outsidePlans = plans.filter((plan) => {
82
+ const sourceId = plan.get("source")?.id;
83
+ return sourceId && !allowed.has(sourceId);
84
+ });
85
+ const allowedSources = [...allowed].map((id) => index_js_1.Source.createWithoutData(id));
86
+ const outsideOrders = await new node_1.default.Query(index_js_1.MES_Order)
87
+ .containedIn("orderPlan", plans)
88
+ .exists("source")
89
+ .notContainedIn("source", allowedSources)
90
+ .count({ useMasterKey: true });
91
+ // `sources` is a relation: match work orders with any source outside.
92
+ // Counts 0 when the BDE feature (and with it the class) is disabled.
93
+ const outsideWorkOrders = await new node_1.default.Query(index_js_1.BDE_WorkOrder)
94
+ .containedIn("orderPlan", plans)
95
+ .notEqualTo("isDeleted", true)
96
+ .matchesQuery("sources", new node_1.default.Query(index_js_1.Source).notContainedIn("objectId", [...allowed]))
97
+ .count({ useMasterKey: true })
98
+ .catch(() => 0);
99
+ if (outsidePlans.length + outsideOrders + outsideWorkOrders > 0) {
100
+ throw new node_1.default.Error(node_1.default.Error.VALIDATION_ERROR, `The order plan cannot be bound to the source "${await sourceLabel(scopeId)}": ${outsidePlans.length} sub order(s), ${outsideOrders} production order(s) and ${outsideWorkOrders} work order(s) below it run on sources outside of it.`);
101
+ }
102
+ }
103
+ /** Ids of the source and of all sources below it. */
104
+ async function sourceSubtree(scopeId) {
105
+ const ids = new Set([scopeId]);
106
+ let frontier = [scopeId];
107
+ for (let depth = 0; frontier.length && depth < MAX_DEPTH; depth++) {
108
+ const children = await new node_1.default.Query(index_js_1.Source)
109
+ .containedIn("parent", frontier.map((id) => index_js_1.Source.createWithoutData(id)))
110
+ .select("parent")
111
+ .limit(10000)
112
+ .find({ useMasterKey: true });
113
+ frontier = children
114
+ .map((child) => child.id)
115
+ .filter((id) => !!id && !ids.has(id));
116
+ frontier.forEach((id) => ids.add(id));
117
+ }
118
+ return ids;
119
+ }
120
+ /** Plans below the plan (not the plan itself), with their own source. */
121
+ async function planSubtree(planId) {
122
+ const seen = new Set([planId]);
123
+ const result = [];
124
+ let frontier = [planId];
125
+ for (let depth = 0; frontier.length && depth < MAX_DEPTH; depth++) {
126
+ const children = await new node_1.default.Query(index_js_1.MES_OrderPlan)
127
+ .containedIn("parentOrder", frontier.map((id) => index_js_1.MES_OrderPlan.createWithoutData(id)))
128
+ .select("source", "parentOrder")
129
+ .limit(10000)
130
+ .find({ useMasterKey: true });
131
+ const added = children.filter((child) => !!child.id && !seen.has(child.id));
132
+ frontier = added.map((child) => child.id);
133
+ frontier.forEach((id) => seen.add(id));
134
+ result.push(...added);
135
+ }
136
+ return result;
137
+ }
138
+ async function sourceLabel(id) {
139
+ const source = await new node_1.default.Query(index_js_1.Source)
140
+ .select("name", "tag")
141
+ .get(id, { useMasterKey: true })
142
+ .catch(() => undefined);
143
+ return source?.get("name") || source?.get("tag") || id;
144
+ }
@@ -186,6 +186,8 @@ exports.INDEXES = [
186
186
  defineIndexes(index_js_1.BDE_WorkOrder, {
187
187
  od_workOrderNr: ["workOrderNr"],
188
188
  od_tenant_updatedAt: ["tenant", "updatedAt"],
189
+ // Work orders of an order plan (MES order view).
190
+ od_orderPlan: ["orderPlan"],
189
191
  }),
190
192
  defineIndexes(index_js_1.BDE_Article, {
191
193
  od_articleNumber: ["articleNumber"],
@@ -194,6 +196,12 @@ exports.INDEXES = [
194
196
  // A cron job reads the last day's orders every minute.
195
197
  defineIndexes(index_js_1.MES_Order, {
196
198
  od_start: ["start"],
199
+ // Production orders of an order plan (MES order view).
200
+ od_orderPlan: ["orderPlan"],
201
+ }),
202
+ // Sub orders of an order plan; also checked before deleting a plan.
203
+ defineIndexes(index_js_1.MES_OrderPlan, {
204
+ od_parentOrder: ["parentOrder"],
197
205
  }),
198
206
  // --- open.SERVICE v1 ---
199
207
  // The v1 ticket list loads each ticket's newest row of every side table —
@@ -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
- // TODO
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;
@@ -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) {
@@ -1,8 +1,15 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.init = init;
7
+ const node_1 = __importDefault(require("parse/node"));
4
8
  const index_js_1 = require("../features/schema/index.js");
9
+ const mesSourceScope_js_1 = require("../features/openware/helper/mesSourceScope.js");
5
10
  const index_js_2 = require("../types/index.js");
11
+ /** Upper bound for walking up the order tree; guards against corrupt data. */
12
+ const MAX_DEPTH = 50;
6
13
  async function init() {
7
14
  (0, index_js_1.beforeSaveHook)(index_js_2.MES_OrderPlan, async (request) => {
8
15
  const { object, original, user } = request;
@@ -11,10 +18,69 @@ async function init() {
11
18
  allowCustomACL: true,
12
19
  allowTenantUserWrite: true,
13
20
  });
14
- // TODO
21
+ if (object.dirty("parentOrder")) {
22
+ await assertNoCycle(object);
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
+ }
15
40
  });
16
41
  (0, index_js_1.afterSaveHook)(index_js_2.MES_OrderPlan, async (request) => {
17
42
  const { object, original, user } = request;
18
43
  // TODO
19
44
  });
45
+ // Sub orders, production orders and work orders point at their order plan.
46
+ // Deleting it would leave them dangling and break the order tree.
47
+ (0, index_js_1.beforeDeleteHook)(index_js_2.MES_OrderPlan, async (request) => {
48
+ const { object } = request;
49
+ const [children, orders, workOrders] = await Promise.all([
50
+ new node_1.default.Query(index_js_2.MES_OrderPlan)
51
+ .equalTo("parentOrder", object)
52
+ .count({ useMasterKey: true }),
53
+ new node_1.default.Query(index_js_2.MES_Order)
54
+ .equalTo("orderPlan", object)
55
+ .count({ useMasterKey: true }),
56
+ // Counts 0 when the BDE feature (and with it the class) is disabled.
57
+ new node_1.default.Query(index_js_2.BDE_WorkOrder)
58
+ .equalTo("orderPlan", object)
59
+ .notEqualTo("isDeleted", true)
60
+ .count({ useMasterKey: true }),
61
+ ]);
62
+ if (children + orders + workOrders > 0) {
63
+ throw new node_1.default.Error(node_1.default.Error.OPERATION_FORBIDDEN, `Cannot delete order plan: still referenced by ${children} sub order(s), ${orders} production order(s) and ${workOrders} work order(s).`);
64
+ }
65
+ });
66
+ }
67
+ /**
68
+ * Rejects a parent that is the plan itself or one of its descendants, which
69
+ * would turn the order tree into a cycle.
70
+ */
71
+ async function assertNoCycle(object) {
72
+ let parentId = object.get("parentOrder")?.id;
73
+ for (let depth = 0; parentId && depth < MAX_DEPTH; depth++) {
74
+ if (object.id && parentId === object.id) {
75
+ throw new node_1.default.Error(node_1.default.Error.VALIDATION_ERROR, "An order plan cannot be its own parent or a parent of one of its parents.");
76
+ }
77
+ const fetched = await new node_1.default.Query(index_js_2.MES_OrderPlan)
78
+ .select("parentOrder")
79
+ .get(parentId, { useMasterKey: true })
80
+ .catch(() => undefined);
81
+ parentId = fetched?.get("parentOrder")?.id;
82
+ }
83
+ if (parentId) {
84
+ throw new node_1.default.Error(node_1.default.Error.VALIDATION_ERROR, `Order plans cannot be nested deeper than ${MAX_DEPTH} levels.`);
85
+ }
20
86
  }
@@ -1,5 +1,6 @@
1
1
  import Parse from "parse/node";
2
2
  import type { BDE_Article } from "./BDE_Article";
3
+ import type { MES_OrderPlan } from "./MES_OrderPlan";
3
4
  import type { Source } from "./Source";
4
5
  import type { Tenant } from "./Tenant";
5
6
  export interface BDE_WorkOrderAttributes {
@@ -12,6 +13,7 @@ export interface BDE_WorkOrderAttributes {
12
13
  amountTotal?: number | undefined;
13
14
  article?: BDE_Article | undefined;
14
15
  isDeleted: boolean;
16
+ orderPlan?: MES_OrderPlan | undefined;
15
17
  plannedEndDate?: Date | undefined;
16
18
  plannedStartDate?: Date | undefined;
17
19
  sources: Parse.Relation<BDE_WorkOrder, Source>;
@@ -32,6 +34,8 @@ export declare class BDE_WorkOrder extends Parse.Object<BDE_WorkOrderAttributes>
32
34
  set article(value: BDE_Article | undefined);
33
35
  get isDeleted(): boolean;
34
36
  set isDeleted(value: boolean);
37
+ get orderPlan(): MES_OrderPlan | undefined;
38
+ set orderPlan(value: MES_OrderPlan | undefined);
35
39
  get plannedEndDate(): Date | undefined;
36
40
  set plannedEndDate(value: Date | undefined);
37
41
  get plannedStartDate(): Date | undefined;
@@ -40,6 +40,12 @@ class BDE_WorkOrder extends node_1.default.Object {
40
40
  set isDeleted(value) {
41
41
  super.set("isDeleted", value);
42
42
  }
43
+ get orderPlan() {
44
+ return super.get("orderPlan");
45
+ }
46
+ set orderPlan(value) {
47
+ super.set("orderPlan", value);
48
+ }
43
49
  get plannedEndDate() {
44
50
  return super.get("plannedEndDate");
45
51
  }
@@ -1,5 +1,6 @@
1
1
  import Parse from "parse/node";
2
2
  import type { BDE_Article } from "./BDE_Article";
3
+ import type { MES_OrderPlan } from "./MES_OrderPlan";
3
4
  import type { Source } from "./Source";
4
5
  import type { Tenant } from "./Tenant";
5
6
  export interface MES_OrderAttributes {
@@ -13,6 +14,7 @@ export interface MES_OrderAttributes {
13
14
  duration: number;
14
15
  order_quantity: number;
15
16
  ordernr: string;
17
+ orderPlan?: MES_OrderPlan | undefined;
16
18
  setup_time: number;
17
19
  source?: Source | undefined;
18
20
  start: Date;
@@ -36,6 +38,8 @@ export declare class MES_Order extends Parse.Object<MES_OrderAttributes> {
36
38
  set order_quantity(value: number);
37
39
  get ordernr(): string;
38
40
  set ordernr(value: string);
41
+ get orderPlan(): MES_OrderPlan | undefined;
42
+ set orderPlan(value: MES_OrderPlan | undefined);
39
43
  get setup_time(): number;
40
44
  set setup_time(value: number);
41
45
  get source(): Source | undefined;
@@ -46,6 +46,12 @@ class MES_Order extends node_1.default.Object {
46
46
  set ordernr(value) {
47
47
  super.set("ordernr", value);
48
48
  }
49
+ get orderPlan() {
50
+ return super.get("orderPlan");
51
+ }
52
+ set orderPlan(value) {
53
+ super.set("orderPlan", value);
54
+ }
49
55
  get setup_time() {
50
56
  return super.get("setup_time");
51
57
  }
@@ -9,6 +9,7 @@ export interface MES_OrderPlanAttributes {
9
9
  updatedAt: Date;
10
10
  article?: BDE_Article | undefined;
11
11
  ordernr: string;
12
+ parentOrder?: MES_OrderPlan | undefined;
12
13
  planEnd?: Date | undefined;
13
14
  planStart?: Date | undefined;
14
15
  setup_time: number;
@@ -23,6 +24,8 @@ export declare class MES_OrderPlan extends Parse.Object<MES_OrderPlanAttributes>
23
24
  set article(value: BDE_Article | undefined);
24
25
  get ordernr(): string;
25
26
  set ordernr(value: string);
27
+ get parentOrder(): MES_OrderPlan | undefined;
28
+ set parentOrder(value: MES_OrderPlan | undefined);
26
29
  get planEnd(): Date | undefined;
27
30
  set planEnd(value: Date | undefined);
28
31
  get planStart(): Date | undefined;
@@ -22,6 +22,12 @@ class MES_OrderPlan extends node_1.default.Object {
22
22
  set ordernr(value) {
23
23
  super.set("ordernr", value);
24
24
  }
25
+ get parentOrder() {
26
+ return super.get("parentOrder");
27
+ }
28
+ set parentOrder(value) {
29
+ super.set("parentOrder", value);
30
+ }
25
31
  get planEnd() {
26
32
  return super.get("planEnd");
27
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openinc/parse-server-opendash",
3
- "version": "4.32.5",
3
+ "version": "4.33.0",
4
4
  "description": "Parse Server Cloud Code for open.INC Stack.",
5
5
  "packageManager": "pnpm@12.16.1",
6
6
  "keywords": [
@@ -1,26 +1,26 @@
1
1
  {
2
2
  "fields": {
3
- "label": {
4
- "type": "String",
5
- "required": false
3
+ "end": {
4
+ "type": "Date",
5
+ "required": true
6
6
  },
7
7
  "kind": {
8
8
  "type": "String",
9
9
  "required": true
10
10
  },
11
- "start": {
12
- "type": "Date",
13
- "required": true
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
- "validFrom": {
18
- "type": "Date",
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": {
@@ -24,6 +24,10 @@
24
24
  "required": false,
25
25
  "defaultValue": false
26
26
  },
27
+ "orderPlan": {
28
+ "type": "Pointer",
29
+ "targetClass": "{{PREFIX}}MES_OrderPlan"
30
+ },
27
31
  "plannedEndDate": {
28
32
  "type": "Date",
29
33
  "required": false
@@ -52,12 +56,6 @@
52
56
  }
53
57
  },
54
58
  "classLevelPermissions": {
55
- "ACL": {
56
- "*": {
57
- "read": true,
58
- "write": true
59
- }
60
- },
61
59
  "find": {
62
60
  "*": true
63
61
  },
@@ -81,6 +79,12 @@
81
79
  },
82
80
  "protectedFields": {
83
81
  "*": []
82
+ },
83
+ "ACL": {
84
+ "*": {
85
+ "read": true,
86
+ "write": true
87
+ }
84
88
  }
85
89
  }
86
90
  }
@@ -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
- "identifier": {
4
- "type": "String",
5
- "required": true
3
+ "allowedMethods": {
4
+ "type": "Array",
5
+ "required": false
6
6
  },
7
- "priority": {
8
- "type": "Number",
9
- "required": true,
10
- "defaultValue": 0
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
- "url": {
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
- "allowedMethods": {
25
- "type": "Array",
26
- "required": false
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
- "body": {
41
+ "secrets": {
42
42
  "type": "Object",
43
43
  "required": false
44
44
  },
45
- "secrets": {
46
- "type": "Object",
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
- "tenant": {
54
- "type": "Pointer",
55
- "targetClass": "{{PREFIX}}Tenant",
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
- "*": ["secrets", "headers", "query", "body"],
85
+ "*": [
86
+ "secrets",
87
+ "headers",
88
+ "query",
89
+ "body"
90
+ ],
86
91
  "role:od-admin": []
87
92
  }
88
93
  }
@@ -27,6 +27,11 @@
27
27
  "type": "String",
28
28
  "required": true
29
29
  },
30
+ "orderPlan": {
31
+ "type": "Pointer",
32
+ "targetClass": "{{PREFIX}}MES_OrderPlan",
33
+ "required": false
34
+ },
30
35
  "setup_time": {
31
36
  "type": "Number",
32
37
  "required": false,
@@ -9,6 +9,11 @@
9
9
  "type": "String",
10
10
  "required": true
11
11
  },
12
+ "parentOrder": {
13
+ "type": "Pointer",
14
+ "targetClass": "{{PREFIX}}MES_OrderPlan",
15
+ "required": false
16
+ },
12
17
  "planEnd": {
13
18
  "type": "Date",
14
19
  "required": false
@@ -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
+ }
@@ -46,11 +46,6 @@
46
46
  "type": "String",
47
47
  "required": false
48
48
  },
49
- "parseClassRelated": {
50
- "type": "Array",
51
- "required": false,
52
- "defaultValue": []
53
- },
54
49
  "text": {
55
50
  "type": "String",
56
51
  "required": false