@operato/ops-contract 0.9.48 → 0.9.49
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/README.md +12 -5
- package/dist/asset-acceptance.d.ts +27 -0
- package/dist/asset-acceptance.js +33 -0
- package/dist/capability.d.ts +1 -1
- package/dist/capability.js +16 -1
- package/dist/contract.d.ts +26 -0
- package/dist/contract.js +15 -1
- package/dist/domain-catalog.d.ts +1 -1
- package/dist/domain-catalog.js +26 -2
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/intralogistics-profile.d.ts +80 -0
- package/dist/intralogistics-profile.js +113 -0
- package/dist/route-network.d.ts +84 -0
- package/dist/route-network.js +132 -0
- package/dist/transport-policy.d.ts +79 -0
- package/dist/transport-policy.js +68 -0
- package/dist/travel.d.ts +83 -0
- package/dist/travel.js +32 -0
- package/dist-cjs/index.cjs +385 -4
- package/package.json +1 -1
package/dist-cjs/index.cjs
CHANGED
|
@@ -34,7 +34,10 @@ __export(index_exports, {
|
|
|
34
34
|
COMMAND_EVENT: () => COMMAND_EVENT,
|
|
35
35
|
COMMAND_ORIGIN: () => COMMAND_ORIGIN,
|
|
36
36
|
COMMAND_STATE: () => COMMAND_STATE,
|
|
37
|
+
CONNECTION_DIRECTION: () => CONNECTION_DIRECTION,
|
|
38
|
+
DEFAULT_CONNECTION_CAPACITY: () => DEFAULT_CONNECTION_CAPACITY,
|
|
37
39
|
DISP: () => DISP,
|
|
40
|
+
DISPATCH_RULE: () => DISPATCH_RULE,
|
|
38
41
|
DISPOSITION_DECISION: () => DISPOSITION_DECISION,
|
|
39
42
|
DOCK_DOOR_STATUS: () => DOCK_DOOR_STATUS,
|
|
40
43
|
DOCK_FACT_KIND: () => DOCK_FACT_KIND,
|
|
@@ -55,9 +58,16 @@ __export(index_exports, {
|
|
|
55
58
|
ERP_MASTER_AXIS: () => ERP_MASTER_AXIS,
|
|
56
59
|
FIELDS_NOT_CARRIED: () => FIELDS_NOT_CARRIED,
|
|
57
60
|
FIRST_PASS_RULE: () => FIRST_PASS_RULE,
|
|
61
|
+
FIXED_ROUTE_BINDING: () => FIXED_ROUTE_BINDING,
|
|
58
62
|
GUARD_PRAGMA: () => GUARD_PRAGMA,
|
|
59
63
|
HATIOLAB_VOCABULARY: () => HATIOLAB_VOCABULARY,
|
|
60
64
|
HEADER_FIELDS_PARTITIONED: () => HEADER_FIELDS_PARTITIONED,
|
|
65
|
+
ILG_ATTENTION_KIND: () => ILG_ATTENTION_KIND,
|
|
66
|
+
ILG_BIZSTEP: () => ILG_BIZSTEP,
|
|
67
|
+
ILG_LOCATION_TYPES: () => ILG_LOCATION_TYPES,
|
|
68
|
+
ILG_ORDER_KIND: () => ILG_ORDER_KIND,
|
|
69
|
+
ILG_TASK_KIND: () => ILG_TASK_KIND,
|
|
70
|
+
ILG_TYPES: () => ILG_TYPES,
|
|
61
71
|
ILMD_ATTR: () => ILMD_ATTR,
|
|
62
72
|
LOCATION_SATURATION_NEAR: () => LOCATION_SATURATION_NEAR,
|
|
63
73
|
MATERIAL_ACTUAL_USE: () => MATERIAL_ACTUAL_USE,
|
|
@@ -91,6 +101,8 @@ __export(index_exports, {
|
|
|
91
101
|
RESOURCE_KIND: () => RESOURCE_KIND,
|
|
92
102
|
RETIRED_VOCABULARY: () => RETIRED_VOCABULARY,
|
|
93
103
|
RETURN_TO_SUPPLIER: () => RETURN_TO_SUPPLIER,
|
|
104
|
+
ROUTE_NETWORK_ISSUE: () => ROUTE_NETWORK_ISSUE,
|
|
105
|
+
ROUTING_RULE: () => ROUTING_RULE,
|
|
94
106
|
SCHEDULE_STATUS: () => SCHEDULE_STATUS,
|
|
95
107
|
SIGNATURE_REJECTED_REASONS: () => SIGNATURE_REJECTED_REASONS,
|
|
96
108
|
SOURCE_DEST_PARTY_TYPE: () => SOURCE_DEST_PARTY_TYPE,
|
|
@@ -99,7 +111,12 @@ __export(index_exports, {
|
|
|
99
111
|
TARIFF_LOAD_CLASSES: () => TARIFF_LOAD_CLASSES,
|
|
100
112
|
TASK_STATUS: () => TASK_STATUS,
|
|
101
113
|
TASK_TERMINAL_STATUS: () => TASK_TERMINAL_STATUS,
|
|
114
|
+
TRAFFIC_CONFLICT_ACTION: () => TRAFFIC_CONFLICT_ACTION,
|
|
102
115
|
TRAILER_LOAD: () => TRAILER_LOAD,
|
|
116
|
+
TRANSPORT_FAILURE_REASON: () => TRANSPORT_FAILURE_REASON,
|
|
117
|
+
TRANSPORT_POLICY_ISSUE: () => TRANSPORT_POLICY_ISSUE,
|
|
118
|
+
TRAVEL_LINK_JUDGED_BY: () => TRAVEL_LINK_JUDGED_BY,
|
|
119
|
+
TRAVEL_LINK_STATE: () => TRAVEL_LINK_STATE,
|
|
103
120
|
TWIN_AXES: () => TWIN_AXES,
|
|
104
121
|
TWIN_PROPERTIES: () => TWIN_PROPERTIES,
|
|
105
122
|
TWIN_RELATIONS: () => TWIN_RELATIONS,
|
|
@@ -126,6 +143,7 @@ __export(index_exports, {
|
|
|
126
143
|
YMS_ORDER_KIND: () => YMS_ORDER_KIND,
|
|
127
144
|
YMS_TASK_KIND: () => YMS_TASK_KIND,
|
|
128
145
|
YMS_TYPES: () => YMS_TYPES,
|
|
146
|
+
acceptsMaterial: () => acceptsMaterial,
|
|
129
147
|
acceptsPerformance: () => acceptsPerformance,
|
|
130
148
|
activeBands: () => activeBands,
|
|
131
149
|
activeShiftAt: () => activeShiftAt,
|
|
@@ -157,6 +175,7 @@ __export(index_exports, {
|
|
|
157
175
|
computeMtbf: () => computeMtbf,
|
|
158
176
|
computeMttr: () => computeMttr,
|
|
159
177
|
computeOee: () => computeOee,
|
|
178
|
+
connectionAdmits: () => connectionAdmits,
|
|
160
179
|
conversionFactorOf: () => conversionFactorOf,
|
|
161
180
|
criterionSaysNothing: () => criterionSaysNothing,
|
|
162
181
|
dayOfYearOf: () => dayOfYearOf,
|
|
@@ -202,6 +221,7 @@ __export(index_exports, {
|
|
|
202
221
|
ingestOperationalRecords: () => ingestOperationalRecords,
|
|
203
222
|
inheritedExpiry: () => inheritedExpiry,
|
|
204
223
|
inheritedLotUse: () => inheritedLotUse,
|
|
224
|
+
intralogisticsTypeOf: () => intralogisticsTypeOf,
|
|
205
225
|
isAggregationRecord: () => isAggregationRecord,
|
|
206
226
|
isAppointmentClosed: () => isAppointmentClosed,
|
|
207
227
|
isCacheableTense: () => isCacheableTense,
|
|
@@ -221,6 +241,7 @@ __export(index_exports, {
|
|
|
221
241
|
isEquipmentStatus: () => isEquipmentStatus,
|
|
222
242
|
isFailureStatus: () => isFailureStatus,
|
|
223
243
|
isFlowOrder: () => isFlowOrder,
|
|
244
|
+
isHeading: () => isHeading,
|
|
224
245
|
isIso4217Code: () => isIso4217Code,
|
|
225
246
|
isIsoDateTime: () => isIsoDateTime,
|
|
226
247
|
isMasterDataRecord: () => isMasterDataRecord,
|
|
@@ -239,6 +260,7 @@ __export(index_exports, {
|
|
|
239
260
|
isTaskTerminal: () => isTaskTerminal,
|
|
240
261
|
isTestSpecificationBasis: () => isTestSpecificationBasis,
|
|
241
262
|
isTransformationRecord: () => isTransformationRecord,
|
|
263
|
+
isTransportFailureReason: () => isTransportFailureReason,
|
|
242
264
|
isWebhookDeliveryCode: () => isWebhookDeliveryCode,
|
|
243
265
|
isWebhookSecretSegment: () => isWebhookSecretSegment,
|
|
244
266
|
isWorkShiftExecutionBasis: () => isWorkShiftExecutionBasis,
|
|
@@ -252,6 +274,7 @@ __export(index_exports, {
|
|
|
252
274
|
judgeAgainstSpec: () => judgeAgainstSpec,
|
|
253
275
|
levelOfLocationType: () => levelOfLocationType,
|
|
254
276
|
lgtinClass: () => lgtinClass,
|
|
277
|
+
linkStateAt: () => linkStateAt,
|
|
255
278
|
localDayIndexAt: () => localDayIndexAt,
|
|
256
279
|
localDayStartMs: () => localDayStartMs,
|
|
257
280
|
locationStatusOf: () => locationStatusOf,
|
|
@@ -338,7 +361,9 @@ __export(index_exports, {
|
|
|
338
361
|
validateDomainDefinition: () => validateDomainDefinition,
|
|
339
362
|
validateEpcisEvent: () => validateEpcisEvent,
|
|
340
363
|
validatePerformance: () => validatePerformance,
|
|
364
|
+
validateRouteNetwork: () => validateRouteNetwork,
|
|
341
365
|
validateScenario: () => validateScenario,
|
|
366
|
+
validateTransportPolicy: () => validateTransportPolicy,
|
|
342
367
|
verdictOfAck: () => verdictOfAck,
|
|
343
368
|
webhookLaneOf: () => webhookLaneOf,
|
|
344
369
|
webhookSecretCandidates: () => webhookSecretCandidates,
|
|
@@ -477,9 +502,29 @@ var CAPABILITIES = {
|
|
|
477
502
|
models: ["StoringState"],
|
|
478
503
|
invariants: ["0 <= soc <= 100"],
|
|
479
504
|
results: ["stored", "discharged"]
|
|
505
|
+
},
|
|
506
|
+
/*
|
|
507
|
+
* ── Guided — travels the route network under transport control (2026-12-03, operato-application ADR-0266) ──────────────
|
|
508
|
+
*
|
|
509
|
+
* `mobile` says a resource moves between locations; a forklift a person drives has it. Last location passed, reserved
|
|
510
|
+
* connections and link state mean something only for equipment under transport control, so they are a capability of their
|
|
511
|
+
* own, declared together with `mobile`. Battery is not repeated here: guided equipment declares `energyStoring` as well.
|
|
512
|
+
*
|
|
513
|
+
* No commands. The twin does not drive robots: dispatch, pause and resume are the transport control product's instructions
|
|
514
|
+
* to its equipment (VDA 5050 instant actions), not stimuli inside the kernel, so they do not belong in `CMD`.
|
|
515
|
+
*/
|
|
516
|
+
guided: {
|
|
517
|
+
key: "guided",
|
|
518
|
+
label: "twin.capability.guided",
|
|
519
|
+
semantics: "\uACBD\uB85C\uB9DD \uC704\uB97C \uAD00\uC81C\uC5D0 \uB530\uB77C \uB2E4\uB2C8\uB294 \uC7A5\uBE44 \u2014 \uB9C8\uC9C0\uB9C9\uC73C\uB85C \uC9C0\uB09C \uC790\uB9AC \xB7 \uC9C4\uD589 \uBC29\uD5A5 \xB7 \uC608\uC57D \uAD6C\uAC04 \xB7 \uD1B5\uC2E0 \uC0C1\uD0DC \xB7 \uCE21\uC815 \uC704\uCE58. mobile \uACFC \uD568\uAED8 \uC120\uC5B8\uD55C\uB2E4.",
|
|
520
|
+
commands: [],
|
|
521
|
+
stateFields: ["travel"],
|
|
522
|
+
models: ["TravelState"],
|
|
523
|
+
invariants: ["guided => mobile", "0 <= heading < 360"],
|
|
524
|
+
results: ["passed", "reserved", "linkChanged", "poseReported"]
|
|
480
525
|
}
|
|
481
526
|
};
|
|
482
|
-
var CAPABILITY_KEYS = ["operable", "storable", "mobile", "processable", "trackable", "switching", "metered", "curtailable", "energyGenerating", "energyStoring"];
|
|
527
|
+
var CAPABILITY_KEYS = ["operable", "storable", "mobile", "processable", "trackable", "switching", "metered", "curtailable", "energyGenerating", "energyStoring", "guided"];
|
|
483
528
|
function stateFieldsOf(caps) {
|
|
484
529
|
const out = /* @__PURE__ */ new Set();
|
|
485
530
|
for (const c of caps) for (const f of CAPABILITIES[c]?.stateFields ?? []) out.add(f);
|
|
@@ -1132,7 +1177,21 @@ var OP_EVENT = {
|
|
|
1132
1177
|
* 이름을 `energy.measured` 와 같은 결로 둔다 — 그쪽이 에너지 계량의 도착이고 이쪽이 그 일반형이다.
|
|
1133
1178
|
* 두 채널을 합치지 않는 이유는 에너지 쪽이 **구간에 누적되는 표본**이라 처리가 다르기 때문이다.
|
|
1134
1179
|
*/
|
|
1135
|
-
observation: "location.measured"
|
|
1180
|
+
observation: "location.measured",
|
|
1181
|
+
/*
|
|
1182
|
+
* ── Travel of guided equipment (2026-12-03, operato-application ADR-0266 decision 8 ②, `travel.ts`) ────────────────────
|
|
1183
|
+
*
|
|
1184
|
+
* The four facts that carry `EquipmentState.travel` into the journal (state ⊆ events). Sent on change, never per tick.
|
|
1185
|
+
* Payloads: `TravelPassedFact` · `TravelReservationFact` · `TravelLinkFact` · `TravelPoseFact`.
|
|
1186
|
+
*
|
|
1187
|
+
* The transport control product sends them as canonical envelopes, so they need no connector mapping in
|
|
1188
|
+
* `operational-ingest`. Folding them into state is the kernel's next stage (ADR-0266 §5 stage 6); until then the mirror
|
|
1189
|
+
* does not show travel.
|
|
1190
|
+
*/
|
|
1191
|
+
travelPassed: "equipment.passed",
|
|
1192
|
+
travelReservation: "equipment.reservation",
|
|
1193
|
+
travelLink: "equipment.link",
|
|
1194
|
+
travelPose: "equipment.pose"
|
|
1136
1195
|
};
|
|
1137
1196
|
var ENERGY_EVENT = {
|
|
1138
1197
|
/** 계량 도착 — 그 시점의 유효전력·누적량. 15분 수요 구간에 누적된다. */
|
|
@@ -2650,7 +2709,18 @@ var TWIN_AXES = [
|
|
|
2650
2709
|
historical: true,
|
|
2651
2710
|
standardClass: {},
|
|
2652
2711
|
systems: ["ems"]
|
|
2653
|
-
}
|
|
2712
|
+
},
|
|
2713
|
+
/*
|
|
2714
|
+
* ── Route network (2026-12-03, operato-application ADR-0266 decision 8 ①) ──────────────────────────
|
|
2715
|
+
*
|
|
2716
|
+
* The edges guided equipment travels between locations, and the ordered edge lists some equipment must follow.
|
|
2717
|
+
* No standard names them: ISA-95 and EPCIS have no route network, and VDA 5050 is a protocol, not an ontology this
|
|
2718
|
+
* catalogue projects to. So `standardClass` stays empty rather than borrowing a near name.
|
|
2719
|
+
*
|
|
2720
|
+
* An energy twin has no travelling equipment, so both axes are logistics-only (`LOGISTICS`).
|
|
2721
|
+
*/
|
|
2722
|
+
{ axis: "connections", path: "connections", label: "twin.axis.connections", kind: "instance", standardClass: {}, systems: LOGISTICS },
|
|
2723
|
+
{ axis: "fixedRoutes", path: "fixedRoutes", label: "twin.axis.fixedRoutes", kind: "spec", standardClass: {}, systems: LOGISTICS }
|
|
2654
2724
|
];
|
|
2655
2725
|
function isCacheableTense(t) {
|
|
2656
2726
|
return t === "standing";
|
|
@@ -2749,7 +2819,20 @@ var TWIN_RELATIONS = [
|
|
|
2749
2819
|
{ from: "materialClasses", field: "testSpecificationIds[]", target: { kind: "axis", axis: "testSpecifications" }, via: "ops.rel.test", optional: true, tense: "standing" },
|
|
2750
2820
|
/* 공정이 도는 자리·자원 — 항목이 아니라 **타입**을 가리킨다 */
|
|
2751
2821
|
{ from: "operations", field: "locationType", target: { kind: "type", role: "location" }, via: "ops.rel.at", optional: true, tense: "standing" },
|
|
2752
|
-
{ from: "operations", field: "resourceType", target: { kind: "type", role: "equipment" }, via: "ops.rel.by", optional: true, tense: "standing" }
|
|
2822
|
+
{ from: "operations", field: "resourceType", target: { kind: "type", role: "equipment" }, via: "ops.rel.by", optional: true, tense: "standing" },
|
|
2823
|
+
/*
|
|
2824
|
+
* Route network (ADR-0266). A connection's ends are locations of this lens or referenced ones of another lens
|
|
2825
|
+
* (`referencedLocations`), so the target is the either-kind, like `locations.parentId`. Structure inside a published
|
|
2826
|
+
* edition has no time of its own - it holds for as long as the edition does - so these are `standing`, like a location's parent.
|
|
2827
|
+
*/
|
|
2828
|
+
{ from: "connections", field: "from", target: { kind: "axis-or-external", axis: "locations", entity: "lens.referencedLocation" }, via: "ops.rel.from", tense: "standing" },
|
|
2829
|
+
{ from: "connections", field: "to", target: { kind: "axis-or-external", axis: "locations", entity: "lens.referencedLocation" }, via: "ops.rel.to", tense: "standing" },
|
|
2830
|
+
{ from: "connections", field: "equipmentClassIds[]", target: { kind: "axis", axis: "equipmentClasses" }, via: "ops.rel.allows", optional: true, tense: "standing" },
|
|
2831
|
+
{ from: "fixedRoutes", field: "connectionIds[]", target: { kind: "axis", axis: "connections" }, via: "ops.rel.along", tense: "standing" },
|
|
2832
|
+
{ from: "fixedRoutes", field: "equipmentClassIds[]", target: { kind: "axis", axis: "equipmentClasses" }, via: "ops.rel.allows", optional: true, tense: "standing" },
|
|
2833
|
+
/* What a carrier accepts (ADR-0266 decision 8 ③) - a property of the asset class, so standing like the class itself. */
|
|
2834
|
+
{ from: "assetClasses", field: "accepts.materialDefinitionIds[]", target: { kind: "axis", axis: "materialDefinitions" }, via: "ops.rel.accepts", optional: true, tense: "standing" },
|
|
2835
|
+
{ from: "assetClasses", field: "accepts.materialClassIds[]", target: { kind: "axis", axis: "materialClasses" }, via: "ops.rel.accepts", optional: true, tense: "standing" }
|
|
2753
2836
|
];
|
|
2754
2837
|
var TWIN_PROPERTIES = [
|
|
2755
2838
|
/* 공정 — 선언(ISO 8601 기간)과 관측(저널에서 계산한 분포)이 둘 다 있는 유일한 짝. */
|
|
@@ -4020,6 +4103,279 @@ function partitionLensLocations(locations, lensSystem) {
|
|
|
4020
4103
|
return { own, referenced };
|
|
4021
4104
|
}
|
|
4022
4105
|
|
|
4106
|
+
// src/route-network.ts
|
|
4107
|
+
var CONNECTION_DIRECTION = ["one-way", "two-way"];
|
|
4108
|
+
var FIXED_ROUTE_BINDING = ["mandatory", "preferred"];
|
|
4109
|
+
var DEFAULT_CONNECTION_CAPACITY = 1;
|
|
4110
|
+
var ROUTE_NETWORK_ISSUE = {
|
|
4111
|
+
connectionDangling: "route-connection-dangling",
|
|
4112
|
+
connectionSelf: "route-connection-self",
|
|
4113
|
+
connectionLength: "route-connection-length",
|
|
4114
|
+
connectionSpeed: "route-connection-speed",
|
|
4115
|
+
connectionCapacity: "route-connection-capacity",
|
|
4116
|
+
connectionDirection: "route-connection-direction",
|
|
4117
|
+
connectionDuplicate: "route-connection-duplicate",
|
|
4118
|
+
connectionUnknownClass: "route-connection-unknown-class",
|
|
4119
|
+
fixedEmpty: "route-fixed-empty",
|
|
4120
|
+
fixedUnknownConnection: "route-fixed-unknown-connection",
|
|
4121
|
+
fixedBroken: "route-fixed-broken",
|
|
4122
|
+
fixedClass: "route-fixed-class",
|
|
4123
|
+
fixedBinding: "route-fixed-binding",
|
|
4124
|
+
duplicateId: "route-duplicate-id"
|
|
4125
|
+
};
|
|
4126
|
+
var positiveNumber = (v) => typeof v === "number" && Number.isFinite(v) && v > 0;
|
|
4127
|
+
function traversals(c) {
|
|
4128
|
+
return c.direction === "two-way" ? [{ from: c.from, to: c.to }, { from: c.to, to: c.from }] : [{ from: c.from, to: c.to }];
|
|
4129
|
+
}
|
|
4130
|
+
function admits(c, classIds, classes) {
|
|
4131
|
+
if (!c.equipmentClassIds || c.equipmentClassIds.length === 0) return true;
|
|
4132
|
+
const allowed = new Set(c.equipmentClassIds);
|
|
4133
|
+
return classIds.every((id) => [...classClosure([id], classes)].some((k) => allowed.has(k)));
|
|
4134
|
+
}
|
|
4135
|
+
function validateRouteNetwork(def) {
|
|
4136
|
+
const issues = [];
|
|
4137
|
+
const places = new Set([...def.locations ?? [], ...def.referencedLocations ?? []].map((l) => l.id));
|
|
4138
|
+
const connections = def.connections ?? [];
|
|
4139
|
+
const classIds = new Set((def.equipmentClasses ?? []).map((c) => c.id));
|
|
4140
|
+
const byId = /* @__PURE__ */ new Map();
|
|
4141
|
+
const seenEnds = /* @__PURE__ */ new Set();
|
|
4142
|
+
for (const c of connections) {
|
|
4143
|
+
if (byId.has(c.id)) issues.push({ code: ROUTE_NETWORK_ISSUE.duplicateId, subject: c.id, params: { kind: "connection" } });
|
|
4144
|
+
byId.set(c.id, c);
|
|
4145
|
+
for (const end of [c.from, c.to]) {
|
|
4146
|
+
if (!places.has(end)) issues.push({ code: ROUTE_NETWORK_ISSUE.connectionDangling, subject: c.id, params: { location: end } });
|
|
4147
|
+
}
|
|
4148
|
+
if (c.from === c.to) issues.push({ code: ROUTE_NETWORK_ISSUE.connectionSelf, subject: c.id, params: { location: c.from } });
|
|
4149
|
+
if (!CONNECTION_DIRECTION.includes(c.direction)) {
|
|
4150
|
+
issues.push({ code: ROUTE_NETWORK_ISSUE.connectionDirection, subject: c.id, params: { direction: String(c.direction) } });
|
|
4151
|
+
}
|
|
4152
|
+
if (!positiveNumber(c.lengthM)) issues.push({ code: ROUTE_NETWORK_ISSUE.connectionLength, subject: c.id, params: { lengthM: String(c.lengthM) } });
|
|
4153
|
+
if (c.maxSpeedMps !== void 0 && !positiveNumber(c.maxSpeedMps)) {
|
|
4154
|
+
issues.push({ code: ROUTE_NETWORK_ISSUE.connectionSpeed, subject: c.id, params: { maxSpeedMps: String(c.maxSpeedMps) } });
|
|
4155
|
+
}
|
|
4156
|
+
if (c.capacity !== void 0 && !(Number.isInteger(c.capacity) && c.capacity >= 1)) {
|
|
4157
|
+
issues.push({ code: ROUTE_NETWORK_ISSUE.connectionCapacity, subject: c.id, params: { capacity: String(c.capacity) } });
|
|
4158
|
+
}
|
|
4159
|
+
if (classIds.size > 0) {
|
|
4160
|
+
for (const id of c.equipmentClassIds ?? []) {
|
|
4161
|
+
if (!classIds.has(id)) issues.push({ code: ROUTE_NETWORK_ISSUE.connectionUnknownClass, subject: c.id, params: { equipmentClassId: id } });
|
|
4162
|
+
}
|
|
4163
|
+
}
|
|
4164
|
+
for (const t of traversals(c)) {
|
|
4165
|
+
const key = `${t.from}\0${t.to}`;
|
|
4166
|
+
if (seenEnds.has(key)) issues.push({ code: ROUTE_NETWORK_ISSUE.connectionDuplicate, subject: c.id, params: { from: t.from, to: t.to } });
|
|
4167
|
+
seenEnds.add(key);
|
|
4168
|
+
}
|
|
4169
|
+
}
|
|
4170
|
+
const routeIds = /* @__PURE__ */ new Set();
|
|
4171
|
+
for (const r of def.fixedRoutes ?? []) {
|
|
4172
|
+
if (routeIds.has(r.id)) issues.push({ code: ROUTE_NETWORK_ISSUE.duplicateId, subject: r.id, params: { kind: "fixed-route" } });
|
|
4173
|
+
routeIds.add(r.id);
|
|
4174
|
+
if (!FIXED_ROUTE_BINDING.includes(r.binding)) {
|
|
4175
|
+
issues.push({ code: ROUTE_NETWORK_ISSUE.fixedBinding, subject: r.id, params: { binding: String(r.binding) } });
|
|
4176
|
+
}
|
|
4177
|
+
if (!r.connectionIds || r.connectionIds.length === 0) {
|
|
4178
|
+
issues.push({ code: ROUTE_NETWORK_ISSUE.fixedEmpty, subject: r.id, params: {} });
|
|
4179
|
+
continue;
|
|
4180
|
+
}
|
|
4181
|
+
const legs = [];
|
|
4182
|
+
for (const id of r.connectionIds) {
|
|
4183
|
+
const c = byId.get(id);
|
|
4184
|
+
if (!c) issues.push({ code: ROUTE_NETWORK_ISSUE.fixedUnknownConnection, subject: r.id, params: { connection: id } });
|
|
4185
|
+
else legs.push(c);
|
|
4186
|
+
}
|
|
4187
|
+
if (legs.length !== r.connectionIds.length) continue;
|
|
4188
|
+
let at2 = new Set(traversals(legs[0]).map((t) => t.to));
|
|
4189
|
+
for (let i = 1; i < legs.length; i++) {
|
|
4190
|
+
const next = new Set(traversals(legs[i]).filter((t) => at2.has(t.from)).map((t) => t.to));
|
|
4191
|
+
if (next.size === 0) {
|
|
4192
|
+
issues.push({ code: ROUTE_NETWORK_ISSUE.fixedBroken, subject: r.id, params: { after: legs[i - 1].id, connection: legs[i].id } });
|
|
4193
|
+
break;
|
|
4194
|
+
}
|
|
4195
|
+
at2 = next;
|
|
4196
|
+
}
|
|
4197
|
+
for (const classId of r.equipmentClassIds ?? []) {
|
|
4198
|
+
const blocked = legs.find((c) => !admits(c, [classId], def.equipmentClasses));
|
|
4199
|
+
if (blocked) issues.push({ code: ROUTE_NETWORK_ISSUE.fixedClass, subject: r.id, params: { equipmentClassId: classId, connection: blocked.id } });
|
|
4200
|
+
}
|
|
4201
|
+
}
|
|
4202
|
+
return issues;
|
|
4203
|
+
}
|
|
4204
|
+
function connectionAdmits(c, equipmentClassIds, classes) {
|
|
4205
|
+
return admits(c, equipmentClassIds, classes);
|
|
4206
|
+
}
|
|
4207
|
+
|
|
4208
|
+
// src/travel.ts
|
|
4209
|
+
var TRAVEL_LINK_STATE = ["online", "stale", "lost"];
|
|
4210
|
+
var TRAVEL_LINK_JUDGED_BY = ["source", "derived"];
|
|
4211
|
+
function linkStateAt(link, nowTime, thresholds) {
|
|
4212
|
+
if (link.judgedBy === "source") return link;
|
|
4213
|
+
if (!nowTime) return void 0;
|
|
4214
|
+
const now = Date.parse(nowTime);
|
|
4215
|
+
const seen = Date.parse(link.lastSeenAt);
|
|
4216
|
+
const { staleAfterMs, lostAfterMs } = thresholds;
|
|
4217
|
+
if (!Number.isFinite(now) || !Number.isFinite(seen)) return void 0;
|
|
4218
|
+
if (!(staleAfterMs >= 0 && lostAfterMs >= staleAfterMs)) return void 0;
|
|
4219
|
+
const silentMs = now - seen;
|
|
4220
|
+
const state = silentMs > lostAfterMs ? "lost" : silentMs > staleAfterMs ? "stale" : "online";
|
|
4221
|
+
return { ...link, state, judgedBy: "derived" };
|
|
4222
|
+
}
|
|
4223
|
+
function isHeading(v) {
|
|
4224
|
+
return typeof v === "number" && Number.isFinite(v) && v >= 0 && v < 360;
|
|
4225
|
+
}
|
|
4226
|
+
|
|
4227
|
+
// src/intralogistics-profile.ts
|
|
4228
|
+
var ILG_BIZSTEP = {
|
|
4229
|
+
/** The carrier left a port. */
|
|
4230
|
+
departing: "urn:epcglobal:cbv:bizstep:departing",
|
|
4231
|
+
/** The carrier reached a port. */
|
|
4232
|
+
arriving: "urn:epcglobal:cbv:bizstep:arriving",
|
|
4233
|
+
/** The carrier is on its way. */
|
|
4234
|
+
transporting: "urn:epcglobal:cbv:bizstep:transporting"
|
|
4235
|
+
};
|
|
4236
|
+
var ILG_LOCATION_TYPES = ["waypoint", "port", "charger", "parking"];
|
|
4237
|
+
var ILG_LOCATION_LEVEL = {
|
|
4238
|
+
waypoint: "Other",
|
|
4239
|
+
port: "StorageUnit",
|
|
4240
|
+
charger: "Other",
|
|
4241
|
+
parking: "Other"
|
|
4242
|
+
};
|
|
4243
|
+
var ILG_LOCATION_CAPABILITIES = {
|
|
4244
|
+
waypoint: [],
|
|
4245
|
+
port: ["storable"],
|
|
4246
|
+
charger: [],
|
|
4247
|
+
parking: []
|
|
4248
|
+
};
|
|
4249
|
+
var ILG_TYPES = [
|
|
4250
|
+
...ILG_LOCATION_TYPES.map((k) => ({
|
|
4251
|
+
key: k,
|
|
4252
|
+
role: "location",
|
|
4253
|
+
label: `twin.type.${k}`,
|
|
4254
|
+
standardClass: { epcis: "bizLocation" },
|
|
4255
|
+
identity: { scheme: "gs1:SGLN" },
|
|
4256
|
+
level: ILG_LOCATION_LEVEL[k],
|
|
4257
|
+
capabilities: ILG_LOCATION_CAPABILITIES[k]
|
|
4258
|
+
})),
|
|
4259
|
+
/* A forklift under transport control keeps the wms `forklift` type and adds `guided` in the site's own declaration. */
|
|
4260
|
+
{ key: "amr", role: "equipment", label: "twin.type.amr", standardClass: { epcis: "object", iso55000: "Asset" }, identity: { scheme: "gs1:GIAI" }, capabilities: ["mobile", "guided", "operable", "energyStoring"] },
|
|
4261
|
+
{ key: "agv", role: "equipment", label: "twin.type.agv", standardClass: { epcis: "object", iso55000: "Asset" }, identity: { scheme: "gs1:GIAI" }, capabilities: ["mobile", "guided", "operable", "energyStoring"] }
|
|
4262
|
+
];
|
|
4263
|
+
function intralogisticsTypeOf(key) {
|
|
4264
|
+
return ILG_TYPES.find((t) => t.key === key);
|
|
4265
|
+
}
|
|
4266
|
+
var ILG_ORDER_KIND = {
|
|
4267
|
+
transport: "transport"
|
|
4268
|
+
};
|
|
4269
|
+
var ILG_TASK_KIND = {
|
|
4270
|
+
leg: "transport-leg",
|
|
4271
|
+
charge: "charge",
|
|
4272
|
+
park: "park"
|
|
4273
|
+
};
|
|
4274
|
+
var TRANSPORT_FAILURE_REASON = [
|
|
4275
|
+
"no-route",
|
|
4276
|
+
"destination-unavailable",
|
|
4277
|
+
"carrier-not-found",
|
|
4278
|
+
/** The carrier identified at pick-up is not the one the command named. */
|
|
4279
|
+
"carrier-mismatch",
|
|
4280
|
+
"cancelled-by-source",
|
|
4281
|
+
"equipment-fault"
|
|
4282
|
+
];
|
|
4283
|
+
function isTransportFailureReason(v) {
|
|
4284
|
+
return typeof v === "string" && TRANSPORT_FAILURE_REASON.includes(v);
|
|
4285
|
+
}
|
|
4286
|
+
var ILG_ATTENTION_KIND = {
|
|
4287
|
+
deadlock: "intralogic.traffic-deadlock",
|
|
4288
|
+
blocked: "intralogic.traffic-blocked",
|
|
4289
|
+
lowCharge: "intralogic.low-charge",
|
|
4290
|
+
linkLost: "intralogic.link-lost",
|
|
4291
|
+
noRoute: "intralogic.no-route",
|
|
4292
|
+
rerouted: "intralogic.rerouted",
|
|
4293
|
+
carrierUnidentified: "intralogic.carrier-unidentified",
|
|
4294
|
+
carrierDuplicate: "intralogic.carrier-duplicate"
|
|
4295
|
+
};
|
|
4296
|
+
|
|
4297
|
+
// src/transport-policy.ts
|
|
4298
|
+
var DISPATCH_RULE = {
|
|
4299
|
+
/** The first available machine in the kernel's own order - what its assignment does today. */
|
|
4300
|
+
firstIdle: "firstIdle",
|
|
4301
|
+
/** The machine that reaches the pick-up soonest; ties by id. */
|
|
4302
|
+
minEta: "minEta"
|
|
4303
|
+
};
|
|
4304
|
+
var ROUTING_RULE = {
|
|
4305
|
+
/** Least travel time, reservations not considered. Connection time = length / effective speed. */
|
|
4306
|
+
shortestTime: "shortestTime",
|
|
4307
|
+
/** Least arrival time over time windows: a connection held past its capacity is waited for or avoided. */
|
|
4308
|
+
timeWindow: "timeWindow"
|
|
4309
|
+
};
|
|
4310
|
+
var TRAFFIC_CONFLICT_ACTION = ["wait", "replan", "yield"];
|
|
4311
|
+
var TRANSPORT_POLICY_ISSUE = {
|
|
4312
|
+
ruleMissing: "policy-rule-missing",
|
|
4313
|
+
ruleUnknown: "policy-rule-unknown",
|
|
4314
|
+
conflictAction: "policy-conflict-action",
|
|
4315
|
+
horizon: "policy-horizon",
|
|
4316
|
+
soc: "policy-soc",
|
|
4317
|
+
alternateUnknown: "policy-alternate-unknown",
|
|
4318
|
+
alternateSelf: "policy-alternate-self",
|
|
4319
|
+
alternateDuplicate: "policy-alternate-duplicate"
|
|
4320
|
+
};
|
|
4321
|
+
var isPercent = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0 && v <= 100;
|
|
4322
|
+
function validateTransportPolicy(policy, locationIds) {
|
|
4323
|
+
const issues = [];
|
|
4324
|
+
const known = { dispatch: Object.values(DISPATCH_RULE), routing: Object.values(ROUTING_RULE) };
|
|
4325
|
+
for (const part of ["dispatch", "routing"]) {
|
|
4326
|
+
const rule = policy[part]?.rule;
|
|
4327
|
+
if (typeof rule !== "string" || rule.trim() === "") issues.push({ code: TRANSPORT_POLICY_ISSUE.ruleMissing, params: { part } });
|
|
4328
|
+
else if (!known[part].includes(rule)) issues.push({ code: TRANSPORT_POLICY_ISSUE.ruleUnknown, params: { part, rule } });
|
|
4329
|
+
}
|
|
4330
|
+
if (!TRAFFIC_CONFLICT_ACTION.includes(policy.traffic?.onConflict)) {
|
|
4331
|
+
issues.push({ code: TRANSPORT_POLICY_ISSUE.conflictAction, params: { onConflict: String(policy.traffic?.onConflict) } });
|
|
4332
|
+
}
|
|
4333
|
+
const horizon = policy.traffic?.horizonS;
|
|
4334
|
+
if (horizon !== void 0 && !(typeof horizon === "number" && Number.isFinite(horizon) && horizon > 0)) {
|
|
4335
|
+
issues.push({ code: TRANSPORT_POLICY_ISSUE.horizon, params: { horizonS: String(horizon) } });
|
|
4336
|
+
}
|
|
4337
|
+
const { lowSoc, targetSoc } = policy.charging ?? {};
|
|
4338
|
+
if (!isPercent(lowSoc) || !isPercent(targetSoc) || lowSoc >= targetSoc) {
|
|
4339
|
+
issues.push({ code: TRANSPORT_POLICY_ISSUE.soc, params: { lowSoc: String(lowSoc), targetSoc: String(targetSoc) } });
|
|
4340
|
+
}
|
|
4341
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4342
|
+
for (const a of policy.alternates ?? []) {
|
|
4343
|
+
if (seen.has(a.destination)) issues.push({ code: TRANSPORT_POLICY_ISSUE.alternateDuplicate, params: { destination: a.destination } });
|
|
4344
|
+
seen.add(a.destination);
|
|
4345
|
+
if (a.alternatives.includes(a.destination)) issues.push({ code: TRANSPORT_POLICY_ISSUE.alternateSelf, params: { destination: a.destination } });
|
|
4346
|
+
if (locationIds) {
|
|
4347
|
+
for (const id of [a.destination, ...a.alternatives]) {
|
|
4348
|
+
if (!locationIds.has(id)) issues.push({ code: TRANSPORT_POLICY_ISSUE.alternateUnknown, params: { location: id } });
|
|
4349
|
+
}
|
|
4350
|
+
}
|
|
4351
|
+
}
|
|
4352
|
+
return issues;
|
|
4353
|
+
}
|
|
4354
|
+
|
|
4355
|
+
// src/asset-acceptance.ts
|
|
4356
|
+
function acceptsMaterial(accepts, query) {
|
|
4357
|
+
if (!accepts) return void 0;
|
|
4358
|
+
const defs = accepts.materialDefinitionIds ?? [];
|
|
4359
|
+
const classes = accepts.materialClassIds ?? [];
|
|
4360
|
+
const named = query.materialDefinitionId !== void 0 || (query.materialClassIds?.length ?? 0) > 0;
|
|
4361
|
+
if (!named) return void 0;
|
|
4362
|
+
let material;
|
|
4363
|
+
if (defs.length === 0 && classes.length === 0) material = void 0;
|
|
4364
|
+
else {
|
|
4365
|
+
const byDef = query.materialDefinitionId !== void 0 && defs.includes(query.materialDefinitionId);
|
|
4366
|
+
const byClass = (query.materialClassIds ?? []).some((id) => classes.includes(id));
|
|
4367
|
+
material = byDef || byClass;
|
|
4368
|
+
}
|
|
4369
|
+
if (material === false) return false;
|
|
4370
|
+
let quantity = true;
|
|
4371
|
+
if (query.quantity && accepts.maxQuantity) {
|
|
4372
|
+
quantity = query.quantity.uom === accepts.maxQuantity.uom ? query.quantity.value <= accepts.maxQuantity.value : void 0;
|
|
4373
|
+
}
|
|
4374
|
+
if (quantity === false) return false;
|
|
4375
|
+
if (material === void 0 || quantity === void 0) return void 0;
|
|
4376
|
+
return true;
|
|
4377
|
+
}
|
|
4378
|
+
|
|
4023
4379
|
// src/face2-adapter.ts
|
|
4024
4380
|
function isAggregationRecord(record) {
|
|
4025
4381
|
if (!record || typeof record !== "object") return false;
|
|
@@ -6126,7 +6482,10 @@ function inheritedExpiry(inputExpiries) {
|
|
|
6126
6482
|
COMMAND_EVENT,
|
|
6127
6483
|
COMMAND_ORIGIN,
|
|
6128
6484
|
COMMAND_STATE,
|
|
6485
|
+
CONNECTION_DIRECTION,
|
|
6486
|
+
DEFAULT_CONNECTION_CAPACITY,
|
|
6129
6487
|
DISP,
|
|
6488
|
+
DISPATCH_RULE,
|
|
6130
6489
|
DISPOSITION_DECISION,
|
|
6131
6490
|
DOCK_DOOR_STATUS,
|
|
6132
6491
|
DOCK_FACT_KIND,
|
|
@@ -6147,9 +6506,16 @@ function inheritedExpiry(inputExpiries) {
|
|
|
6147
6506
|
ERP_MASTER_AXIS,
|
|
6148
6507
|
FIELDS_NOT_CARRIED,
|
|
6149
6508
|
FIRST_PASS_RULE,
|
|
6509
|
+
FIXED_ROUTE_BINDING,
|
|
6150
6510
|
GUARD_PRAGMA,
|
|
6151
6511
|
HATIOLAB_VOCABULARY,
|
|
6152
6512
|
HEADER_FIELDS_PARTITIONED,
|
|
6513
|
+
ILG_ATTENTION_KIND,
|
|
6514
|
+
ILG_BIZSTEP,
|
|
6515
|
+
ILG_LOCATION_TYPES,
|
|
6516
|
+
ILG_ORDER_KIND,
|
|
6517
|
+
ILG_TASK_KIND,
|
|
6518
|
+
ILG_TYPES,
|
|
6153
6519
|
ILMD_ATTR,
|
|
6154
6520
|
LOCATION_SATURATION_NEAR,
|
|
6155
6521
|
MATERIAL_ACTUAL_USE,
|
|
@@ -6183,6 +6549,8 @@ function inheritedExpiry(inputExpiries) {
|
|
|
6183
6549
|
RESOURCE_KIND,
|
|
6184
6550
|
RETIRED_VOCABULARY,
|
|
6185
6551
|
RETURN_TO_SUPPLIER,
|
|
6552
|
+
ROUTE_NETWORK_ISSUE,
|
|
6553
|
+
ROUTING_RULE,
|
|
6186
6554
|
SCHEDULE_STATUS,
|
|
6187
6555
|
SIGNATURE_REJECTED_REASONS,
|
|
6188
6556
|
SOURCE_DEST_PARTY_TYPE,
|
|
@@ -6191,7 +6559,12 @@ function inheritedExpiry(inputExpiries) {
|
|
|
6191
6559
|
TARIFF_LOAD_CLASSES,
|
|
6192
6560
|
TASK_STATUS,
|
|
6193
6561
|
TASK_TERMINAL_STATUS,
|
|
6562
|
+
TRAFFIC_CONFLICT_ACTION,
|
|
6194
6563
|
TRAILER_LOAD,
|
|
6564
|
+
TRANSPORT_FAILURE_REASON,
|
|
6565
|
+
TRANSPORT_POLICY_ISSUE,
|
|
6566
|
+
TRAVEL_LINK_JUDGED_BY,
|
|
6567
|
+
TRAVEL_LINK_STATE,
|
|
6195
6568
|
TWIN_AXES,
|
|
6196
6569
|
TWIN_PROPERTIES,
|
|
6197
6570
|
TWIN_RELATIONS,
|
|
@@ -6218,6 +6591,7 @@ function inheritedExpiry(inputExpiries) {
|
|
|
6218
6591
|
YMS_ORDER_KIND,
|
|
6219
6592
|
YMS_TASK_KIND,
|
|
6220
6593
|
YMS_TYPES,
|
|
6594
|
+
acceptsMaterial,
|
|
6221
6595
|
acceptsPerformance,
|
|
6222
6596
|
activeBands,
|
|
6223
6597
|
activeShiftAt,
|
|
@@ -6249,6 +6623,7 @@ function inheritedExpiry(inputExpiries) {
|
|
|
6249
6623
|
computeMtbf,
|
|
6250
6624
|
computeMttr,
|
|
6251
6625
|
computeOee,
|
|
6626
|
+
connectionAdmits,
|
|
6252
6627
|
conversionFactorOf,
|
|
6253
6628
|
criterionSaysNothing,
|
|
6254
6629
|
dayOfYearOf,
|
|
@@ -6294,6 +6669,7 @@ function inheritedExpiry(inputExpiries) {
|
|
|
6294
6669
|
ingestOperationalRecords,
|
|
6295
6670
|
inheritedExpiry,
|
|
6296
6671
|
inheritedLotUse,
|
|
6672
|
+
intralogisticsTypeOf,
|
|
6297
6673
|
isAggregationRecord,
|
|
6298
6674
|
isAppointmentClosed,
|
|
6299
6675
|
isCacheableTense,
|
|
@@ -6313,6 +6689,7 @@ function inheritedExpiry(inputExpiries) {
|
|
|
6313
6689
|
isEquipmentStatus,
|
|
6314
6690
|
isFailureStatus,
|
|
6315
6691
|
isFlowOrder,
|
|
6692
|
+
isHeading,
|
|
6316
6693
|
isIso4217Code,
|
|
6317
6694
|
isIsoDateTime,
|
|
6318
6695
|
isMasterDataRecord,
|
|
@@ -6331,6 +6708,7 @@ function inheritedExpiry(inputExpiries) {
|
|
|
6331
6708
|
isTaskTerminal,
|
|
6332
6709
|
isTestSpecificationBasis,
|
|
6333
6710
|
isTransformationRecord,
|
|
6711
|
+
isTransportFailureReason,
|
|
6334
6712
|
isWebhookDeliveryCode,
|
|
6335
6713
|
isWebhookSecretSegment,
|
|
6336
6714
|
isWorkShiftExecutionBasis,
|
|
@@ -6344,6 +6722,7 @@ function inheritedExpiry(inputExpiries) {
|
|
|
6344
6722
|
judgeAgainstSpec,
|
|
6345
6723
|
levelOfLocationType,
|
|
6346
6724
|
lgtinClass,
|
|
6725
|
+
linkStateAt,
|
|
6347
6726
|
localDayIndexAt,
|
|
6348
6727
|
localDayStartMs,
|
|
6349
6728
|
locationStatusOf,
|
|
@@ -6430,7 +6809,9 @@ function inheritedExpiry(inputExpiries) {
|
|
|
6430
6809
|
validateDomainDefinition,
|
|
6431
6810
|
validateEpcisEvent,
|
|
6432
6811
|
validatePerformance,
|
|
6812
|
+
validateRouteNetwork,
|
|
6433
6813
|
validateScenario,
|
|
6814
|
+
validateTransportPolicy,
|
|
6434
6815
|
verdictOfAck,
|
|
6435
6816
|
webhookLaneOf,
|
|
6436
6817
|
webhookSecretCandidates,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operato/ops-contract",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.49",
|
|
4
4
|
"description": "Operations domain contract — what producers and readers agree on: the standard vocabulary (EPCIS 2.0/GS1, ISA-95, IEC 61850/ISO 50001) and the records operations products exchange with the twin and with each other. Types, guards, validation. No state, no engine.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist-cjs/index.cjs",
|