@operato/ops-contract 0.9.38 → 0.9.40
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/contract.d.ts +22 -0
- package/dist/contract.js +11 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/operational-ingest.js +6 -3
- package/dist/referenced-location.d.ts +20 -0
- package/dist/referenced-location.js +20 -0
- package/dist-cjs/index.cjs +27 -2
- package/package.json +1 -1
package/dist/contract.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type RatedUsage, type UsedUsage } from './rated-usage.ts';
|
|
2
2
|
import type { FoldedOrders, OrderFoldPolicy } from './order-fold.ts';
|
|
3
|
+
import type { ReferencedLocation } from './referenced-location.ts';
|
|
3
4
|
export type ISOTime = string;
|
|
4
5
|
export interface CanonicalEnvelope<T = unknown> {
|
|
5
6
|
eventId: string;
|
|
@@ -2570,6 +2571,8 @@ export interface StateSnapshot {
|
|
|
2570
2571
|
allocatedWithUnknownLotUse?: number;
|
|
2571
2572
|
};
|
|
2572
2573
|
locations: LocationState[];
|
|
2574
|
+
/** 이 트윈이 참조만 하는 다른 렌즈의 자리 — 모델의 선언을 그대로 싣는다(없으면 칸이 없다). */
|
|
2575
|
+
referencedLocations?: ReferencedLocation[];
|
|
2573
2576
|
items: ItemState[];
|
|
2574
2577
|
/**
|
|
2575
2578
|
* 설비 — **ISA-95 `Equipment`.** 고정 설비(도장기·용접로봇)와 이동 설비(지게차·호슬러)를 한 그릇에
|
|
@@ -3721,9 +3724,23 @@ export interface ObservedOrderLine {
|
|
|
3721
3724
|
*/
|
|
3722
3725
|
allocated?: number;
|
|
3723
3726
|
}
|
|
3727
|
+
/**
|
|
3728
|
+
* **왜 근거가 없나** — 근거 칸(`materialBasis`·`recipeBasis`)이 비어 있는 까닭을 적는 닫힌 낱말.
|
|
3729
|
+
*
|
|
3730
|
+
* `BEFORE_BASELINE` 한 가지뿐이다: 근거를 적는 장치가 생기기 전에 투입된 오더. 그런 오더도 이행량과
|
|
3731
|
+
* 상태는 사실이다 — 사실을 막으면 미러는 끝난 오더를 0 % 로 들고 있다(ADR-0090 ㉮, 2026-09-24).
|
|
3732
|
+
* 칸이 없으면 「근거가 있어야 하는데 빠졌다」와 「원래 없던 시절의 것」이 구분되지 않는다.
|
|
3733
|
+
*
|
|
3734
|
+
* 새 낱말이 아니다 — 교대 스탬프·검사 결과가 같은 까닭에 이미 쓰는 값(ADR-0086)을 그대로 쓴다.
|
|
3735
|
+
* 근거가 **반쯤** 잡힌 오더는 여기 들지 않는다: 그것은 모르는 것이 아니라 깨진 것이고, 보내는 쪽이 거절한다.
|
|
3736
|
+
*/
|
|
3737
|
+
export declare const BASIS_UNKNOWN: readonly ["BEFORE_BASELINE"];
|
|
3738
|
+
export type BasisUnknown = (typeof BASIS_UNKNOWN)[number];
|
|
3724
3739
|
export interface OrderStatusDelta {
|
|
3725
3740
|
materialBasis?: MaterialExecutionBasis[];
|
|
3726
3741
|
recipeBasis?: RecipeExecutionBasis;
|
|
3742
|
+
/** 근거 칸이 빈 까닭(§`BASIS_UNKNOWN`). 근거가 실리면 이 칸은 없다. */
|
|
3743
|
+
basisUnknown?: BasisUnknown;
|
|
3727
3744
|
orderId: string;
|
|
3728
3745
|
kind: string;
|
|
3729
3746
|
status: string;
|
|
@@ -3860,6 +3877,11 @@ export interface TwinModelDef {
|
|
|
3860
3877
|
properties?: ResourceProperty[];
|
|
3861
3878
|
testSpecificationIds?: TestSpecificationRefs;
|
|
3862
3879
|
})[];
|
|
3880
|
+
/**
|
|
3881
|
+
* **다른 렌즈의 자리** — 참조만 한다(§`ReferencedLocation`). 이 트윈의 자리가 아니므로 능력 · 용량 · 종류가 없고, 거기로 간
|
|
3882
|
+
* 물품은 이 트윈의 재고에서 빠진다. 없으면 참조하는 자리가 없다.
|
|
3883
|
+
*/
|
|
3884
|
+
referencedLocations?: ReferencedLocation[];
|
|
3863
3885
|
/**
|
|
3864
3886
|
* 설비 — ISA-95 `Equipment`. mtbfMs/mttrMs 지정 시 확률적 고장 모델 참여(OEE Availability 손실).
|
|
3865
3887
|
* 미지정=고장 없음. `window` 지정 시 그 시간대에만 일한다(교대·가동시간) — 미지정이면 24시간 가용.
|
package/dist/contract.js
CHANGED
|
@@ -1518,6 +1518,17 @@ export const ALLOCATION_POLICY = {
|
|
|
1518
1518
|
/** 먼저 만료되는 것부터(First Expired, First Out). */
|
|
1519
1519
|
fefo: 'fefo'
|
|
1520
1520
|
};
|
|
1521
|
+
/**
|
|
1522
|
+
* **왜 근거가 없나** — 근거 칸(`materialBasis`·`recipeBasis`)이 비어 있는 까닭을 적는 닫힌 낱말.
|
|
1523
|
+
*
|
|
1524
|
+
* `BEFORE_BASELINE` 한 가지뿐이다: 근거를 적는 장치가 생기기 전에 투입된 오더. 그런 오더도 이행량과
|
|
1525
|
+
* 상태는 사실이다 — 사실을 막으면 미러는 끝난 오더를 0 % 로 들고 있다(ADR-0090 ㉮, 2026-09-24).
|
|
1526
|
+
* 칸이 없으면 「근거가 있어야 하는데 빠졌다」와 「원래 없던 시절의 것」이 구분되지 않는다.
|
|
1527
|
+
*
|
|
1528
|
+
* 새 낱말이 아니다 — 교대 스탬프·검사 결과가 같은 까닭에 이미 쓰는 값(ADR-0086)을 그대로 쓴다.
|
|
1529
|
+
* 근거가 **반쯤** 잡힌 오더는 여기 들지 않는다: 그것은 모르는 것이 아니라 깨진 것이고, 보내는 쪽이 거절한다.
|
|
1530
|
+
*/
|
|
1531
|
+
export const BASIS_UNKNOWN = ['BEFORE_BASELINE'];
|
|
1521
1532
|
// ── Command 채널 어휘 — 트윈의 "행위(act)" 면 (prescriptive/트랜잭션 프론트엔드) ──
|
|
1522
1533
|
// 코어 공통: order.hold/resume(할당 보류). 도메인: order.release(즉시 투입) 등은 handleCommand 로.
|
|
1523
1534
|
export const CMD = {
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from './ems-profile.ts';
|
|
|
7
7
|
export * from './energy-ingest.ts';
|
|
8
8
|
export * from './epcis.ts';
|
|
9
9
|
export * from './order-fold.ts';
|
|
10
|
+
export * from './referenced-location.ts';
|
|
10
11
|
export * from './face2-adapter.ts';
|
|
11
12
|
export * from './iso-duration.ts';
|
|
12
13
|
export * from './master-data.ts';
|
package/dist/index.js
CHANGED
|
@@ -28,6 +28,7 @@ export * from "./ems-profile.js";
|
|
|
28
28
|
export * from "./energy-ingest.js";
|
|
29
29
|
export * from "./epcis.js";
|
|
30
30
|
export * from "./order-fold.js";
|
|
31
|
+
export * from "./referenced-location.js";
|
|
31
32
|
export * from "./face2-adapter.js";
|
|
32
33
|
export * from "./iso-duration.js";
|
|
33
34
|
export * from "./master-data.js";
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
* 모르는 필드는 **조용히 버리지 않고 거부한다.** `taskID` 처럼 한 글자 틀린 이름은 통과시키면 영원히
|
|
35
35
|
* 보이지 않는 손실이 된다(이 문에는 아직 옛 발신자가 없어 호환 부담도 없다).
|
|
36
36
|
*/
|
|
37
|
-
import { OP_EVENT, DISPOSITION_DECISION, MATERIAL_ACTUAL_USE, MATERIAL_LOT_USE, isTestSpecificationBasis, isRecipeExecutionBasis, isMaterialExecutionBasis } from "./contract.js";
|
|
37
|
+
import { OP_EVENT, BASIS_UNKNOWN, DISPOSITION_DECISION, MATERIAL_ACTUAL_USE, MATERIAL_LOT_USE, isTestSpecificationBasis, isRecipeExecutionBasis, isMaterialExecutionBasis } from "./contract.js";
|
|
38
38
|
import { isWorkShiftExecutionBasis } from "./work-shift-basis.js";
|
|
39
39
|
/**
|
|
40
40
|
* 객체 한 줄이 선언된 안쪽 모양을 지키나 — **선언하지 않은 자리는 보지 않는다.**
|
|
@@ -230,8 +230,12 @@ const SPECS = {
|
|
|
230
230
|
*
|
|
231
231
|
* 새 어휘가 아니다 — 계약이 `recipeKey` 를 네 자리에서 이미 쓴다. 오더 관측에만 자리가 없었다.
|
|
232
232
|
*/
|
|
233
|
-
recipeKey: 'string', recipeBasis: 'object', materialBasis: 'object[]'
|
|
233
|
+
recipeKey: 'string', recipeBasis: 'object', materialBasis: 'object[]',
|
|
234
|
+
/* 근거 칸이 빈 까닭 — 닫힌 낱말이다(§`BASIS_UNKNOWN`). 투입이 근거 장치보다 먼저였던 오더도 이행은 사실이다. */
|
|
235
|
+
basisUnknown: 'string'
|
|
234
236
|
},
|
|
237
|
+
/* 상태·종류는 도메인이 소유한다 — 닫지 않는다. 근거가 빈 까닭은 커널이 읽으므로 닫는다. */
|
|
238
|
+
enums: { basisUnknown: BASIS_UNKNOWN },
|
|
235
239
|
/*
|
|
236
240
|
* 확보분의 안쪽을 본다 — 열쇠와 수 둘이다(§`AllocatedQuantity`). 안 보면 틀린 이름이 조용히
|
|
237
241
|
* 지나가고(`epcs`·`quantity` 따위), 미러는 잡힌 수를 0 으로 읽는다.
|
|
@@ -253,7 +257,6 @@ const SPECS = {
|
|
|
253
257
|
positive: ['qty']
|
|
254
258
|
}
|
|
255
259
|
}
|
|
256
|
-
/* 상태·종류는 도메인이 소유한다 — 닫지 않는다. */
|
|
257
260
|
},
|
|
258
261
|
quality: {
|
|
259
262
|
eventType: OP_EVENT.quality,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface ReferencedLocation {
|
|
2
|
+
id: string;
|
|
3
|
+
/** 그 자리를 정의하는 영역 — 기준정보가 말한 그대로(`mes` · `wms` · `yms` …). */
|
|
4
|
+
system: string;
|
|
5
|
+
}
|
|
6
|
+
/** 모델이 참조만 하는 자리의 id 집합. 선언이 없으면 빈 집합이다. */
|
|
7
|
+
export declare function referencedLocationIds(def: {
|
|
8
|
+
referencedLocations?: readonly ReferencedLocation[];
|
|
9
|
+
} | null | undefined): Set<string>;
|
|
10
|
+
/**
|
|
11
|
+
* 기준정보의 자리를 렌즈 기준으로 가른다 — 자리가 자기 영역을 말하지 않았으면 이 렌즈의 것이다(옛 원본 · 영역 없는 원본은
|
|
12
|
+
* 지금까지와 같이 선다). 영역을 말했고 이 렌즈와 다르면 참조다.
|
|
13
|
+
*/
|
|
14
|
+
export declare function partitionLensLocations<T extends {
|
|
15
|
+
id: string;
|
|
16
|
+
system?: string;
|
|
17
|
+
}>(locations: readonly T[], lensSystem: string): {
|
|
18
|
+
own: T[];
|
|
19
|
+
referenced: ReferencedLocation[];
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** 모델이 참조만 하는 자리의 id 집합. 선언이 없으면 빈 집합이다. */
|
|
2
|
+
export function referencedLocationIds(def) {
|
|
3
|
+
return new Set((def?.referencedLocations ?? []).map(r => r.id).filter(Boolean));
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* 기준정보의 자리를 렌즈 기준으로 가른다 — 자리가 자기 영역을 말하지 않았으면 이 렌즈의 것이다(옛 원본 · 영역 없는 원본은
|
|
7
|
+
* 지금까지와 같이 선다). 영역을 말했고 이 렌즈와 다르면 참조다.
|
|
8
|
+
*/
|
|
9
|
+
export function partitionLensLocations(locations, lensSystem) {
|
|
10
|
+
const own = [];
|
|
11
|
+
const referenced = [];
|
|
12
|
+
for (const l of locations) {
|
|
13
|
+
const system = typeof l.system === 'string' ? l.system.trim() : '';
|
|
14
|
+
if (system && system !== lensSystem)
|
|
15
|
+
referenced.push({ id: l.id, system });
|
|
16
|
+
else
|
|
17
|
+
own.push(l);
|
|
18
|
+
}
|
|
19
|
+
return { own, referenced };
|
|
20
|
+
}
|
package/dist-cjs/index.cjs
CHANGED
|
@@ -21,6 +21,7 @@ var index_exports = {};
|
|
|
21
21
|
__export(index_exports, {
|
|
22
22
|
ABSENCE: () => ABSENCE,
|
|
23
23
|
ALLOCATION_POLICY: () => ALLOCATION_POLICY,
|
|
24
|
+
BASIS_UNKNOWN: () => BASIS_UNKNOWN,
|
|
24
25
|
BIZSTEP: () => BIZSTEP,
|
|
25
26
|
BTT: () => BTT,
|
|
26
27
|
BTT_PRODORDER: () => BTT_PRODORDER,
|
|
@@ -227,6 +228,7 @@ __export(index_exports, {
|
|
|
227
228
|
outsideLimit: () => outsideLimit,
|
|
228
229
|
parseEpc: () => parseEpc,
|
|
229
230
|
parseIsoDuration: () => parseIsoDuration,
|
|
231
|
+
partitionLensLocations: () => partitionLensLocations,
|
|
230
232
|
passThroughReversible: () => passThroughReversible,
|
|
231
233
|
performanceKey: () => performanceKey,
|
|
232
234
|
periodFactId: () => periodFactId,
|
|
@@ -240,6 +242,7 @@ __export(index_exports, {
|
|
|
240
242
|
readBoardAssets: () => readBoardAssets,
|
|
241
243
|
readBoardEquipment: () => readBoardEquipment,
|
|
242
244
|
readBoardLocations: () => readBoardLocations,
|
|
245
|
+
referencedLocationIds: () => referencedLocationIds,
|
|
243
246
|
relationsFrom: () => relationsFrom,
|
|
244
247
|
relationsTo: () => relationsTo,
|
|
245
248
|
requiredTestsFor: () => requiredTestsFor,
|
|
@@ -1177,6 +1180,7 @@ var ALLOCATION_POLICY = {
|
|
|
1177
1180
|
/** 먼저 만료되는 것부터(First Expired, First Out). */
|
|
1178
1181
|
fefo: "fefo"
|
|
1179
1182
|
};
|
|
1183
|
+
var BASIS_UNKNOWN = ["BEFORE_BASELINE"];
|
|
1180
1184
|
var CMD = {
|
|
1181
1185
|
orderHold: "order.hold",
|
|
1182
1186
|
orderResume: "order.resume",
|
|
@@ -3511,6 +3515,21 @@ function finishedFlowOrdersWithin(hot, folded, nowMs, policy = ORDER_FOLD_DEFAUL
|
|
|
3511
3515
|
return { fromMs, toMs: nowMs, count, byStatus };
|
|
3512
3516
|
}
|
|
3513
3517
|
|
|
3518
|
+
// src/referenced-location.ts
|
|
3519
|
+
function referencedLocationIds(def) {
|
|
3520
|
+
return new Set((def?.referencedLocations ?? []).map((r) => r.id).filter(Boolean));
|
|
3521
|
+
}
|
|
3522
|
+
function partitionLensLocations(locations, lensSystem) {
|
|
3523
|
+
const own = [];
|
|
3524
|
+
const referenced = [];
|
|
3525
|
+
for (const l of locations) {
|
|
3526
|
+
const system = typeof l.system === "string" ? l.system.trim() : "";
|
|
3527
|
+
if (system && system !== lensSystem) referenced.push({ id: l.id, system });
|
|
3528
|
+
else own.push(l);
|
|
3529
|
+
}
|
|
3530
|
+
return { own, referenced };
|
|
3531
|
+
}
|
|
3532
|
+
|
|
3514
3533
|
// src/face2-adapter.ts
|
|
3515
3534
|
function isAggregationRecord(record) {
|
|
3516
3535
|
if (!record || typeof record !== "object") return false;
|
|
@@ -4042,8 +4061,12 @@ var SPECS = {
|
|
|
4042
4061
|
*/
|
|
4043
4062
|
recipeKey: "string",
|
|
4044
4063
|
recipeBasis: "object",
|
|
4045
|
-
materialBasis: "object[]"
|
|
4064
|
+
materialBasis: "object[]",
|
|
4065
|
+
/* 근거 칸이 빈 까닭 — 닫힌 낱말이다(§`BASIS_UNKNOWN`). 투입이 근거 장치보다 먼저였던 오더도 이행은 사실이다. */
|
|
4066
|
+
basisUnknown: "string"
|
|
4046
4067
|
},
|
|
4068
|
+
/* 상태·종류는 도메인이 소유한다 — 닫지 않는다. 근거가 빈 까닭은 커널이 읽으므로 닫는다. */
|
|
4069
|
+
enums: { basisUnknown: BASIS_UNKNOWN },
|
|
4047
4070
|
/*
|
|
4048
4071
|
* 확보분의 안쪽을 본다 — 열쇠와 수 둘이다(§`AllocatedQuantity`). 안 보면 틀린 이름이 조용히
|
|
4049
4072
|
* 지나가고(`epcs`·`quantity` 따위), 미러는 잡힌 수를 0 으로 읽는다.
|
|
@@ -4065,7 +4088,6 @@ var SPECS = {
|
|
|
4065
4088
|
positive: ["qty"]
|
|
4066
4089
|
}
|
|
4067
4090
|
}
|
|
4068
|
-
/* 상태·종류는 도메인이 소유한다 — 닫지 않는다. */
|
|
4069
4091
|
},
|
|
4070
4092
|
quality: {
|
|
4071
4093
|
eventType: OP_EVENT.quality,
|
|
@@ -5099,6 +5121,7 @@ function nonEmpty(value) {
|
|
|
5099
5121
|
0 && (module.exports = {
|
|
5100
5122
|
ABSENCE,
|
|
5101
5123
|
ALLOCATION_POLICY,
|
|
5124
|
+
BASIS_UNKNOWN,
|
|
5102
5125
|
BIZSTEP,
|
|
5103
5126
|
BTT,
|
|
5104
5127
|
BTT_PRODORDER,
|
|
@@ -5305,6 +5328,7 @@ function nonEmpty(value) {
|
|
|
5305
5328
|
outsideLimit,
|
|
5306
5329
|
parseEpc,
|
|
5307
5330
|
parseIsoDuration,
|
|
5331
|
+
partitionLensLocations,
|
|
5308
5332
|
passThroughReversible,
|
|
5309
5333
|
performanceKey,
|
|
5310
5334
|
periodFactId,
|
|
@@ -5318,6 +5342,7 @@ function nonEmpty(value) {
|
|
|
5318
5342
|
readBoardAssets,
|
|
5319
5343
|
readBoardEquipment,
|
|
5320
5344
|
readBoardLocations,
|
|
5345
|
+
referencedLocationIds,
|
|
5321
5346
|
relationsFrom,
|
|
5322
5347
|
relationsTo,
|
|
5323
5348
|
requiredTestsFor,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operato/ops-contract",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.40",
|
|
4
4
|
"description": "Operations domain contract — the standard vocabulary that producers and readers agree on (EPCIS 2.0/GS1, ISA-95, IEC 61850/ISO 50001). Types, guards, validation. No state, no engine.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist-cjs/index.cjs",
|