@operato/ops-contract 0.9.39 → 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.
@@ -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`.** 고정 설비(도장기·용접로봇)와 이동 설비(지게차·호슬러)를 한 그릇에
@@ -3874,6 +3877,11 @@ export interface TwinModelDef {
3874
3877
  properties?: ResourceProperty[];
3875
3878
  testSpecificationIds?: TestSpecificationRefs;
3876
3879
  })[];
3880
+ /**
3881
+ * **다른 렌즈의 자리** — 참조만 한다(§`ReferencedLocation`). 이 트윈의 자리가 아니므로 능력 · 용량 · 종류가 없고, 거기로 간
3882
+ * 물품은 이 트윈의 재고에서 빠진다. 없으면 참조하는 자리가 없다.
3883
+ */
3884
+ referencedLocations?: ReferencedLocation[];
3877
3885
  /**
3878
3886
  * 설비 — ISA-95 `Equipment`. mtbfMs/mttrMs 지정 시 확률적 고장 모델 참여(OEE Availability 손실).
3879
3887
  * 미지정=고장 없음. `window` 지정 시 그 시간대에만 일한다(교대·가동시간) — 미지정이면 24시간 가용.
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";
@@ -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
+ }
@@ -228,6 +228,7 @@ __export(index_exports, {
228
228
  outsideLimit: () => outsideLimit,
229
229
  parseEpc: () => parseEpc,
230
230
  parseIsoDuration: () => parseIsoDuration,
231
+ partitionLensLocations: () => partitionLensLocations,
231
232
  passThroughReversible: () => passThroughReversible,
232
233
  performanceKey: () => performanceKey,
233
234
  periodFactId: () => periodFactId,
@@ -241,6 +242,7 @@ __export(index_exports, {
241
242
  readBoardAssets: () => readBoardAssets,
242
243
  readBoardEquipment: () => readBoardEquipment,
243
244
  readBoardLocations: () => readBoardLocations,
245
+ referencedLocationIds: () => referencedLocationIds,
244
246
  relationsFrom: () => relationsFrom,
245
247
  relationsTo: () => relationsTo,
246
248
  requiredTestsFor: () => requiredTestsFor,
@@ -3513,6 +3515,21 @@ function finishedFlowOrdersWithin(hot, folded, nowMs, policy = ORDER_FOLD_DEFAUL
3513
3515
  return { fromMs, toMs: nowMs, count, byStatus };
3514
3516
  }
3515
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
+
3516
3533
  // src/face2-adapter.ts
3517
3534
  function isAggregationRecord(record) {
3518
3535
  if (!record || typeof record !== "object") return false;
@@ -5311,6 +5328,7 @@ function nonEmpty(value) {
5311
5328
  outsideLimit,
5312
5329
  parseEpc,
5313
5330
  parseIsoDuration,
5331
+ partitionLensLocations,
5314
5332
  passThroughReversible,
5315
5333
  performanceKey,
5316
5334
  periodFactId,
@@ -5324,6 +5342,7 @@ function nonEmpty(value) {
5324
5342
  readBoardAssets,
5325
5343
  readBoardEquipment,
5326
5344
  readBoardLocations,
5345
+ referencedLocationIds,
5327
5346
  relationsFrom,
5328
5347
  relationsTo,
5329
5348
  requiredTestsFor,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@operato/ops-contract",
3
- "version": "0.9.39",
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",