@tracepass/dpp-epcis 0.1.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.
- package/LICENSE +202 -0
- package/README.md +65 -0
- package/dist/cbv.d.ts +131 -0
- package/dist/cbv.d.ts.map +1 -0
- package/dist/cbv.js +201 -0
- package/dist/cbv.js.map +1 -0
- package/dist/context.d.ts +55 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +58 -0
- package/dist/context.js.map +1 -0
- package/dist/event-builders.d.ts +126 -0
- package/dist/event-builders.d.ts.map +1 -0
- package/dist/event-builders.js +230 -0
- package/dist/event-builders.js.map +1 -0
- package/dist/identifiers.d.ts +61 -0
- package/dist/identifiers.d.ts.map +1 -0
- package/dist/identifiers.js +86 -0
- package/dist/identifiers.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/validate.d.ts +38 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +216 -0
- package/dist/validate.js.map +1 -0
- package/package.json +22 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="https://www.tracepass.eu"><img src="https://www.tracepass.eu/tracepass-logo.svg" alt="TracePass" height="72"></a>
|
|
3
|
+
|
|
4
|
+
# @tracepass/dpp-epcis
|
|
5
|
+
|
|
6
|
+
**Map Digital Product Passport events to GS1 EPCIS 2.0, with a CBV vocabulary extended for steel. No third-party runtime dependencies.**
|
|
7
|
+
|
|
8
|
+
[](../../LICENSE)
|
|
9
|
+
[](#)
|
|
10
|
+
|
|
11
|
+
Part of [**tracepass-open**](https://github.com/malinoto/tracepass-open) · Maintained by [TracePass](https://www.tracepass.eu)
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
Build conformant **GS1 EPCIS 2.0** events from passport data — commissioning, service,
|
|
17
|
+
ownership transfer, and supply-chain transformation — as pure functions over plain
|
|
18
|
+
objects.
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @tracepass/dpp-epcis
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { buildCommissioningEvent, validateEpcisDocument, EPCIS_JSONLD_CONTEXT } from "@tracepass/dpp-epcis";
|
|
26
|
+
|
|
27
|
+
const event = buildCommissioningEvent(
|
|
28
|
+
new Date("2026-01-01T00:00:00Z"), // publishedAt
|
|
29
|
+
"urn:epc:id:sgtin:0952012.345678.SN1", // product EPC
|
|
30
|
+
"passport-1",
|
|
31
|
+
"5012345678900", // manufacturer GLN
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
const doc = {
|
|
35
|
+
"@context": EPCIS_JSONLD_CONTEXT,
|
|
36
|
+
type: "EPCISDocument",
|
|
37
|
+
schemaVersion: "2.0",
|
|
38
|
+
creationDate: new Date().toISOString(),
|
|
39
|
+
epcisBody: { eventList: [event] },
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
validateEpcisDocument(doc).valid; // true
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The event carries a CBV business step (`https://ref.gs1.org/cbv/BizStep-commissioning`)
|
|
46
|
+
and a GS1 location reference (`https://id.gs1.org/414/5012345678900`).
|
|
47
|
+
|
|
48
|
+
## Extending CBV for steel
|
|
49
|
+
|
|
50
|
+
Core Business Vocabulary 2.0 has no business steps for several steel production stages.
|
|
51
|
+
Rather than misuse an unrelated step, this package coins them under a vendor namespace —
|
|
52
|
+
the extension pattern GS1 sanctions for exactly this case:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
https://tracepass.eu/voc/cbv/bizstep/smelting
|
|
56
|
+
https://tracepass.eu/voc/cbv/bizstep/casting
|
|
57
|
+
https://tracepass.eu/voc/cbv/bizstep/rolling
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Standard steps are used wherever one exists. `validateEpcisDocument` is a structural
|
|
61
|
+
check — envelope, event type, event time — not a full JSON Schema validation.
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
[Apache-2.0](../../LICENSE)
|
package/dist/cbv.d.ts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CBV (Core Business Vocabulary) mapping for TracePass EPCIS events.
|
|
3
|
+
*
|
|
4
|
+
* EPCIS defines the *shape* of an event; CBV defines the controlled
|
|
5
|
+
* vocabulary that fills the `bizStep` and `disposition` slots. CBV 2.0
|
|
6
|
+
* ships a FIXED list of bizStep values (commissioning, shipping,
|
|
7
|
+
* receiving, inspecting, repairing, …). Many real production steps —
|
|
8
|
+
* smelting, rolling, finishing — are simply not in that list.
|
|
9
|
+
*
|
|
10
|
+
* Decision [Q2] from the 2026-05-22 EPCIS review: for production steps
|
|
11
|
+
* absent from CBV we coin TracePass-owned vocabulary URIs under
|
|
12
|
+
* `https://tracepass.eu/voc/cbv/bizstep/<step>`. EPCIS 2.0 explicitly
|
|
13
|
+
* permits bizStep values outside standard CBV provided they are URIs;
|
|
14
|
+
* this is the GS1-sanctioned industry-extension pattern. We do NOT use
|
|
15
|
+
* the weaker "everything is `commissioning` + a free-text annotation"
|
|
16
|
+
* hack — that buries the meaningful detail in a non-standard field.
|
|
17
|
+
*
|
|
18
|
+
* This module is the single source of truth for those mappings. It is
|
|
19
|
+
* pure data + pure functions — no IO, unit-tested in tests/epcis/cbv.test.ts.
|
|
20
|
+
*
|
|
21
|
+
* What we own and must maintain: the `TRACEPASS_BIZSTEP` table below is
|
|
22
|
+
* a small steel/metals-oriented vocabulary. When a new category needs
|
|
23
|
+
* production steps, extend this table — and keep the published
|
|
24
|
+
* vocabulary document (served from the marketing/voc route) in sync.
|
|
25
|
+
*/
|
|
26
|
+
import type { ServiceEventType } from "@tracepass/dpp-types";
|
|
27
|
+
/**
|
|
28
|
+
* The subset of standard CBV bizSteps TracePass actually emits. Kept
|
|
29
|
+
* as a typed record so a typo surfaces at compile time, not as a
|
|
30
|
+
* silently-wrong URI in a customer's EPCIS feed.
|
|
31
|
+
*/
|
|
32
|
+
export declare const CBV_BIZSTEP_URI: {
|
|
33
|
+
readonly commissioning: "https://ref.gs1.org/cbv/BizStep-commissioning";
|
|
34
|
+
readonly shipping: "https://ref.gs1.org/cbv/BizStep-shipping";
|
|
35
|
+
readonly receiving: "https://ref.gs1.org/cbv/BizStep-receiving";
|
|
36
|
+
readonly inspecting: "https://ref.gs1.org/cbv/BizStep-inspecting";
|
|
37
|
+
readonly repairing: "https://ref.gs1.org/cbv/BizStep-repairing";
|
|
38
|
+
readonly decommissioning: "https://ref.gs1.org/cbv/BizStep-decommissioning";
|
|
39
|
+
readonly storing: "https://ref.gs1.org/cbv/BizStep-storing";
|
|
40
|
+
readonly shipping_returned: "https://ref.gs1.org/cbv/BizStep-shipping";
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* The subset of standard CBV dispositions TracePass emits.
|
|
44
|
+
*/
|
|
45
|
+
export declare const CBV_DISPOSITION_URI: {
|
|
46
|
+
readonly active: "https://ref.gs1.org/cbv/Disp-active";
|
|
47
|
+
readonly in_progress: "https://ref.gs1.org/cbv/Disp-in_progress";
|
|
48
|
+
readonly in_transit: "https://ref.gs1.org/cbv/Disp-in_transit";
|
|
49
|
+
readonly in_repair: "https://ref.gs1.org/cbv/Disp-in_progress";
|
|
50
|
+
readonly recalled: "https://ref.gs1.org/cbv/Disp-recalled";
|
|
51
|
+
readonly destroyed: "https://ref.gs1.org/cbv/Disp-destroyed";
|
|
52
|
+
readonly returned: "https://ref.gs1.org/cbv/Disp-returned";
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* TracePass-coined bizStep URIs for production / lifecycle steps that
|
|
56
|
+
* standard CBV does not define. Each key is a normalised step token;
|
|
57
|
+
* each value is a resolvable `tracepass:` vocabulary URI.
|
|
58
|
+
*
|
|
59
|
+
* Steel/metals-oriented for the lead vertical. Extend (don't replace)
|
|
60
|
+
* when other categories need their own production steps — and update
|
|
61
|
+
* the published vocabulary doc in the same change.
|
|
62
|
+
*/
|
|
63
|
+
export declare const TRACEPASS_BIZSTEP_URI: {
|
|
64
|
+
readonly mining: "https://tracepass.eu/voc/cbv/bizstep/mining";
|
|
65
|
+
readonly smelting: "https://tracepass.eu/voc/cbv/bizstep/smelting";
|
|
66
|
+
readonly casting: "https://tracepass.eu/voc/cbv/bizstep/casting";
|
|
67
|
+
readonly rolling: "https://tracepass.eu/voc/cbv/bizstep/rolling";
|
|
68
|
+
readonly forging: "https://tracepass.eu/voc/cbv/bizstep/forging";
|
|
69
|
+
readonly finishing: "https://tracepass.eu/voc/cbv/bizstep/finishing";
|
|
70
|
+
readonly coating: "https://tracepass.eu/voc/cbv/bizstep/coating";
|
|
71
|
+
readonly heat_treatment: "https://tracepass.eu/voc/cbv/bizstep/heat-treatment";
|
|
72
|
+
readonly machining: "https://tracepass.eu/voc/cbv/bizstep/machining";
|
|
73
|
+
readonly assembly: "https://tracepass.eu/voc/cbv/bizstep/assembly";
|
|
74
|
+
readonly recycling: "https://tracepass.eu/voc/cbv/bizstep/recycling";
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Result of mapping a free-text event type onto CBV. `standard` flags
|
|
78
|
+
* whether the bizStep is a ratified CBV value (true) or a
|
|
79
|
+
* TracePass-coined extension URI (false) — the EPCIS document builder
|
|
80
|
+
* uses this to decide nothing today, but it lets the conformance
|
|
81
|
+
* self-test report "N standard / M extension bizSteps".
|
|
82
|
+
*/
|
|
83
|
+
export interface BizStepMapping {
|
|
84
|
+
/** The bizStep URI to put on the event. Always a URI. */
|
|
85
|
+
bizStep: string;
|
|
86
|
+
/** True when `bizStep` is a ratified CBV value; false when it is a
|
|
87
|
+
* TracePass extension URI. */
|
|
88
|
+
standard: boolean;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Normalise a free-text event-type string into a lookup token:
|
|
92
|
+
* lower-cased, trimmed, internal whitespace + hyphens collapsed to a
|
|
93
|
+
* single underscore. "Heat Treatment" / "heat-treatment" → "heat_treatment".
|
|
94
|
+
*/
|
|
95
|
+
export declare function normalizeStepToken(raw: string): string;
|
|
96
|
+
/**
|
|
97
|
+
* Map a free-text `supplyChainEvents[].eventType` string (the steel
|
|
98
|
+
* template's field 77 — "smelting", "rolling", "shipping", …) to a
|
|
99
|
+
* bizStep URI.
|
|
100
|
+
*
|
|
101
|
+
* Resolution order:
|
|
102
|
+
* 1. Standard CBV bizStep whose name matches the token exactly.
|
|
103
|
+
* 2. TracePass-coined production-step URI.
|
|
104
|
+
* 3. Fallback: a TracePass extension URI minted from the token
|
|
105
|
+
* itself — an unknown step still produces a *valid, resolvable*
|
|
106
|
+
* URI rather than dropping the bizStep. The conformance test
|
|
107
|
+
* surfaces these so the vocabulary table can be extended.
|
|
108
|
+
*
|
|
109
|
+
* Never throws — an EPCIS document builder must not fail on an
|
|
110
|
+
* unexpected production-step string.
|
|
111
|
+
*/
|
|
112
|
+
export declare function mapEventTypeToBizStep(eventType: string): BizStepMapping;
|
|
113
|
+
/**
|
|
114
|
+
* Map a `ServiceEvent.type` enum value to a (bizStep, disposition)
|
|
115
|
+
* pair. ServiceEvents become EPCIS ObjectEvents in the Layer A export.
|
|
116
|
+
* Unlike production steps these map cleanly onto standard CBV — repair
|
|
117
|
+
* and inspection are first-class CBV business steps.
|
|
118
|
+
*/
|
|
119
|
+
export declare function mapServiceEventType(type: ServiceEventType): {
|
|
120
|
+
bizStep: string;
|
|
121
|
+
disposition: string;
|
|
122
|
+
standard: boolean;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Disposition for an `OwnershipTransfer`. Ownership changes become
|
|
126
|
+
* ObjectEvents; "returned" maps to the CBV `returned` disposition,
|
|
127
|
+
* everything else (sale, resale, donation) is a plain ownership
|
|
128
|
+
* change with the object still `active`.
|
|
129
|
+
*/
|
|
130
|
+
export declare function mapOwnershipReasonDisposition(reason: string): string;
|
|
131
|
+
//# sourceMappingURL=cbv.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cbv.d.ts","sourceRoot":"","sources":["../src/cbv.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAsB7D;;;;GAIG;AACH,eAAO,MAAM,eAAe;;;;;;;;;CASlB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;CAQtB,CAAC;AAEX;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;CAYxB,CAAC;AAEX;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAC;IAChB;mCAC+B;IAC/B,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMtD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,CAqBvE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,GAAG;IAC3D,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAwCA;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAIpE"}
|
package/dist/cbv.js
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CBV (Core Business Vocabulary) mapping for TracePass EPCIS events.
|
|
3
|
+
*
|
|
4
|
+
* EPCIS defines the *shape* of an event; CBV defines the controlled
|
|
5
|
+
* vocabulary that fills the `bizStep` and `disposition` slots. CBV 2.0
|
|
6
|
+
* ships a FIXED list of bizStep values (commissioning, shipping,
|
|
7
|
+
* receiving, inspecting, repairing, …). Many real production steps —
|
|
8
|
+
* smelting, rolling, finishing — are simply not in that list.
|
|
9
|
+
*
|
|
10
|
+
* Decision [Q2] from the 2026-05-22 EPCIS review: for production steps
|
|
11
|
+
* absent from CBV we coin TracePass-owned vocabulary URIs under
|
|
12
|
+
* `https://tracepass.eu/voc/cbv/bizstep/<step>`. EPCIS 2.0 explicitly
|
|
13
|
+
* permits bizStep values outside standard CBV provided they are URIs;
|
|
14
|
+
* this is the GS1-sanctioned industry-extension pattern. We do NOT use
|
|
15
|
+
* the weaker "everything is `commissioning` + a free-text annotation"
|
|
16
|
+
* hack — that buries the meaningful detail in a non-standard field.
|
|
17
|
+
*
|
|
18
|
+
* This module is the single source of truth for those mappings. It is
|
|
19
|
+
* pure data + pure functions — no IO, unit-tested in tests/epcis/cbv.test.ts.
|
|
20
|
+
*
|
|
21
|
+
* What we own and must maintain: the `TRACEPASS_BIZSTEP` table below is
|
|
22
|
+
* a small steel/metals-oriented vocabulary. When a new category needs
|
|
23
|
+
* production steps, extend this table — and keep the published
|
|
24
|
+
* vocabulary document (served from the marketing/voc route) in sync.
|
|
25
|
+
*/
|
|
26
|
+
import { TRACEPASS_VOC_BASE } from "./context.js";
|
|
27
|
+
/**
|
|
28
|
+
* Standard CBV 2.0 bizStep URI prefix. Values under this prefix are
|
|
29
|
+
* the official, GS1-ratified business steps — a strict EPCIS consumer
|
|
30
|
+
* recognises them without dereferencing our vocabulary.
|
|
31
|
+
*/
|
|
32
|
+
const CBV_BIZSTEP = "https://ref.gs1.org/cbv/BizStep-";
|
|
33
|
+
/**
|
|
34
|
+
* Standard CBV 2.0 disposition URI prefix.
|
|
35
|
+
*/
|
|
36
|
+
const CBV_DISP = "https://ref.gs1.org/cbv/Disp-";
|
|
37
|
+
/**
|
|
38
|
+
* TracePass-owned bizStep prefix for production steps CBV doesn't
|
|
39
|
+
* cover. Resolvable — the vocabulary document published at
|
|
40
|
+
* `<TRACEPASS_VOC_BASE>cbv/bizstep` describes each term.
|
|
41
|
+
*/
|
|
42
|
+
const TP_BIZSTEP = `${TRACEPASS_VOC_BASE}cbv/bizstep/`;
|
|
43
|
+
/**
|
|
44
|
+
* The subset of standard CBV bizSteps TracePass actually emits. Kept
|
|
45
|
+
* as a typed record so a typo surfaces at compile time, not as a
|
|
46
|
+
* silently-wrong URI in a customer's EPCIS feed.
|
|
47
|
+
*/
|
|
48
|
+
export const CBV_BIZSTEP_URI = {
|
|
49
|
+
commissioning: `${CBV_BIZSTEP}commissioning`,
|
|
50
|
+
shipping: `${CBV_BIZSTEP}shipping`,
|
|
51
|
+
receiving: `${CBV_BIZSTEP}receiving`,
|
|
52
|
+
inspecting: `${CBV_BIZSTEP}inspecting`,
|
|
53
|
+
repairing: `${CBV_BIZSTEP}repairing`,
|
|
54
|
+
decommissioning: `${CBV_BIZSTEP}decommissioning`,
|
|
55
|
+
storing: `${CBV_BIZSTEP}storing`,
|
|
56
|
+
shipping_returned: `${CBV_BIZSTEP}shipping`,
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* The subset of standard CBV dispositions TracePass emits.
|
|
60
|
+
*/
|
|
61
|
+
export const CBV_DISPOSITION_URI = {
|
|
62
|
+
active: `${CBV_DISP}active`,
|
|
63
|
+
in_progress: `${CBV_DISP}in_progress`,
|
|
64
|
+
in_transit: `${CBV_DISP}in_transit`,
|
|
65
|
+
in_repair: `${CBV_DISP}in_progress`,
|
|
66
|
+
recalled: `${CBV_DISP}recalled`,
|
|
67
|
+
destroyed: `${CBV_DISP}destroyed`,
|
|
68
|
+
returned: `${CBV_DISP}returned`,
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* TracePass-coined bizStep URIs for production / lifecycle steps that
|
|
72
|
+
* standard CBV does not define. Each key is a normalised step token;
|
|
73
|
+
* each value is a resolvable `tracepass:` vocabulary URI.
|
|
74
|
+
*
|
|
75
|
+
* Steel/metals-oriented for the lead vertical. Extend (don't replace)
|
|
76
|
+
* when other categories need their own production steps — and update
|
|
77
|
+
* the published vocabulary doc in the same change.
|
|
78
|
+
*/
|
|
79
|
+
export const TRACEPASS_BIZSTEP_URI = {
|
|
80
|
+
mining: `${TP_BIZSTEP}mining`,
|
|
81
|
+
smelting: `${TP_BIZSTEP}smelting`,
|
|
82
|
+
casting: `${TP_BIZSTEP}casting`,
|
|
83
|
+
rolling: `${TP_BIZSTEP}rolling`,
|
|
84
|
+
forging: `${TP_BIZSTEP}forging`,
|
|
85
|
+
finishing: `${TP_BIZSTEP}finishing`,
|
|
86
|
+
coating: `${TP_BIZSTEP}coating`,
|
|
87
|
+
heat_treatment: `${TP_BIZSTEP}heat-treatment`,
|
|
88
|
+
machining: `${TP_BIZSTEP}machining`,
|
|
89
|
+
assembly: `${TP_BIZSTEP}assembly`,
|
|
90
|
+
recycling: `${TP_BIZSTEP}recycling`,
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Normalise a free-text event-type string into a lookup token:
|
|
94
|
+
* lower-cased, trimmed, internal whitespace + hyphens collapsed to a
|
|
95
|
+
* single underscore. "Heat Treatment" / "heat-treatment" → "heat_treatment".
|
|
96
|
+
*/
|
|
97
|
+
export function normalizeStepToken(raw) {
|
|
98
|
+
return raw
|
|
99
|
+
.trim()
|
|
100
|
+
.toLowerCase()
|
|
101
|
+
.replace(/[\s-]+/g, "_")
|
|
102
|
+
.replace(/[^a-z0-9_]/g, "");
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Map a free-text `supplyChainEvents[].eventType` string (the steel
|
|
106
|
+
* template's field 77 — "smelting", "rolling", "shipping", …) to a
|
|
107
|
+
* bizStep URI.
|
|
108
|
+
*
|
|
109
|
+
* Resolution order:
|
|
110
|
+
* 1. Standard CBV bizStep whose name matches the token exactly.
|
|
111
|
+
* 2. TracePass-coined production-step URI.
|
|
112
|
+
* 3. Fallback: a TracePass extension URI minted from the token
|
|
113
|
+
* itself — an unknown step still produces a *valid, resolvable*
|
|
114
|
+
* URI rather than dropping the bizStep. The conformance test
|
|
115
|
+
* surfaces these so the vocabulary table can be extended.
|
|
116
|
+
*
|
|
117
|
+
* Never throws — an EPCIS document builder must not fail on an
|
|
118
|
+
* unexpected production-step string.
|
|
119
|
+
*/
|
|
120
|
+
export function mapEventTypeToBizStep(eventType) {
|
|
121
|
+
const token = normalizeStepToken(eventType);
|
|
122
|
+
if (token in CBV_BIZSTEP_URI) {
|
|
123
|
+
return {
|
|
124
|
+
bizStep: CBV_BIZSTEP_URI[token],
|
|
125
|
+
standard: true,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
if (token in TRACEPASS_BIZSTEP_URI) {
|
|
129
|
+
return {
|
|
130
|
+
bizStep: TRACEPASS_BIZSTEP_URI[token],
|
|
131
|
+
standard: false,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
// Unknown step — mint a stable extension URI from the token so the
|
|
135
|
+
// event is still valid EPCIS. token is already URI-safe.
|
|
136
|
+
return {
|
|
137
|
+
bizStep: `${TP_BIZSTEP}${token || "unspecified"}`,
|
|
138
|
+
standard: false,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Map a `ServiceEvent.type` enum value to a (bizStep, disposition)
|
|
143
|
+
* pair. ServiceEvents become EPCIS ObjectEvents in the Layer A export.
|
|
144
|
+
* Unlike production steps these map cleanly onto standard CBV — repair
|
|
145
|
+
* and inspection are first-class CBV business steps.
|
|
146
|
+
*/
|
|
147
|
+
export function mapServiceEventType(type) {
|
|
148
|
+
switch (type) {
|
|
149
|
+
case "repair":
|
|
150
|
+
case "replacement":
|
|
151
|
+
return {
|
|
152
|
+
bizStep: CBV_BIZSTEP_URI.repairing,
|
|
153
|
+
disposition: CBV_DISPOSITION_URI.in_repair,
|
|
154
|
+
standard: true,
|
|
155
|
+
};
|
|
156
|
+
case "warranty_claim":
|
|
157
|
+
return {
|
|
158
|
+
bizStep: CBV_BIZSTEP_URI.repairing,
|
|
159
|
+
disposition: CBV_DISPOSITION_URI.active,
|
|
160
|
+
standard: true,
|
|
161
|
+
};
|
|
162
|
+
case "maintenance":
|
|
163
|
+
case "inspection":
|
|
164
|
+
return {
|
|
165
|
+
bizStep: CBV_BIZSTEP_URI.inspecting,
|
|
166
|
+
disposition: CBV_DISPOSITION_URI.active,
|
|
167
|
+
standard: true,
|
|
168
|
+
};
|
|
169
|
+
case "recall":
|
|
170
|
+
return {
|
|
171
|
+
bizStep: CBV_BIZSTEP_URI.inspecting,
|
|
172
|
+
disposition: CBV_DISPOSITION_URI.recalled,
|
|
173
|
+
standard: true,
|
|
174
|
+
};
|
|
175
|
+
default: {
|
|
176
|
+
// Exhaustiveness guard — a new ServiceEventType added to the
|
|
177
|
+
// union without a mapping here is a compile error on this line.
|
|
178
|
+
const _exhaustive = type;
|
|
179
|
+
void _exhaustive;
|
|
180
|
+
return {
|
|
181
|
+
bizStep: CBV_BIZSTEP_URI.inspecting,
|
|
182
|
+
disposition: CBV_DISPOSITION_URI.active,
|
|
183
|
+
standard: true,
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Disposition for an `OwnershipTransfer`. Ownership changes become
|
|
190
|
+
* ObjectEvents; "returned" maps to the CBV `returned` disposition,
|
|
191
|
+
* everything else (sale, resale, donation) is a plain ownership
|
|
192
|
+
* change with the object still `active`.
|
|
193
|
+
*/
|
|
194
|
+
export function mapOwnershipReasonDisposition(reason) {
|
|
195
|
+
if (reason === "return")
|
|
196
|
+
return CBV_DISPOSITION_URI.returned;
|
|
197
|
+
if (reason === "recycling")
|
|
198
|
+
return CBV_DISPOSITION_URI.in_progress;
|
|
199
|
+
return CBV_DISPOSITION_URI.active;
|
|
200
|
+
}
|
|
201
|
+
//# sourceMappingURL=cbv.js.map
|
package/dist/cbv.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cbv.js","sourceRoot":"","sources":["../src/cbv.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EPCIS 2.0 JSON-LD @context for TracePass-emitted EPCIS documents.
|
|
3
|
+
*
|
|
4
|
+
* An EPCIS 2.0 document is JSON-LD — the same linked-data family as the
|
|
5
|
+
* schema.org JSON-LD the public passport viewer already emits. The
|
|
6
|
+
* @context tells a consumer which vocabularies the document's terms
|
|
7
|
+
* come from.
|
|
8
|
+
*
|
|
9
|
+
* Four vocabularies compose here:
|
|
10
|
+
* 1. The GS1-published EPCIS 2.0 context — the canonical source of
|
|
11
|
+
* `EPCISDocument`, `ObjectEvent`, `eventTime`, `bizStep`, etc.
|
|
12
|
+
* GS1 hosts this at a stable URL; consumers dereference it.
|
|
13
|
+
* 2. The GS1 CBV terms — Core Business Vocabulary (bizSteps,
|
|
14
|
+
* dispositions). Carried inside the EPCIS context for 2.0.
|
|
15
|
+
* 3. `cbv:` alias — so CBV-standard bizStep/disposition values that
|
|
16
|
+
* DO exist in the standard vocabulary are written with the
|
|
17
|
+
* official `cbv:` prefix.
|
|
18
|
+
* 4. `tracepass:` alias — for the terms that are genuinely ours:
|
|
19
|
+
* the custom bizStep URIs we coin for production steps absent
|
|
20
|
+
* from CBV (smelting, rolling, …), and any TracePass-specific
|
|
21
|
+
* annotation we attach to an event.
|
|
22
|
+
*
|
|
23
|
+
* Design call (per the 2026-05-22 EPCIS review, decision [Q2]):
|
|
24
|
+
* production steps that CBV's fixed bizStep list doesn't cover get
|
|
25
|
+
* TracePass-owned vocabulary URIs under `https://tracepass.eu/cbv/`.
|
|
26
|
+
* This is the GS1-sanctioned industry-extension pattern — a valid
|
|
27
|
+
* EPCIS document MAY use bizStep values outside the standard CBV as
|
|
28
|
+
* long as they are URIs. The `tracepass:` alias keeps those URIs
|
|
29
|
+
* compact in the serialized JSON.
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* The GS1-hosted EPCIS 2.0 JSON-LD context URL. Stable, published by
|
|
33
|
+
* GS1. Consumers dereference it to resolve EPCIS + CBV core terms.
|
|
34
|
+
*/
|
|
35
|
+
export declare const EPCIS_CONTEXT_URL = "https://ref.gs1.org/standards/epcis/2.0.0/epcis-context.jsonld";
|
|
36
|
+
/**
|
|
37
|
+
* Base URI for the TracePass-owned vocabulary. The CBV bizStep
|
|
38
|
+
* extension URIs (`.../cbv/bizstep/smelting`) and any other
|
|
39
|
+
* TracePass-namespaced EPCIS term hang off this. Published as a
|
|
40
|
+
* resolvable JSON-LD vocabulary document — see `cbv.ts` for the
|
|
41
|
+
* term list and `docs`/the vocabulary route for the published doc.
|
|
42
|
+
*/
|
|
43
|
+
export declare const TRACEPASS_VOC_BASE = "https://tracepass.eu/voc/";
|
|
44
|
+
/**
|
|
45
|
+
* The `@context` value placed on every EPCIS document TracePass
|
|
46
|
+
* emits. Array form: the GS1 EPCIS 2.0 context URL first (so its
|
|
47
|
+
* term definitions take precedence), then a local object defining
|
|
48
|
+
* the `tracepass:` alias.
|
|
49
|
+
*
|
|
50
|
+
* The `cbv:` prefix is already defined inside the GS1 EPCIS context,
|
|
51
|
+
* so it is NOT redeclared here — redeclaring it would risk shadowing
|
|
52
|
+
* the official definition.
|
|
53
|
+
*/
|
|
54
|
+
export declare const EPCIS_JSONLD_CONTEXT: ReadonlyArray<string | Record<string, string>>;
|
|
55
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;GAGG;AACH,eAAO,MAAM,iBAAiB,mEACoC,CAAC;AAEnE;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,8BAA8B,CAAC;AAE9D;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAGtE,CAAC"}
|