@operato/ops-contract 0.9.23 → 0.9.25

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.
@@ -75,6 +75,13 @@ export interface DomainProfileInfo {
75
75
  locationTypes: readonly string[];
76
76
  }
77
77
  export declare const DOMAIN_CATALOG: Record<DomainSystem, DomainProfileInfo>;
78
+ /**
79
+ * 저널이 개체의 이력을 나르는 축 — 컬럼으로 승격돼 있어 그 축으로만 물을 수 있다.
80
+ *
81
+ * 새 문자열을 열지 않는다(ADR-0074). 여기 없는 이름으로 물으면 저널은 거르지 못하고 목록이
82
+ * 조용히 비거나 남의 축이 섞인다.
83
+ */
84
+ export type TwinJournalAxis = 'epc' | 'orderId' | 'locationId' | 'moverId';
78
85
  export interface TwinAxisInfo {
79
86
  /**
80
87
  * 축의 이름 — 화면·관계 선언이 쓰는 키. 최상위 축은 `TwinModelDef` 의 키 **그대로**다
@@ -154,6 +161,34 @@ export interface TwinAxisInfo {
154
161
  kind: 'instance' | 'class' | 'spec';
155
162
  /** 이 축의 항목이 카탈로그 타입을 갖는가 — 있으면 `types` 와 이어진다(자리·설비만). */
156
163
  typeRole?: 'location' | 'equipment';
164
+ /**
165
+ * 이 축의 개체 이력을 **저널의 어느 축으로 묻나.**
166
+ *
167
+ * 선언하지 않으면 「저널이 이 축으로 기록하지 않는다」는 뜻이고, 화면은 그 사실을 말한다
168
+ * (「이력이 없다」가 아니다 — 묻지 않은 것과 없는 것은 다르다). 명세 축(공정 · 레시피 · 라우트)이
169
+ * 그 경우다: 저널은 공정 자체가 아니라 그 공정을 수행한 작업으로 기록된다.
170
+ *
171
+ * ── 왜 계약에 있나 (2026-09-18, ADR-0074) ─────────────────────────────────
172
+ * 이 대응이 앱의 화면 상수에 있었다. 축 이름이 한 세대 바뀌자 표가 따라오지 않았고, 로케이션 ·
173
+ * 오더 · 품목의 360 은 **저널을 묻지도 않은 채** 「이 개념은 이력 축이 없다」를 그렸다. 축이
174
+ * 사는 자리(`path`)와 무엇이 가리키나(`idField`)가 선언인 것과 같은 이유로, 이것도 선언이다.
175
+ *
176
+ * 품목 정의(`materialDefinitions`)가 `epc` 인 것은 개체의 EPC 안에 그 정의가 클래스로 들어 있기
177
+ * 때문이다 — 질의는 그 컬럼 하나에 부분일치로 건다(정확일치로는 클래스를 못 찾는다).
178
+ */
179
+ journalAxis?: TwinJournalAxis;
180
+ /**
181
+ * **무엇이 이 축의 개체를 말하나** — 식별자 말고 사람이 읽는 값들, 보이는 차례대로.
182
+ *
183
+ * 선언하지 않으면 소비처는 `idField` 만 보인다. 없는 이름을 지어내지 않는다.
184
+ *
185
+ * 소비처가 셋이다: 개체 상세의 요약 줄, 관계 그림의 정점 부제, 그리고 AI 가 개체를 한 줄로 말할 때.
186
+ * 셋이 각자 고르면 같은 개체가 화면마다 다른 말로 불린다.
187
+ *
188
+ * 칸 이름이 `summary` 가 아닌 이유(ADR-0074): 이름은 화면의 쓰임이 아니라 사실을 말한다 —
189
+ * `idField` · `source` 와 같은 결이다.
190
+ */
191
+ describedBy?: string[];
157
192
  /**
158
193
  * 이 축이 **어느 종류의 트윈에 있는가** — 선언하지 않으면 **전부**에 있다.
159
194
  *
@@ -192,6 +227,24 @@ export type TwinRelationTarget = {
192
227
  | {
193
228
  kind: 'external';
194
229
  entity: string;
230
+ }
231
+ /**
232
+ * A reference that points **either** at an item of an axis **or** at something outside the kernel —
233
+ * told apart by looking the id up in that axis.
234
+ *
235
+ * `locations[].parentId` is this. `LocationState.parentId` says so in its own words: the parent is
236
+ * another location (a line, a cell, a zone — this is where the hierarchy gets deeper) or, when no
237
+ * location has that id, an area of the space. The relation was first declared `axis` (it drew lines
238
+ * to locations that did not exist), then `external` (a bin whose parent is a zone came back
239
+ * "nobody can resolve this", and a zone never listed its bins). Neither alone is true.
240
+ *
241
+ * A consumer that only knows `axis` and `external` skips this kind — it shows less, never a line
242
+ * that is not there. `splitRelationIds` does the lookup so that each consumer does not write its own.
243
+ */
244
+ | {
245
+ kind: 'axis-or-external';
246
+ axis: string;
247
+ entity: string;
195
248
  };
196
249
  /**
197
250
  * **그 관계가 가리키는 것이 언제의 일인가** — 화면의 판단이 여기서 갈린다.
@@ -344,6 +397,24 @@ export declare function documentPath(axis: string): string;
344
397
  /** 이 축에서 나가는 관계 · 이 축으로 들어오는 관계 — 항목 패널의 "이어진 것" 양방향. */
345
398
  export declare const relationsFrom: (axis: string) => TwinRelationInfo[];
346
399
  export declare const relationsTo: (axis: string) => TwinRelationInfo[];
400
+ /**
401
+ * Sorts the ids a relation holds into what they point at.
402
+ *
403
+ * `inAxis(axis, id)` answers "is there an item with this id in that axis" — the caller owns the data,
404
+ * the contract owns the rule. For `axis-or-external` an id found in the axis is an axis item and
405
+ * every other id belongs to the external entity. A `type` target has neither: its values are type
406
+ * keys, not item ids.
407
+ */
408
+ export declare function splitRelationIds(target: TwinRelationTarget, ids: readonly string[], inAxis: (axis: string, id: string) => boolean): {
409
+ axis?: {
410
+ axis: string;
411
+ ids: string[];
412
+ };
413
+ external?: {
414
+ entity: string;
415
+ ids: string[];
416
+ };
417
+ };
347
418
  /** 축 이름 → 서술. 모르는 축이면 `undefined` — 화면은 그것을 "미선언" 으로 낸다(숨기지 않는다). */
348
419
  export declare function axisInfo(axis: string): TwinAxisInfo | undefined;
349
420
  export declare const DOMAIN_SYSTEMS: DomainSystem[];
@@ -32,25 +32,25 @@ export const DOMAIN_CATALOG = {
32
32
  const LOGISTICS = ['wms', 'yms', 'mes'];
33
33
  /** board 축 전체 — 인스펙션의 **개념 목록**이 여기서 나온다(화면은 이 목록을 갖지 않는다). */
34
34
  export const TWIN_AXES = [
35
- { axis: 'locations', path: 'locations', label: 'twin.axis.locations', kind: 'instance', typeRole: 'location',
35
+ { axis: 'locations', path: 'locations', journalAxis: 'locationId', describedBy: ['name', 'type'], label: 'twin.axis.locations', kind: 'instance', typeRole: 'location',
36
36
  standardClass: { epcis: 'SGLN' } },
37
- { axis: 'equipment', path: 'equipment', label: 'twin.axis.equipment', kind: 'instance', typeRole: 'equipment',
37
+ { axis: 'equipment', path: 'equipment', journalAxis: 'moverId', describedBy: ['name', 'kind'], label: 'twin.axis.equipment', kind: 'instance', typeRole: 'equipment',
38
38
  standardClass: { isa95: 'Equipment', iso55000: 'Asset', epcis: 'GIAI' } },
39
39
  { axis: 'persons', path: 'persons', label: 'twin.axis.persons', kind: 'instance',
40
40
  standardClass: { isa95: 'Person' }, systems: LOGISTICS },
41
41
  { axis: 'assets', path: 'assets', label: 'twin.axis.assets', kind: 'instance',
42
42
  standardClass: { isa95: 'PhysicalAsset', iso55000: 'Asset' } },
43
- { axis: 'personnelClasses', path: 'personnelClasses', label: 'twin.axis.personnelClasses', kind: 'class',
43
+ { axis: 'personnelClasses', path: 'personnelClasses', describedBy: ['description'], label: 'twin.axis.personnelClasses', kind: 'class',
44
44
  standardClass: { isa95: 'PersonnelClass' }, systems: LOGISTICS },
45
- { axis: 'equipmentClasses', path: 'equipmentClasses', label: 'twin.axis.equipmentClasses', kind: 'class',
45
+ { axis: 'equipmentClasses', path: 'equipmentClasses', describedBy: ['description'], label: 'twin.axis.equipmentClasses', kind: 'class',
46
46
  standardClass: { isa95: 'EquipmentClass' } },
47
- { axis: 'assetClasses', path: 'assetClasses', label: 'twin.axis.assetClasses', kind: 'class',
47
+ { axis: 'assetClasses', path: 'assetClasses', describedBy: ['description'], label: 'twin.axis.assetClasses', kind: 'class',
48
48
  standardClass: { isa95: 'PhysicalAssetClass' } },
49
- { axis: 'materialDefinitions', path: 'materialDefinitions', label: 'twin.axis.materialDefinitions', kind: 'class',
49
+ { axis: 'materialDefinitions', path: 'materialDefinitions', journalAxis: 'epc', describedBy: ['description', 'uom'], label: 'twin.axis.materialDefinitions', kind: 'class',
50
50
  standardClass: { isa95: 'MaterialDefinition' }, systems: LOGISTICS },
51
- { axis: 'materialClasses', path: 'materialClasses', label: 'twin.axis.materialClasses', kind: 'class',
51
+ { axis: 'materialClasses', path: 'materialClasses', describedBy: ['description'], label: 'twin.axis.materialClasses', kind: 'class',
52
52
  standardClass: { isa95: 'MaterialClass' }, systems: LOGISTICS },
53
- { axis: 'operations', path: 'operations', label: 'twin.axis.operations', kind: 'spec',
53
+ { axis: 'operations', path: 'operations', describedBy: ['label'], label: 'twin.axis.operations', kind: 'spec',
54
54
  standardClass: { isa95: 'OperationsSegment' }, systems: LOGISTICS },
55
55
  { axis: 'productionSpec', path: 'productionSpec', label: 'twin.axis.productionSpec', kind: 'spec',
56
56
  standardClass: { isa95: 'OperationsSegment' }, systems: LOGISTICS },
@@ -60,11 +60,11 @@ export const TWIN_AXES = [
60
60
  * 전자는 도메인 정의의 가벼운 목록(`{key,label}`), 후자는 ISA-95 풍부형이다. 같은 것의 집이
61
61
  * 둘이라는 사실을 **선언이 드러낸다**(감추면 화면이 어느 쪽을 보는지 아무도 모른다).
62
62
  */
63
- { axis: 'recipes', path: 'productionSpec.definition.recipes', label: 'twin.axis.recipes', kind: 'spec',
63
+ { axis: 'recipes', path: 'productionSpec.definition.recipes', describedBy: ['label'], label: 'twin.axis.recipes', kind: 'spec',
64
64
  standardClass: { isa95: 'OperationsSegment' }, systems: LOGISTICS },
65
- { axis: 'routes', path: 'productionSpec.definition.routes', label: 'twin.axis.routes', kind: 'spec',
65
+ { axis: 'routes', path: 'productionSpec.definition.routes', describedBy: ['label'], label: 'twin.axis.routes', kind: 'spec',
66
66
  standardClass: { isa95: 'OperationsSegment' }, systems: LOGISTICS },
67
- { axis: 'materials', path: 'productionSpec.definition.materials', label: 'twin.axis.materials', kind: 'class',
67
+ { axis: 'materials', path: 'productionSpec.definition.materials', describedBy: ['label'], label: 'twin.axis.materials', kind: 'class',
68
68
  standardClass: { isa95: 'MaterialDefinition' }, systems: LOGISTICS },
69
69
  /*
70
70
  * 시험 명세 — **자원 아홉 종류가 가리키는 대상.**
@@ -74,7 +74,7 @@ export const TWIN_AXES = [
74
74
  *
75
75
  * `kind: 'spec'` 이다: 자원도 등급도 아니고 **판정의 정의**다(공정·레시피와 같은 부류).
76
76
  */
77
- { axis: 'testSpecifications', path: 'testSpecifications', label: 'twin.axis.testSpecifications', kind: 'spec',
77
+ { axis: 'testSpecifications', path: 'testSpecifications', describedBy: ['description', 'version'], label: 'twin.axis.testSpecifications', kind: 'spec',
78
78
  standardClass: { isa95: 'TestSpecification' } },
79
79
  /*
80
80
  * ── ISA-95 Part 4 — 일정과 실적 ────────────────────────────────────────────────
@@ -93,10 +93,15 @@ export const TWIN_AXES = [
93
93
  * 것이지만 트윈이 **관측한** 것이다. 투영은 규모에서 성능이 필요해질 때 KPI 폴드와 같은 급의
94
94
  * 별도 결정으로 한다.
95
95
  */
96
- { axis: 'orders', label: 'twin.axis.orders', kind: 'instance', source: 'state', historical: true,
96
+ { axis: 'orders', journalAxis: 'orderId', describedBy: ['kind', 'status'], label: 'twin.axis.orders', kind: 'instance', source: 'state', historical: true,
97
97
  standardClass: { isa95: 'OperationsRequest', epcis: 'TransactionEvent' }, systems: LOGISTICS },
98
- { axis: 'tasks', label: 'twin.axis.tasks', kind: 'instance', source: 'state', historical: true,
99
- standardClass: { isa95: 'SegmentResponse', epcis: 'TransformationEvent' }, systems: LOGISTICS },
98
+ { axis: 'tasks', describedBy: ['kind', 'status'], label: 'twin.axis.tasks', kind: 'instance', source: 'state', historical: true,
99
+ /*
100
+ * No single EPCIS projection. A task's event kind follows its operation: a putaway or a pick is
101
+ * an ObjectEvent, only a transformation (production, kitting) is a TransformationEvent. This used
102
+ * to say `epcis: 'TransformationEvent'` for an axis that spans every logistics system.
103
+ */
104
+ standardClass: { isa95: 'SegmentResponse' }, systems: LOGISTICS },
100
105
  /*
101
106
  * ── 물품이 축이 아니었다 (2026-08-22) ──────────────────────────────────────
102
107
  * 트윈에서 **수가 가장 많은 것**이 물품인데(실측: 엔티티 3,611 중 2,400 · hatio-us 는 2,805) 그것을
@@ -115,7 +120,7 @@ export const TWIN_AXES = [
115
120
  * `subLotId ?? epc` 다. 짐작에 맡기면 `gtin` 으로 떨어지고, 그러면 **같은 품목의 물품 전부가 한
116
121
  * 식별자로 뭉친다** — 화면이 2,400개를 몇 개로 보인다.
117
122
  */
118
- { axis: 'items', label: 'twin.axis.items', kind: 'instance', source: 'state', historical: true,
123
+ { axis: 'items', journalAxis: 'epc', describedBy: ['definitionId', 'lot'], label: 'twin.axis.items', kind: 'instance', source: 'state', historical: true,
119
124
  idField: ['subLotId', 'epc'],
120
125
  standardClass: { isa95: 'MaterialLot', epcis: 'ObjectEvent' }, systems: LOGISTICS },
121
126
  /*
@@ -175,8 +180,11 @@ export function tenseOf(r) {
175
180
  }
176
181
  /** 관계 전체 — 지도의 선과 항목의 이웃이 여기서 나온다(화면은 이 목록을 갖지 않는다). */
177
182
  export const TWIN_RELATIONS = [
178
- /* 자리가 속한 구역 — **board 밖**(호스트의 `TwinArea`). 해소는 호스트가 한다. */
179
- { from: 'locations', field: 'parentId', target: { kind: 'external', entity: 'space.area' }, via: 'ops.rel.area', optional: true, tense: 'standing' },
183
+ /*
184
+ * What a location sits in — another location (line ⊃ station, zone ⊃ aisle ⊃ bin) or, when no
185
+ * location has that id, an area of the space (host's `TwinArea`). See `axis-or-external`.
186
+ */
187
+ { from: 'locations', field: 'parentId', target: { kind: 'axis-or-external', axis: 'locations', entity: 'space.area' }, via: 'ops.rel.area', optional: true, tense: 'standing' },
180
188
  /* 자원이 사는 자리 */
181
189
  { from: 'equipment', field: 'homeLocation', target: { kind: 'axis', axis: 'locations' }, via: 'ops.rel.home', optional: true, tense: 'standing' },
182
190
  { from: 'persons', field: 'homeLocation', target: { kind: 'axis', axis: 'locations' }, via: 'ops.rel.home', optional: true, tense: 'standing' },
@@ -310,7 +318,27 @@ export function documentPath(axis) {
310
318
  }
311
319
  /** 이 축에서 나가는 관계 · 이 축으로 들어오는 관계 — 항목 패널의 "이어진 것" 양방향. */
312
320
  export const relationsFrom = (axis) => TWIN_RELATIONS.filter(r => r.from === axis);
313
- export const relationsTo = (axis) => TWIN_RELATIONS.filter(r => r.target.kind === 'axis' && r.target.axis === axis);
321
+ export const relationsTo = (axis) => TWIN_RELATIONS.filter(r => (r.target.kind === 'axis' || r.target.kind === 'axis-or-external') && r.target.axis === axis);
322
+ /**
323
+ * Sorts the ids a relation holds into what they point at.
324
+ *
325
+ * `inAxis(axis, id)` answers "is there an item with this id in that axis" — the caller owns the data,
326
+ * the contract owns the rule. For `axis-or-external` an id found in the axis is an axis item and
327
+ * every other id belongs to the external entity. A `type` target has neither: its values are type
328
+ * keys, not item ids.
329
+ */
330
+ export function splitRelationIds(target, ids, inAxis) {
331
+ if (target.kind === 'axis')
332
+ return { axis: { axis: target.axis, ids: [...ids] } };
333
+ if (target.kind === 'external')
334
+ return { external: { entity: target.entity, ids: [...ids] } };
335
+ if (target.kind === 'axis-or-external') {
336
+ const inside = ids.filter(id => inAxis(target.axis, id));
337
+ const outside = ids.filter(id => !inAxis(target.axis, id));
338
+ return { axis: { axis: target.axis, ids: inside }, external: { entity: target.entity, ids: outside } };
339
+ }
340
+ return {};
341
+ }
314
342
  /** 축 이름 → 서술. 모르는 축이면 `undefined` — 화면은 그것을 "미선언" 으로 낸다(숨기지 않는다). */
315
343
  export function axisInfo(axis) {
316
344
  return TWIN_AXES.find(a => a.axis === axis);
package/dist/epcis.d.ts CHANGED
@@ -153,7 +153,15 @@ export interface QuantityElement {
153
153
  uom?: string;
154
154
  }
155
155
  export interface BizTransactionElement {
156
- type: string;
156
+ /**
157
+ * The kind of document — a CBV business transaction type, or a private URI for a kind CBV does not have.
158
+ *
159
+ * **Optional, as in EPCIS 2.0**: only `bizTransaction` is required. When CBV has no value for the
160
+ * document, leave this out — do not coin one under `urn:epcglobal:cbv:btt:`. That namespace is a
161
+ * closed list (13 values, ref.gs1.org/cbv); this contract once carried `btt:so` and `btt:deliv`,
162
+ * neither of which exists there. `test/cbv-btt-values-exist.test.ts` holds the list.
163
+ */
164
+ type?: string;
157
165
  bizTransaction: string;
158
166
  }
159
167
  export interface LocationRef {
@@ -9,9 +9,30 @@ export declare const BIZSTEP: {
9
9
  readonly replenishing: "urn:epcglobal:cbv:bizstep:replenishing";
10
10
  };
11
11
  export declare const BTT: {
12
+ /** Purchase Order — the document an inbound receipt is made against. */
12
13
  readonly po: "urn:epcglobal:cbv:btt:po";
13
- readonly so: "urn:epcglobal:cbv:btt:so";
14
+ /** Purchase Order Confirmation — the seller's sales order. */
15
+ readonly poc: "urn:epcglobal:cbv:btt:poc";
16
+ /** Despatch Advice (ASN) — announces an inbound delivery; also attached when shipping. */
17
+ readonly desadv: "urn:epcglobal:cbv:btt:desadv";
18
+ /** Receiving Advice — the reply once an inbound receipt is complete. */
19
+ readonly recadv: "urn:epcglobal:cbv:btt:recadv";
20
+ /** Return Merchandise Authorization — what a return is received against. */
21
+ readonly rma: "urn:epcglobal:cbv:btt:rma";
22
+ /** Bill of Lading — the carrier's document, attached when shipping. */
23
+ readonly bol: "urn:epcglobal:cbv:btt:bol";
14
24
  };
25
+ export declare const WMS_ORDER_KIND: {
26
+ /** Expected receipt (ASN). The kernel has no inbound order yet — arrival carries a `po` without one. */
27
+ readonly inbound: "inbound";
28
+ /** Outbound order — what the kernel's sales order is. */
29
+ readonly outbound: "outbound";
30
+ /** Receipt of returned goods. */
31
+ readonly return: "return";
32
+ /** Stock transfer between sites. CBV has no document type for it: carry the id without a type. */
33
+ readonly transfer: "transfer";
34
+ };
35
+ export type WmsOrderKind = (typeof WMS_ORDER_KIND)[keyof typeof WMS_ORDER_KIND];
15
36
  /**
16
37
  * WMS 자리 타입 카탈로그 — 커널이 실제로 키로 쓰는 로케이션 타입(locationByType/slotViews).
17
38
  * 도메인 어휘 SSOT: 호스트·UI 는 이걸 소싱하고 재선언하지 않는다(방언 금지).
@@ -8,10 +8,49 @@ export const BIZSTEP = {
8
8
  shipping: 'urn:epcglobal:cbv:bizstep:shipping',
9
9
  replenishing: 'urn:epcglobal:cbv:bizstep:replenishing'
10
10
  };
11
- // bizTransaction 유형 — CBV btt (§2 "거래" 매핑: PO=입고 ASN, SO=출고 오더)
11
+ /*
12
+ * Business transaction types — CBV btt. Every value here exists at ref.gs1.org/cbv (checked
13
+ * 2026-09-17; `test/cbv-btt-values-exist.test.ts` holds the closed list).
14
+ *
15
+ * `poc` is what the kernel's outbound order carries. The kernel's document is a *sales order*
16
+ * (docKind 'salesorder'), and CBV's own definition of Purchase Order Confirmation reads
17
+ * "Sometimes internally referred to as a 'Sales Order'." There is no `btt:so` — this file used to
18
+ * say there was (ADR-0059 decision 4).
19
+ *
20
+ * A document CBV has no value for (a transfer between sites) carries **no type** — see
21
+ * BizTransactionElement.type.
22
+ */
12
23
  export const BTT = {
24
+ /** Purchase Order — the document an inbound receipt is made against. */
13
25
  po: 'urn:epcglobal:cbv:btt:po',
14
- so: 'urn:epcglobal:cbv:btt:so'
26
+ /** Purchase Order Confirmation — the seller's sales order. */
27
+ poc: 'urn:epcglobal:cbv:btt:poc',
28
+ /** Despatch Advice (ASN) — announces an inbound delivery; also attached when shipping. */
29
+ desadv: 'urn:epcglobal:cbv:btt:desadv',
30
+ /** Receiving Advice — the reply once an inbound receipt is complete. */
31
+ recadv: 'urn:epcglobal:cbv:btt:recadv',
32
+ /** Return Merchandise Authorization — what a return is received against. */
33
+ rma: 'urn:epcglobal:cbv:btt:rma',
34
+ /** Bill of Lading — the carrier's document, attached when shipping. */
35
+ bol: 'urn:epcglobal:cbv:btt:bol'
36
+ };
37
+ /*
38
+ * What an order in a warehouse is for — `OrderState.kind`.
39
+ *
40
+ * The contract leaves `kind` an open string because it is the domain's word. It was written as a
41
+ * literal in the kernel ('outbound') until a second producer appeared (operato-warehouse); two
42
+ * producers with one literal each is how two spellings start (ADR-0059 decision 3).
43
+ * Moves *inside* a warehouse are not orders — they are tasks.
44
+ */
45
+ export const WMS_ORDER_KIND = {
46
+ /** Expected receipt (ASN). The kernel has no inbound order yet — arrival carries a `po` without one. */
47
+ inbound: 'inbound',
48
+ /** Outbound order — what the kernel's sales order is. */
49
+ outbound: 'outbound',
50
+ /** Receipt of returned goods. */
51
+ return: 'return',
52
+ /** Stock transfer between sites. CBV has no document type for it: carry the id without a type. */
53
+ transfer: 'transfer'
15
54
  };
16
55
  /**
17
56
  * WMS 자리 타입 카탈로그 — 커널이 실제로 키로 쓰는 로케이션 타입(locationByType/slotViews).
@@ -6,8 +6,6 @@ export declare const YARD_BIZSTEP: {
6
6
  readonly unloading: "urn:epcglobal:cbv:bizstep:unloading";
7
7
  readonly departing: "urn:epcglobal:cbv:bizstep:departing";
8
8
  };
9
- /** 어포인트먼트/배송 거래 유형(CBV btt). */
10
- export declare const BTT_DELIVERY = "urn:epcglobal:cbv:btt:deliv";
11
9
  /** 트레일러/컨테이너 = GRAI(Global Returnable Asset Identifier, 반납형 자산). */
12
10
  export declare function graiUri(companyPrefix: string, assetType: string, serial: number): string;
13
11
  /** YMS 자리 타입 카탈로그 — 커널이 키로 쓰는 야드 로케이션 타입(locationByType/slotViews/.type). 도메인 SSOT. */
@@ -6,8 +6,11 @@ export const YARD_BIZSTEP = {
6
6
  unloading: 'urn:epcglobal:cbv:bizstep:unloading', // 도크 작업(하차: 트레일러→화물)
7
7
  departing: 'urn:epcglobal:cbv:bizstep:departing' // 게이트-아웃
8
8
  };
9
- /** 어포인트먼트/배송 거래 유형(CBV btt). */
10
- export const BTT_DELIVERY = 'urn:epcglobal:cbv:btt:deliv';
9
+ /*
10
+ * A dock appointment has **no CBV business transaction type** — `btt:deliv`, which this file used to
11
+ * export, does not exist at ref.gs1.org/cbv. The kernel now links the appointment by its id alone
12
+ * (EPCIS 2.0 makes `type` optional). ADR-0059 decision 4.
13
+ */
11
14
  /** 트레일러/컨테이너 = GRAI(Global Returnable Asset Identifier, 반납형 자산). */
12
15
  export function graiUri(companyPrefix, assetType, serial) {
13
16
  return `urn:epc:id:grai:${companyPrefix}.${assetType}.${String(serial).padStart(6, '0')}`;
@@ -21,7 +21,6 @@ var index_exports = {};
21
21
  __export(index_exports, {
22
22
  BIZSTEP: () => BIZSTEP,
23
23
  BTT: () => BTT,
24
- BTT_DELIVERY: () => BTT_DELIVERY,
25
24
  BTT_PRODORDER: () => BTT_PRODORDER,
26
25
  CAPABILITIES: () => CAPABILITIES,
27
26
  CAPABILITY_KEYS: () => CAPABILITY_KEYS,
@@ -84,6 +83,7 @@ __export(index_exports, {
84
83
  WEBHOOK_STATUS: () => WEBHOOK_STATUS,
85
84
  WEBHOOK_TOO_MANY: () => WEBHOOK_TOO_MANY,
86
85
  WMS_LOCATION_TYPES: () => WMS_LOCATION_TYPES,
86
+ WMS_ORDER_KIND: () => WMS_ORDER_KIND,
87
87
  WMS_TYPES: () => WMS_TYPES,
88
88
  YARD_BIZSTEP: () => YARD_BIZSTEP,
89
89
  YMS_LOCATION_TYPES: () => YMS_LOCATION_TYPES,
@@ -221,6 +221,7 @@ __export(index_exports, {
221
221
  rolledThroughputYield: () => rolledThroughputYield,
222
222
  sgtinClass: () => sgtinClass,
223
223
  sgtinUri: () => sgtinUri,
224
+ splitRelationIds: () => splitRelationIds,
224
225
  ssccUri: () => ssccUri,
225
226
  stateFieldsOf: () => stateFieldsOf,
226
227
  subLotIdOf: () => subLotIdOf,
@@ -1265,8 +1266,28 @@ var BIZSTEP = {
1265
1266
  replenishing: "urn:epcglobal:cbv:bizstep:replenishing"
1266
1267
  };
1267
1268
  var BTT = {
1269
+ /** Purchase Order — the document an inbound receipt is made against. */
1268
1270
  po: "urn:epcglobal:cbv:btt:po",
1269
- so: "urn:epcglobal:cbv:btt:so"
1271
+ /** Purchase Order Confirmation — the seller's sales order. */
1272
+ poc: "urn:epcglobal:cbv:btt:poc",
1273
+ /** Despatch Advice (ASN) — announces an inbound delivery; also attached when shipping. */
1274
+ desadv: "urn:epcglobal:cbv:btt:desadv",
1275
+ /** Receiving Advice — the reply once an inbound receipt is complete. */
1276
+ recadv: "urn:epcglobal:cbv:btt:recadv",
1277
+ /** Return Merchandise Authorization — what a return is received against. */
1278
+ rma: "urn:epcglobal:cbv:btt:rma",
1279
+ /** Bill of Lading — the carrier's document, attached when shipping. */
1280
+ bol: "urn:epcglobal:cbv:btt:bol"
1281
+ };
1282
+ var WMS_ORDER_KIND = {
1283
+ /** Expected receipt (ASN). The kernel has no inbound order yet — arrival carries a `po` without one. */
1284
+ inbound: "inbound",
1285
+ /** Outbound order — what the kernel's sales order is. */
1286
+ outbound: "outbound",
1287
+ /** Receipt of returned goods. */
1288
+ return: "return",
1289
+ /** Stock transfer between sites. CBV has no document type for it: carry the id without a type. */
1290
+ transfer: "transfer"
1270
1291
  };
1271
1292
  var WMS_LOCATION_TYPES = ["dock", "storage", "staging", "dock-ship", "vas-station"];
1272
1293
  var WMS_LOCATION_LEVEL = {
@@ -1297,7 +1318,6 @@ var YARD_BIZSTEP = {
1297
1318
  departing: "urn:epcglobal:cbv:bizstep:departing"
1298
1319
  // 게이트-아웃
1299
1320
  };
1300
- var BTT_DELIVERY = "urn:epcglobal:cbv:btt:deliv";
1301
1321
  function graiUri(companyPrefix, assetType, serial) {
1302
1322
  return `urn:epc:id:grai:${companyPrefix}.${assetType}.${String(serial).padStart(6, "0")}`;
1303
1323
  }
@@ -1697,6 +1717,8 @@ var TWIN_AXES = [
1697
1717
  {
1698
1718
  axis: "locations",
1699
1719
  path: "locations",
1720
+ journalAxis: "locationId",
1721
+ describedBy: ["name", "type"],
1700
1722
  label: "twin.axis.locations",
1701
1723
  kind: "instance",
1702
1724
  typeRole: "location",
@@ -1705,6 +1727,8 @@ var TWIN_AXES = [
1705
1727
  {
1706
1728
  axis: "equipment",
1707
1729
  path: "equipment",
1730
+ journalAxis: "moverId",
1731
+ describedBy: ["name", "kind"],
1708
1732
  label: "twin.axis.equipment",
1709
1733
  kind: "instance",
1710
1734
  typeRole: "equipment",
@@ -1728,6 +1752,7 @@ var TWIN_AXES = [
1728
1752
  {
1729
1753
  axis: "personnelClasses",
1730
1754
  path: "personnelClasses",
1755
+ describedBy: ["description"],
1731
1756
  label: "twin.axis.personnelClasses",
1732
1757
  kind: "class",
1733
1758
  standardClass: { isa95: "PersonnelClass" },
@@ -1736,6 +1761,7 @@ var TWIN_AXES = [
1736
1761
  {
1737
1762
  axis: "equipmentClasses",
1738
1763
  path: "equipmentClasses",
1764
+ describedBy: ["description"],
1739
1765
  label: "twin.axis.equipmentClasses",
1740
1766
  kind: "class",
1741
1767
  standardClass: { isa95: "EquipmentClass" }
@@ -1743,6 +1769,7 @@ var TWIN_AXES = [
1743
1769
  {
1744
1770
  axis: "assetClasses",
1745
1771
  path: "assetClasses",
1772
+ describedBy: ["description"],
1746
1773
  label: "twin.axis.assetClasses",
1747
1774
  kind: "class",
1748
1775
  standardClass: { isa95: "PhysicalAssetClass" }
@@ -1750,6 +1777,8 @@ var TWIN_AXES = [
1750
1777
  {
1751
1778
  axis: "materialDefinitions",
1752
1779
  path: "materialDefinitions",
1780
+ journalAxis: "epc",
1781
+ describedBy: ["description", "uom"],
1753
1782
  label: "twin.axis.materialDefinitions",
1754
1783
  kind: "class",
1755
1784
  standardClass: { isa95: "MaterialDefinition" },
@@ -1758,6 +1787,7 @@ var TWIN_AXES = [
1758
1787
  {
1759
1788
  axis: "materialClasses",
1760
1789
  path: "materialClasses",
1790
+ describedBy: ["description"],
1761
1791
  label: "twin.axis.materialClasses",
1762
1792
  kind: "class",
1763
1793
  standardClass: { isa95: "MaterialClass" },
@@ -1766,6 +1796,7 @@ var TWIN_AXES = [
1766
1796
  {
1767
1797
  axis: "operations",
1768
1798
  path: "operations",
1799
+ describedBy: ["label"],
1769
1800
  label: "twin.axis.operations",
1770
1801
  kind: "spec",
1771
1802
  standardClass: { isa95: "OperationsSegment" },
@@ -1788,6 +1819,7 @@ var TWIN_AXES = [
1788
1819
  {
1789
1820
  axis: "recipes",
1790
1821
  path: "productionSpec.definition.recipes",
1822
+ describedBy: ["label"],
1791
1823
  label: "twin.axis.recipes",
1792
1824
  kind: "spec",
1793
1825
  standardClass: { isa95: "OperationsSegment" },
@@ -1796,6 +1828,7 @@ var TWIN_AXES = [
1796
1828
  {
1797
1829
  axis: "routes",
1798
1830
  path: "productionSpec.definition.routes",
1831
+ describedBy: ["label"],
1799
1832
  label: "twin.axis.routes",
1800
1833
  kind: "spec",
1801
1834
  standardClass: { isa95: "OperationsSegment" },
@@ -1804,6 +1837,7 @@ var TWIN_AXES = [
1804
1837
  {
1805
1838
  axis: "materials",
1806
1839
  path: "productionSpec.definition.materials",
1840
+ describedBy: ["label"],
1807
1841
  label: "twin.axis.materials",
1808
1842
  kind: "class",
1809
1843
  standardClass: { isa95: "MaterialDefinition" },
@@ -1820,6 +1854,7 @@ var TWIN_AXES = [
1820
1854
  {
1821
1855
  axis: "testSpecifications",
1822
1856
  path: "testSpecifications",
1857
+ describedBy: ["description", "version"],
1823
1858
  label: "twin.axis.testSpecifications",
1824
1859
  kind: "spec",
1825
1860
  standardClass: { isa95: "TestSpecification" }
@@ -1843,6 +1878,8 @@ var TWIN_AXES = [
1843
1878
  */
1844
1879
  {
1845
1880
  axis: "orders",
1881
+ journalAxis: "orderId",
1882
+ describedBy: ["kind", "status"],
1846
1883
  label: "twin.axis.orders",
1847
1884
  kind: "instance",
1848
1885
  source: "state",
@@ -1852,11 +1889,17 @@ var TWIN_AXES = [
1852
1889
  },
1853
1890
  {
1854
1891
  axis: "tasks",
1892
+ describedBy: ["kind", "status"],
1855
1893
  label: "twin.axis.tasks",
1856
1894
  kind: "instance",
1857
1895
  source: "state",
1858
1896
  historical: true,
1859
- standardClass: { isa95: "SegmentResponse", epcis: "TransformationEvent" },
1897
+ /*
1898
+ * No single EPCIS projection. A task's event kind follows its operation: a putaway or a pick is
1899
+ * an ObjectEvent, only a transformation (production, kitting) is a TransformationEvent. This used
1900
+ * to say `epcis: 'TransformationEvent'` for an axis that spans every logistics system.
1901
+ */
1902
+ standardClass: { isa95: "SegmentResponse" },
1860
1903
  systems: LOGISTICS
1861
1904
  },
1862
1905
  /*
@@ -1879,6 +1922,8 @@ var TWIN_AXES = [
1879
1922
  */
1880
1923
  {
1881
1924
  axis: "items",
1925
+ journalAxis: "epc",
1926
+ describedBy: ["definitionId", "lot"],
1882
1927
  label: "twin.axis.items",
1883
1928
  kind: "instance",
1884
1929
  source: "state",
@@ -1934,8 +1979,11 @@ function tenseOf(r) {
1934
1979
  return r?.tense;
1935
1980
  }
1936
1981
  var TWIN_RELATIONS = [
1937
- /* 자리가 속한 구역 — **board 밖**(호스트의 `TwinArea`). 해소는 호스트가 한다. */
1938
- { from: "locations", field: "parentId", target: { kind: "external", entity: "space.area" }, via: "ops.rel.area", optional: true, tense: "standing" },
1982
+ /*
1983
+ * What a location sits in — another location (line ⊃ station, zone ⊃ aisle ⊃ bin) or, when no
1984
+ * location has that id, an area of the space (host's `TwinArea`). See `axis-or-external`.
1985
+ */
1986
+ { from: "locations", field: "parentId", target: { kind: "axis-or-external", axis: "locations", entity: "space.area" }, via: "ops.rel.area", optional: true, tense: "standing" },
1939
1987
  /* 자원이 사는 자리 */
1940
1988
  { from: "equipment", field: "homeLocation", target: { kind: "axis", axis: "locations" }, via: "ops.rel.home", optional: true, tense: "standing" },
1941
1989
  { from: "persons", field: "homeLocation", target: { kind: "axis", axis: "locations" }, via: "ops.rel.home", optional: true, tense: "standing" },
@@ -2081,7 +2129,17 @@ function documentPath(axis) {
2081
2129
  return info.path;
2082
2130
  }
2083
2131
  var relationsFrom = (axis) => TWIN_RELATIONS.filter((r) => r.from === axis);
2084
- var relationsTo = (axis) => TWIN_RELATIONS.filter((r) => r.target.kind === "axis" && r.target.axis === axis);
2132
+ var relationsTo = (axis) => TWIN_RELATIONS.filter((r) => (r.target.kind === "axis" || r.target.kind === "axis-or-external") && r.target.axis === axis);
2133
+ function splitRelationIds(target, ids, inAxis) {
2134
+ if (target.kind === "axis") return { axis: { axis: target.axis, ids: [...ids] } };
2135
+ if (target.kind === "external") return { external: { entity: target.entity, ids: [...ids] } };
2136
+ if (target.kind === "axis-or-external") {
2137
+ const inside = ids.filter((id) => inAxis(target.axis, id));
2138
+ const outside = ids.filter((id) => !inAxis(target.axis, id));
2139
+ return { axis: { axis: target.axis, ids: inside }, external: { entity: target.entity, ids: outside } };
2140
+ }
2141
+ return {};
2142
+ }
2085
2143
  function axisInfo(axis) {
2086
2144
  return TWIN_AXES.find((a) => a.axis === axis);
2087
2145
  }
@@ -4592,7 +4650,6 @@ function nonEmpty(value) {
4592
4650
  0 && (module.exports = {
4593
4651
  BIZSTEP,
4594
4652
  BTT,
4595
- BTT_DELIVERY,
4596
4653
  BTT_PRODORDER,
4597
4654
  CAPABILITIES,
4598
4655
  CAPABILITY_KEYS,
@@ -4655,6 +4712,7 @@ function nonEmpty(value) {
4655
4712
  WEBHOOK_STATUS,
4656
4713
  WEBHOOK_TOO_MANY,
4657
4714
  WMS_LOCATION_TYPES,
4715
+ WMS_ORDER_KIND,
4658
4716
  WMS_TYPES,
4659
4717
  YARD_BIZSTEP,
4660
4718
  YMS_LOCATION_TYPES,
@@ -4792,6 +4850,7 @@ function nonEmpty(value) {
4792
4850
  rolledThroughputYield,
4793
4851
  sgtinClass,
4794
4852
  sgtinUri,
4853
+ splitRelationIds,
4795
4854
  ssccUri,
4796
4855
  stateFieldsOf,
4797
4856
  subLotIdOf,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@operato/ops-contract",
3
- "version": "0.9.23",
3
+ "version": "0.9.25",
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",