@mimasu/tdt 3.0.4 → 3.0.6

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 CHANGED
@@ -1,8 +1,12 @@
1
1
  # @mimasu/tdt
2
2
 
3
- GS1 EPC Tag Data Translation for JavaScript and TypeScript, powered by WebAssembly.
3
+ **Encode and decode GS1 EPC identifiers for RAIN (UHF) RFID in JavaScript and TypeScript.** Convert between GTIN, SSCC, SGLN, and 50+ other formats — from barcode to EPC hex and back.
4
4
 
5
- Encode and decode all EPC schemes: SGTIN, SSCC, SGLN, GRAI, GIAI, GSRN, GDTI, and more. Supports TDS 2.3 with Digital Link URIs and '++' hostname encoding.
5
+ Powered by WebAssembly. No native dependencies. Works in Node.js and browsers.
6
+
7
+ Implements the **GS1 EPC Tag Data Standard (TDS) 2.3** and **Tag Data Translation (TDT) 2.2** specifications.
8
+
9
+ **Try it online**: https://www.mimasu.nl/tag-data-translation/try-online
6
10
 
7
11
  ## Installation
8
12
 
@@ -12,50 +16,86 @@ npm install @mimasu/tdt
12
16
 
13
17
  ## Quick Start
14
18
 
19
+ ### Encode a GTIN to EPC Hex
20
+
21
+ ```javascript
22
+ import { createEngine } from "@mimasu/tdt";
23
+
24
+ const engine = await createEngine();
25
+
26
+ // encode GTIN + serial to SGTIN-96 binary
27
+ const epc = engine.translate(
28
+ "gtin=00037000302414;serial=10419703",
29
+ "filter=3;gs1companyprefixlength=7;tagLength=96",
30
+ "BINARY"
31
+ );
32
+ const hex = engine.binaryToHex(epc);
33
+ console.log(hex);
34
+ // 30340242201d8840009efdf7
35
+ ```
36
+
37
+ ### Decode EPC Hex to GTIN
38
+
39
+ ```javascript
40
+ const binary = engine.hexToBinary("30340242201d8840009efdf7");
41
+ const uri = engine.translate(binary, "tagLength=96", "PURE_IDENTITY");
42
+ console.log(uri);
43
+ // urn:epc:id:sgtin:0037000.030241.10419703
44
+ ```
45
+
46
+ ### CommonJS
47
+
15
48
  ```javascript
16
49
  const { createEngine } = require("@mimasu/tdt");
17
50
 
18
51
  async function main() {
19
52
  const engine = await createEngine();
20
-
21
- // decode hex to pure identity URI
22
- const binary = engine.hexToBinary("30340242201d8840009efdf7");
23
- const uri = engine.translate(binary, "tagLength=96", "PURE_IDENTITY");
24
- console.log(uri);
25
- // urn:epc:id:sgtin:0037000.030241.10419703
53
+ // ...
26
54
  }
27
-
28
55
  main();
29
56
  ```
30
57
 
58
+ ## Use Cases
59
+
60
+ - **Tag programming**: Encode GTINs and SSCCs to EPC hex for writing to RFID tags
61
+ - **Tag reading**: Decode EPC hex from RFID readers back to human-readable identifiers
62
+ - **Inventory systems**: Translate between barcode and RFID representations
63
+ - **Supply chain apps**: Convert between GS1 Digital Link URIs and EPC binary
64
+
31
65
  ## API
32
66
 
33
67
  ### `createEngine(): Promise<TDTEngine>`
34
68
 
35
- Initialize the WASM engine. Must be called once before using translation methods.
69
+ Initialize the WASM engine. Call once, reuse the engine instance for all translations.
36
70
 
37
71
  ### `engine.translate(epcIdentifier, parameterList, outputFormat): string`
38
72
 
39
- Translate an EPC between encoding levels. Throws on error.
73
+ Translate an EPC between encoding levels. Output formats: `BINARY`, `LEGACY`, `LEGACY_AI`, `TAG_ENCODING`, `PURE_IDENTITY`.
74
+
75
+ Throws on invalid input.
40
76
 
41
77
  ### `engine.tryTranslate(epcIdentifier, parameterList, outputFormat): string | null`
42
78
 
43
- Translate without throwing. Returns null on failure.
79
+ Same as `translate`, but returns `null` instead of throwing. Use this for high-throughput scenarios.
44
80
 
45
81
  ### `engine.hexToBinary(hex): string`
46
82
 
47
- Convert hexadecimal to binary string.
83
+ Convert hexadecimal string to binary string.
48
84
 
49
85
  ### `engine.binaryToHex(binary): string`
50
86
 
51
- Convert binary string to hexadecimal.
87
+ Convert binary string to hexadecimal string.
88
+
89
+ ## Supported Schemes
90
+
91
+ SGTIN-96, SGTIN-198, SSCC-96, SGLN-96, SGLN-195, GRAI-96, GRAI-170, GIAI-96, GIAI-202, GSRN-96, GSRNP-96, GDTI-96, GDTI-113, GDTI-174, SGCN-96, ITIP-110, ITIP-212, GID-96, CPI-96, CPI-var, ADI-var, USDOD-96, plus all TDS 2.3 '+' and '++' variants with Digital Link URI support.
52
92
 
53
93
  ## Performance
54
94
 
55
- The underlying .NET engine translates a typical SGTIN-96 in ~8 us. Hex/binary conversion completes in under 100 ns. The WASM bridge adds minimal overhead on top of the native .NET performance.
95
+ The underlying .NET engine runs as compiled WebAssembly no interpretation overhead.
56
96
 
57
- | Operation | .NET native |
58
- |-----------|-------------|
97
+ | Operation | Time |
98
+ |-----------|------|
59
99
  | SGTIN-96 encode | 7.8 us |
60
100
  | SGTIN-96 decode | 7.7 us |
61
101
  | HexToBinary (96-bit) | 99 ns |
@@ -63,4 +103,6 @@ The underlying .NET engine translates a typical SGTIN-96 in ~8 us. Hex/binary co
63
103
 
64
104
  ## License
65
105
 
66
- Business Source License 1.1. Production use requires a commercial license -- contact tdt@mimasu.nl.
106
+ Business Source License 1.1 (BSL-1.1). Non-production use (development, testing, evaluation) is free. Production use requires a commercial license contact tdt@mimasu.nl.
107
+
108
+ See [LICENSING.md](https://github.com/dannyhaak/TagDataTranslation/blob/master/LICENSING.md) for full details.
Binary file
@@ -1,7 +1,7 @@
1
1
  export const config = /*json-start*/{
2
2
  "mainAssemblyName": "TagDataTranslation.Wasm.dll",
3
3
  "resources": {
4
- "hash": "sha256-SMYKP/IfgIVFTyY1oCMcpPu7sEN6coITeSPsw6LGj3I=",
4
+ "hash": "sha256-+KTKJVkpDuUZLLbjjNmCCEOfzrBnRYXR/QKo1RSQiXE=",
5
5
  "jsModuleNative": [
6
6
  {
7
7
  "name": "dotnet.native.js"
@@ -18,11 +18,6 @@ export const config = /*json-start*/{
18
18
  "integrity": "sha256-x3ZFzMqoNKXG7P81T0ecmcQszqrsPw8W6Gkyipb0gFw="
19
19
  }
20
20
  ],
21
- "wasmSymbols": [
22
- {
23
- "name": "dotnet.native.js.symbols"
24
- }
25
- ],
26
21
  "coreAssembly": [
27
22
  {
28
23
  "virtualPath": "System.Private.CoreLib.wasm",
@@ -884,12 +879,12 @@ export const config = /*json-start*/{
884
879
  {
885
880
  "virtualPath": "TagDataTranslation.wasm",
886
881
  "name": "TagDataTranslation.wasm",
887
- "integrity": "sha256-fshhl5pJbicYJJQd6yKr9Q2IMhpnoaYnODvR075EbcU="
882
+ "integrity": "sha256-3YlhafOJYNGsWlSEBxNV8jiBlOrHiiJ7BbVhP9UlcrM="
888
883
  },
889
884
  {
890
885
  "virtualPath": "TagDataTranslation.Wasm.wasm",
891
886
  "name": "TagDataTranslation.Wasm.wasm",
892
- "integrity": "sha256-YrSjl7K4h5BTYVuLxyyaJBkU0fnE0K6/Dk2e+bE9bBM="
887
+ "integrity": "sha256-m8QfYTTomKZ6pUobndpMCoZy4AdgxpVOZem1n/lSeEk="
893
888
  },
894
889
  {
895
890
  "virtualPath": "WindowsBase.wasm",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mimasu/tdt",
3
- "version": "3.0.4",
3
+ "version": "3.0.6",
4
4
  "description": "GS1 EPC Tag Data Translation for JavaScript/TypeScript and RAIN (UHF) RFID via WebAssembly. Encode and decode SGTIN, SSCC, SGLN, GRAI, and all EPC schemes.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",