@twin.org/standards-gs1 0.0.3-next.50 → 0.0.3-next.51
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 +2 -2
- package/docs/changelog.md +7 -0
- package/docs/examples.md +58 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# TWIN GS1
|
|
1
|
+
# TWIN Standards GS1
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This package provides data models aligned with [GS1 standards](https://www.gs1.org/standards), helping supply chain and product data remain semantically consistent between participants.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @twin.org/standards-gs1 - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.3-next.51](https://github.com/twinfoundation/standards/compare/standards-gs1-v0.0.3-next.50...standards-gs1-v0.0.3-next.51) (2026-03-10)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Miscellaneous Chores
|
|
7
|
+
|
|
8
|
+
* **standards-gs1:** Synchronize repo versions
|
|
9
|
+
|
|
3
10
|
## [0.0.3-next.50](https://github.com/twinfoundation/standards/compare/standards-gs1-v0.0.3-next.49...standards-gs1-v0.0.3-next.50) (2026-03-09)
|
|
4
11
|
|
|
5
12
|
|
package/docs/examples.md
CHANGED
|
@@ -1 +1,58 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Standards GS1 Examples
|
|
2
|
+
|
|
3
|
+
These snippets cover identifier checks, helper extraction methods, validation utilities, and schema registration.
|
|
4
|
+
|
|
5
|
+
## Gs1IdentifiersValidation
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import type { IValidationFailure } from '@twin.org/core';
|
|
9
|
+
import { Gs1IdentifiersValidation } from '@twin.org/standards-gs1';
|
|
10
|
+
|
|
11
|
+
const failures: IValidationFailure[] = [];
|
|
12
|
+
const epc = 'urn:epc:id:sgtin:0614141.112345.400';
|
|
13
|
+
|
|
14
|
+
const valid = Gs1IdentifiersValidation.epcId('item.id', epc, failures);
|
|
15
|
+
const gtin = Gs1IdentifiersValidation.extractEpcIdGtin(epc);
|
|
16
|
+
const gln = Gs1IdentifiersValidation.extractEpcIdGln('urn:epc:id:sgln:0614141.12345.0');
|
|
17
|
+
|
|
18
|
+
console.log(valid); // true
|
|
19
|
+
console.log(gtin); // 0614141.112345.400
|
|
20
|
+
console.log(gln); // 0614141.12345.0
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Gs1Validation
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import type { IValidationFailure } from '@twin.org/core';
|
|
27
|
+
import { Gs1Location, Gs1Validation } from '@twin.org/standards-gs1';
|
|
28
|
+
|
|
29
|
+
const failures: IValidationFailure[] = [];
|
|
30
|
+
const location = new Gs1Location();
|
|
31
|
+
location.id = 'urn:epc:id:sgln:0614141.12345.0';
|
|
32
|
+
location.city = 'Rotterdam';
|
|
33
|
+
location.countryCode = 'NL';
|
|
34
|
+
location.latitude = 51.9244;
|
|
35
|
+
location.longitude = 4.4777;
|
|
36
|
+
|
|
37
|
+
const valid = Gs1Validation.locationMasterData('location', location, failures);
|
|
38
|
+
|
|
39
|
+
console.log(valid); // true
|
|
40
|
+
console.log(failures.length); // 0
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Gs1Is And Data Type Registration
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import { EpcisDataTypes, Gs1DataTypes, Gs1Identifiers, Gs1Is } from '@twin.org/standards-gs1';
|
|
47
|
+
|
|
48
|
+
EpcisDataTypes.registerRedirects();
|
|
49
|
+
EpcisDataTypes.registerTypes();
|
|
50
|
+
Gs1DataTypes.registerTypes();
|
|
51
|
+
Gs1Identifiers.registerIdentifiers();
|
|
52
|
+
|
|
53
|
+
const isHex = Gs1Is.isEpcHex('3034257BF7194E4000001A85');
|
|
54
|
+
const isGeo = Gs1Is.isGeoUri('geo:51.9244,4.4777');
|
|
55
|
+
|
|
56
|
+
console.log(isHex); // true
|
|
57
|
+
console.log(isGeo); // true
|
|
58
|
+
```
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/standards-gs1",
|
|
3
|
-
"version": "0.0.3-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.3-next.51",
|
|
4
|
+
"description": "Data models for GS1 vocabularies and semantics.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/twinfoundation/standards.git",
|