barcodefyi 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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 FYIPedia
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,88 @@
1
+ # barcodefyi
2
+
3
+ [![npm](https://img.shields.io/npm/v/barcodefyi)](https://www.npmjs.com/package/barcodefyi)
4
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.7-blue)](https://www.typescriptlang.org/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
6
+ [![Zero Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)](https://www.npmjs.com/package/barcodefyi)
7
+
8
+ TypeScript API client for [BarcodeFYI](https://barcodefyi.com) -- the comprehensive barcode reference covering 50+ symbologies across 1D and 2D families, GS1 standards, encoding components, and industry applications from retail UPC/EAN to healthcare GS1 DataMatrix. Zero dependencies, uses native `fetch`.
9
+
10
+ > **Explore barcodes at [barcodefyi.com](https://barcodefyi.com)** -- [Symbologies](https://barcodefyi.com/symbologies/) | [Standards](https://barcodefyi.com/standards/) | [Glossary](https://barcodefyi.com/glossary/) | [API Docs](https://barcodefyi.com/developers/)
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ npm install barcodefyi
16
+ ```
17
+
18
+ Works in Node.js, Deno, Bun, and browsers (ESM).
19
+
20
+ ## Quick Start
21
+
22
+ ```typescript
23
+ import { BarcodeFYI } from "barcodefyi";
24
+
25
+ const api = new BarcodeFYI();
26
+
27
+ // Search symbologies, standards, glossary
28
+ const results = await api.search("ean-13");
29
+
30
+ // Get symbology detail
31
+ const code128 = await api.symbology("code-128");
32
+ console.log(code128.encoding_type); // "Linear"
33
+ console.log(code128.character_set); // "Full ASCII (128 characters)"
34
+
35
+ // Compare two symbologies
36
+ const comparison = await api.compare("upc-a", "ean-13");
37
+
38
+ // Get industry applications
39
+ const retail = await api.industry("retail");
40
+ ```
41
+
42
+ ## API Methods
43
+
44
+ | Method | Description |
45
+ |--------|-------------|
46
+ | `search(query)` | Search symbologies, standards, components, glossary |
47
+ | `glossaryTerm(slug)` | Get glossary term definition |
48
+ | `symbology(slug)` | Barcode symbology detail |
49
+ | `family(slug)` | Barcode family detail |
50
+ | `standard(slug)` | Barcode standard detail |
51
+ | `component(slug)` | Barcode component detail |
52
+ | `industry(slug)` | Industry application detail |
53
+ | `compare(slugA, slugB)` | Compare two symbologies |
54
+ | `random()` | Random barcode symbology |
55
+ | `openapi()` | OpenAPI 3.1.0 specification |
56
+
57
+ ## TypeScript Types
58
+
59
+ ```typescript
60
+ import type {
61
+ SearchResult, SymbologyDetail, FamilyDetail, StandardDetail,
62
+ ComponentDetail, GlossaryTerm, CompareResult, IndustryDetail,
63
+ } from "barcodefyi";
64
+ ```
65
+
66
+ ## Also Available
67
+
68
+ | Language | Package |
69
+ |----------|---------|
70
+ | Python | [barcodefyi on PyPI](https://pypi.org/project/barcodefyi/) |
71
+ | TypeScript | **This package** |
72
+
73
+ ## Code FYI Family
74
+
75
+ Part of the [FYIPedia](https://fyipedia.com) open-source developer tools ecosystem -- automatic identification and data capture technologies.
76
+
77
+ | Package | npm | Description |
78
+ |---------|-----|-------------|
79
+ | **barcodefyi** | [npm](https://www.npmjs.com/package/barcodefyi) | **Barcode symbologies, standards -- [barcodefyi.com](https://barcodefyi.com/)** |
80
+ | qrcodefyi | [npm](https://www.npmjs.com/package/qrcodefyi) | QR code types, versions, encoding -- [qrcodefyi.com](https://qrcodefyi.com/) |
81
+ | nfcfyi | [npm](https://www.npmjs.com/package/nfcfyi) | NFC chips, NDEF, standards -- [nfcfyi.com](https://nfcfyi.com/) |
82
+ | blefyi | [npm](https://www.npmjs.com/package/blefyi) | BLE profiles, beacons, chips -- [blefyi.com](https://blefyi.com/) |
83
+ | rfidfyi | [npm](https://www.npmjs.com/package/rfidfyi) | RFID tags, readers, frequencies -- [rfidfyi.com](https://rfidfyi.com/) |
84
+ | smartcardfyi | [npm](https://www.npmjs.com/package/smartcardfyi) | Smart cards, EMV, platforms -- [smartcardfyi.com](https://smartcardfyi.com/) |
85
+
86
+ ## License
87
+
88
+ MIT
package/dist/index.cjs ADDED
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ BarcodeFYI: () => BarcodeFYI
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+
27
+ // src/client.ts
28
+ var BarcodeFYI = class {
29
+ baseUrl;
30
+ constructor(baseUrl = "https://barcodefyi.com") {
31
+ this.baseUrl = baseUrl.replace(/\/+$/, "");
32
+ }
33
+ async get(path, params) {
34
+ const url = new URL(path, this.baseUrl);
35
+ if (params) {
36
+ Object.entries(params).forEach(([k, v]) => url.searchParams.set(k, v));
37
+ }
38
+ const res = await fetch(url.toString());
39
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
40
+ return res.json();
41
+ }
42
+ /** Search symbologies, standards, components, and glossary terms. */
43
+ async search(query) {
44
+ return this.get("/api/search/", { q: query });
45
+ }
46
+ /** Get a glossary term by slug. */
47
+ async glossaryTerm(slug) {
48
+ return this.get(`/api/term/${slug}/`);
49
+ }
50
+ /** Get barcode symbology detail by slug. */
51
+ async symbology(slug) {
52
+ return this.get(`/api/symbology/${slug}/`);
53
+ }
54
+ /** Get barcode family detail by slug. */
55
+ async family(slug) {
56
+ return this.get(`/api/family/${slug}/`);
57
+ }
58
+ /** Get barcode standard detail by slug. */
59
+ async standard(slug) {
60
+ return this.get(`/api/standard/${slug}/`);
61
+ }
62
+ /** Get barcode component detail by slug. */
63
+ async component(slug) {
64
+ return this.get(`/api/component/${slug}/`);
65
+ }
66
+ /** Get industry application detail by slug. */
67
+ async industry(slug) {
68
+ return this.get(`/api/industry/${slug}/`);
69
+ }
70
+ /** Compare two barcode symbologies. */
71
+ async compare(slugA, slugB) {
72
+ return this.get("/api/compare/", {
73
+ a: slugA,
74
+ b: slugB
75
+ });
76
+ }
77
+ /** Get a random barcode symbology. */
78
+ async random() {
79
+ return this.get("/api/random/");
80
+ }
81
+ /** Get the OpenAPI 3.1.0 specification. */
82
+ async openapi() {
83
+ return this.get("/api/openapi.json");
84
+ }
85
+ };
86
+ // Annotate the CommonJS export names for ESM import in node:
87
+ 0 && (module.exports = {
88
+ BarcodeFYI
89
+ });
@@ -0,0 +1,109 @@
1
+ /**
2
+ * BarcodeFYI API response types.
3
+ */
4
+ interface SearchResult {
5
+ results: Array<{
6
+ name: string;
7
+ slug: string;
8
+ type: string;
9
+ url: string;
10
+ }>;
11
+ query: string;
12
+ total: number;
13
+ }
14
+ interface GlossaryTerm {
15
+ name: string;
16
+ slug: string;
17
+ definition: string;
18
+ related_terms?: string[];
19
+ }
20
+ interface SymbologyDetail {
21
+ slug: string;
22
+ name: string;
23
+ description: string;
24
+ family?: string;
25
+ encoding_type?: string;
26
+ character_set?: string;
27
+ max_data_length?: number;
28
+ check_digit?: boolean;
29
+ url: string;
30
+ }
31
+ interface FamilyDetail {
32
+ slug: string;
33
+ name: string;
34
+ description: string;
35
+ symbologies?: string[];
36
+ url: string;
37
+ }
38
+ interface StandardDetail {
39
+ slug: string;
40
+ name: string;
41
+ description: string;
42
+ organization?: string;
43
+ year?: number;
44
+ url: string;
45
+ }
46
+ interface ComponentDetail {
47
+ slug: string;
48
+ name: string;
49
+ description: string;
50
+ url: string;
51
+ }
52
+ interface IndustryDetail {
53
+ slug: string;
54
+ name: string;
55
+ description: string;
56
+ symbologies?: string[];
57
+ url: string;
58
+ }
59
+ interface CompareResult {
60
+ item_a: {
61
+ name: string;
62
+ slug: string;
63
+ };
64
+ item_b: {
65
+ name: string;
66
+ slug: string;
67
+ };
68
+ comparison: Record<string, unknown>;
69
+ }
70
+ interface RandomResult {
71
+ slug: string;
72
+ name: string;
73
+ type: string;
74
+ url: string;
75
+ }
76
+
77
+ /**
78
+ * BarcodeFYI API client -- TypeScript wrapper for barcodefyi.com REST API.
79
+ *
80
+ * Zero dependencies. Uses native `fetch`.
81
+ */
82
+
83
+ declare class BarcodeFYI {
84
+ private baseUrl;
85
+ constructor(baseUrl?: string);
86
+ private get;
87
+ /** Search symbologies, standards, components, and glossary terms. */
88
+ search(query: string): Promise<SearchResult>;
89
+ /** Get a glossary term by slug. */
90
+ glossaryTerm(slug: string): Promise<GlossaryTerm>;
91
+ /** Get barcode symbology detail by slug. */
92
+ symbology(slug: string): Promise<SymbologyDetail>;
93
+ /** Get barcode family detail by slug. */
94
+ family(slug: string): Promise<FamilyDetail>;
95
+ /** Get barcode standard detail by slug. */
96
+ standard(slug: string): Promise<StandardDetail>;
97
+ /** Get barcode component detail by slug. */
98
+ component(slug: string): Promise<ComponentDetail>;
99
+ /** Get industry application detail by slug. */
100
+ industry(slug: string): Promise<IndustryDetail>;
101
+ /** Compare two barcode symbologies. */
102
+ compare(slugA: string, slugB: string): Promise<CompareResult>;
103
+ /** Get a random barcode symbology. */
104
+ random(): Promise<RandomResult>;
105
+ /** Get the OpenAPI 3.1.0 specification. */
106
+ openapi(): Promise<Record<string, unknown>>;
107
+ }
108
+
109
+ export { BarcodeFYI, type CompareResult, type ComponentDetail, type FamilyDetail, type GlossaryTerm, type IndustryDetail, type RandomResult, type SearchResult, type StandardDetail, type SymbologyDetail };
@@ -0,0 +1,109 @@
1
+ /**
2
+ * BarcodeFYI API response types.
3
+ */
4
+ interface SearchResult {
5
+ results: Array<{
6
+ name: string;
7
+ slug: string;
8
+ type: string;
9
+ url: string;
10
+ }>;
11
+ query: string;
12
+ total: number;
13
+ }
14
+ interface GlossaryTerm {
15
+ name: string;
16
+ slug: string;
17
+ definition: string;
18
+ related_terms?: string[];
19
+ }
20
+ interface SymbologyDetail {
21
+ slug: string;
22
+ name: string;
23
+ description: string;
24
+ family?: string;
25
+ encoding_type?: string;
26
+ character_set?: string;
27
+ max_data_length?: number;
28
+ check_digit?: boolean;
29
+ url: string;
30
+ }
31
+ interface FamilyDetail {
32
+ slug: string;
33
+ name: string;
34
+ description: string;
35
+ symbologies?: string[];
36
+ url: string;
37
+ }
38
+ interface StandardDetail {
39
+ slug: string;
40
+ name: string;
41
+ description: string;
42
+ organization?: string;
43
+ year?: number;
44
+ url: string;
45
+ }
46
+ interface ComponentDetail {
47
+ slug: string;
48
+ name: string;
49
+ description: string;
50
+ url: string;
51
+ }
52
+ interface IndustryDetail {
53
+ slug: string;
54
+ name: string;
55
+ description: string;
56
+ symbologies?: string[];
57
+ url: string;
58
+ }
59
+ interface CompareResult {
60
+ item_a: {
61
+ name: string;
62
+ slug: string;
63
+ };
64
+ item_b: {
65
+ name: string;
66
+ slug: string;
67
+ };
68
+ comparison: Record<string, unknown>;
69
+ }
70
+ interface RandomResult {
71
+ slug: string;
72
+ name: string;
73
+ type: string;
74
+ url: string;
75
+ }
76
+
77
+ /**
78
+ * BarcodeFYI API client -- TypeScript wrapper for barcodefyi.com REST API.
79
+ *
80
+ * Zero dependencies. Uses native `fetch`.
81
+ */
82
+
83
+ declare class BarcodeFYI {
84
+ private baseUrl;
85
+ constructor(baseUrl?: string);
86
+ private get;
87
+ /** Search symbologies, standards, components, and glossary terms. */
88
+ search(query: string): Promise<SearchResult>;
89
+ /** Get a glossary term by slug. */
90
+ glossaryTerm(slug: string): Promise<GlossaryTerm>;
91
+ /** Get barcode symbology detail by slug. */
92
+ symbology(slug: string): Promise<SymbologyDetail>;
93
+ /** Get barcode family detail by slug. */
94
+ family(slug: string): Promise<FamilyDetail>;
95
+ /** Get barcode standard detail by slug. */
96
+ standard(slug: string): Promise<StandardDetail>;
97
+ /** Get barcode component detail by slug. */
98
+ component(slug: string): Promise<ComponentDetail>;
99
+ /** Get industry application detail by slug. */
100
+ industry(slug: string): Promise<IndustryDetail>;
101
+ /** Compare two barcode symbologies. */
102
+ compare(slugA: string, slugB: string): Promise<CompareResult>;
103
+ /** Get a random barcode symbology. */
104
+ random(): Promise<RandomResult>;
105
+ /** Get the OpenAPI 3.1.0 specification. */
106
+ openapi(): Promise<Record<string, unknown>>;
107
+ }
108
+
109
+ export { BarcodeFYI, type CompareResult, type ComponentDetail, type FamilyDetail, type GlossaryTerm, type IndustryDetail, type RandomResult, type SearchResult, type StandardDetail, type SymbologyDetail };
package/dist/index.js ADDED
@@ -0,0 +1,62 @@
1
+ // src/client.ts
2
+ var BarcodeFYI = class {
3
+ baseUrl;
4
+ constructor(baseUrl = "https://barcodefyi.com") {
5
+ this.baseUrl = baseUrl.replace(/\/+$/, "");
6
+ }
7
+ async get(path, params) {
8
+ const url = new URL(path, this.baseUrl);
9
+ if (params) {
10
+ Object.entries(params).forEach(([k, v]) => url.searchParams.set(k, v));
11
+ }
12
+ const res = await fetch(url.toString());
13
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
14
+ return res.json();
15
+ }
16
+ /** Search symbologies, standards, components, and glossary terms. */
17
+ async search(query) {
18
+ return this.get("/api/search/", { q: query });
19
+ }
20
+ /** Get a glossary term by slug. */
21
+ async glossaryTerm(slug) {
22
+ return this.get(`/api/term/${slug}/`);
23
+ }
24
+ /** Get barcode symbology detail by slug. */
25
+ async symbology(slug) {
26
+ return this.get(`/api/symbology/${slug}/`);
27
+ }
28
+ /** Get barcode family detail by slug. */
29
+ async family(slug) {
30
+ return this.get(`/api/family/${slug}/`);
31
+ }
32
+ /** Get barcode standard detail by slug. */
33
+ async standard(slug) {
34
+ return this.get(`/api/standard/${slug}/`);
35
+ }
36
+ /** Get barcode component detail by slug. */
37
+ async component(slug) {
38
+ return this.get(`/api/component/${slug}/`);
39
+ }
40
+ /** Get industry application detail by slug. */
41
+ async industry(slug) {
42
+ return this.get(`/api/industry/${slug}/`);
43
+ }
44
+ /** Compare two barcode symbologies. */
45
+ async compare(slugA, slugB) {
46
+ return this.get("/api/compare/", {
47
+ a: slugA,
48
+ b: slugB
49
+ });
50
+ }
51
+ /** Get a random barcode symbology. */
52
+ async random() {
53
+ return this.get("/api/random/");
54
+ }
55
+ /** Get the OpenAPI 3.1.0 specification. */
56
+ async openapi() {
57
+ return this.get("/api/openapi.json");
58
+ }
59
+ };
60
+ export {
61
+ BarcodeFYI
62
+ };
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "barcodefyi",
3
+ "version": "0.1.0",
4
+ "description": "TypeScript API client for BarcodeFYI -- barcode symbologies, standards, components, and industry applications. Zero dependencies.",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "scripts": {
18
+ "build": "tsup src/index.ts --format esm --dts",
19
+ "test": "vitest run",
20
+ "typecheck": "tsc --noEmit"
21
+ },
22
+ "keywords": [
23
+ "barcode",
24
+ "upc",
25
+ "ean",
26
+ "isbn",
27
+ "code-128",
28
+ "gs1",
29
+ "symbology",
30
+ "api-client",
31
+ "barcodefyi"
32
+ ],
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "https://github.com/fyipedia/barcodefyi-js"
36
+ },
37
+ "homepage": "https://barcodefyi.com",
38
+ "license": "MIT",
39
+ "author": "FYIPedia",
40
+ "devDependencies": {
41
+ "tsup": "^8.0",
42
+ "typescript": "^5.7",
43
+ "vitest": "^3.0"
44
+ }
45
+ }