@openrfid/gs1 0.1.0 → 1.0.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/README.md +93 -0
- package/package.json +4 -3
package/README.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="https://raw.githubusercontent.com/rfidsoftwares/openrfid-simulator/main/assets/logo.svg" alt="OpenRFID Simulator Logo" width="180" />
|
|
4
|
+
|
|
5
|
+
# `@openrfid/gs1`
|
|
6
|
+
|
|
7
|
+
### GS1 SGTIN-96, GRAI-96, & GIAI-96 Barcode & EPC Tag Encoders/Decoders
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/@openrfid/gs1)
|
|
10
|
+
[](https://opensource.org/licenses/MIT)
|
|
11
|
+
[](https://rfidsoftwares.com)
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 🚀 Overview
|
|
18
|
+
|
|
19
|
+
`@openrfid/gs1` provides bit-level bidirectional conversion between **GS1 Enterprise Identifiers** (UPC / GTIN barcodes) and **96-bit Gen2 RFID EPC Tag Headers**. It supports **SGTIN-96** (Serialized Global Trade Item Number), **GRAI-96** (Global Returnable Asset Identifier), and **GIAI-96** (Global Individual Asset Identifier) encoding standards across partition tables 0 through 6.
|
|
20
|
+
|
|
21
|
+
Developed & Maintained by **[RFID Software India Private Limited](https://rfidsoftwares.com)**.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 📦 Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# npm
|
|
29
|
+
npm install @openrfid/gs1
|
|
30
|
+
|
|
31
|
+
# pnpm
|
|
32
|
+
pnpm add @openrfid/gs1
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 💻 Code Example
|
|
38
|
+
|
|
39
|
+
### 1. Encode GTIN-14 Barcode + Serial to SGTIN-96 EPC Hex
|
|
40
|
+
```typescript
|
|
41
|
+
import { encodeSgtin96, decodeSgtin96 } from '@openrfid/gs1';
|
|
42
|
+
|
|
43
|
+
// Convert UPC/GTIN + Serial Number to 96-bit RFID EPC Hex string
|
|
44
|
+
const gtin = '00614141000024'; // 14-digit GTIN (Company Prefix: 0614141, Item Ref: 00002)
|
|
45
|
+
const serial = 1048576; // Integer serial number
|
|
46
|
+
const filterValue = 3; // Filter 3 = Single Shipping Unit
|
|
47
|
+
|
|
48
|
+
const epcHex = encodeSgtin96({ gtin, serial, filter: filterValue });
|
|
49
|
+
console.log('Generated SGTIN-96 EPC Hex:', epcHex);
|
|
50
|
+
// Output: "3034257BF4000B4000100000"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 2. Decode SGTIN-96 EPC Hex to GTIN Barcode
|
|
54
|
+
```typescript
|
|
55
|
+
import { decodeSgtin96 } from '@openrfid/gs1';
|
|
56
|
+
|
|
57
|
+
const epcHex = '3034257BF4000B4000100000';
|
|
58
|
+
const decoded = decodeSgtin96(epcHex);
|
|
59
|
+
|
|
60
|
+
console.log('GTIN-14:', decoded.gtin); // "00614141000024"
|
|
61
|
+
console.log('Company Prefix:', decoded.companyPrefix); // "0614141"
|
|
62
|
+
console.log('Item Reference:', decoded.itemReference); // "00002"
|
|
63
|
+
console.log('Serial Number:', decoded.serial); // 1048576
|
|
64
|
+
console.log('Filter Value:', decoded.filter); // 3
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## 📚 Supported GS1 Standards & Partition Tables
|
|
70
|
+
|
|
71
|
+
| Standard | Header (Hex) | Description | Use Case |
|
|
72
|
+
| :--- | :---: | :--- | :--- |
|
|
73
|
+
| **SGTIN-96** | `0x30` | Serialized Global Trade Item Number | Retail, Consumer Goods, Apparel |
|
|
74
|
+
| **GRAI-96** | `0x33` | Global Returnable Asset Identifier | Reusable Pallets, Cages, Containers |
|
|
75
|
+
| **GIAI-96** | `0x34` | Global Individual Asset Identifier | Fixed Capital Assets, Medical Devices |
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## 🌐 Monorepo Ecosystem
|
|
80
|
+
|
|
81
|
+
| Package | Description |
|
|
82
|
+
| :--- | :--- |
|
|
83
|
+
| [`@openrfid/epc`](https://www.npmjs.com/package/@openrfid/epc) | Bit-level EPC Gen2 memory bank encoders/decoders |
|
|
84
|
+
| [`@openrfid/tags`](https://www.npmjs.com/package/@openrfid/tags) | RFID tag domain models & memory generator |
|
|
85
|
+
| [`@openrfid/simulator`](https://www.npmjs.com/package/@openrfid/simulator) | High-throughput inventory simulation engine |
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 📄 License & Corporate Support
|
|
90
|
+
|
|
91
|
+
Licensed under the **MIT License**.
|
|
92
|
+
Brought to you by **RFID Software India Private Limited**.
|
|
93
|
+
For enterprise RFID middleware, hardware drivers, or custom protocol plugins, visit **[rfidsoftwares.com](https://rfidsoftwares.com)**.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrfid/gs1",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "GS1 Tag Data Standard encoding and decoding for SGTIN-96, GRAI-96, GIAI-96.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -13,10 +13,11 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
|
-
"dist"
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
17
18
|
],
|
|
18
19
|
"dependencies": {
|
|
19
|
-
"@openrfid/epc": "
|
|
20
|
+
"@openrfid/epc": "1.0.0"
|
|
20
21
|
},
|
|
21
22
|
"devDependencies": {
|
|
22
23
|
"tsup": "^8.0.2",
|