# Code Deb Inventory IDs SDK

**Verified npm release:** `@codedeb/inventory-ids@0.1.0` was publicly accessible with the correct version, latest dist-tag and tarball.

Deterministic short SKU formatting and barcode-compatible text with transactional collision avoidance.

## Build and verify from source

From the CodeDeb repository root:

```bash
npm ci
npm run test:nepal-sdks
npm run sdk:pack:verify
node scripts/sdk/stage-npm-package.mjs sdk-inventory-ids
```

The staged npm artifact is placed at `.sdk-artifacts/npm-stage/sdk-inventory-ids`. The source package remains `private: true`; only explicitly verified staged artifacts can be published.

Install the verified public version with `npm install @codedeb/inventory-ids@0.1.0`.

## Quickstart — actual source exports

```typescript
import {formatSku,allocateSku} from '@codedeb/inventory-ids';
import {withGtinCheckDigit} from '@codedeb/inventory-ids/barcode';
const sku=formatSku({prefix:'MT',category:'TEA',sequence:42});
console.log(sku,withGtinCheckDigit('400638133393'));
```

These imports use the published npm entrypoints. The bundled JavaScript and TypeScript exports are exercised in an isolated consumer during the candidate release gate.

## API reference

| Export | Purpose |
| --- | --- |
| `normalizeSkuPart / formatSku / parseSku` | Normalize ASCII prefixes and format or parse predictable SKU sequences. |
| `allocateSku(parts, atomicStore)` | Reserve candidates through a caller-owned atomic adapter. |
| `gtinCheckDigit / validGtin` | Validate the GTIN check digit for 8-, 12-, 13- and 14-digit codes. |
| `barcodeText` | Validate printable ASCII intended for a barcode renderer. |

## Production integration and limitations

A valid GTIN check digit does not grant a GS1 company prefix. The SDK does not render barcode images, assign global prefixes or guarantee collision avoidance without a transactional unique index.

## Versioning and attribution

- **0.1.0 — candidate (2026-11-21):** Initial independent ESM package and TypeScript declarations, subject to runtime, type, security and publication checks.
- **License:** Apache-2.0 for Code Deb-authored package code. The full license text is attached only to the reviewed public tarball. Code Deb brand names and logos are not licensed as trademarks.
- **Documentation:** [API reference](/docs/sdk/inventory-ids) · [All SDKs](/docs/sdk) · [Developer resources](/docs/resources)
- **Related research:** [Source](https://www.gs1.org/standards/barcodes)

No hosted service, support SLA or official Nepal government certification is implied by the package.

## End-to-end integration procedure

1. Reserve SKU sequences atomically in your database; formatting alone does not guarantee uniqueness.
2. Choose stable namespaces per company, product family and label type.
3. Validate GTIN check digits before transmitting barcodes or printing labels.
4. Test your physical printer/scanner combination and exact symbology.

## Install and verify the distribution

```bash
npm view @codedeb/inventory-ids@0.1.0 version
npm install @codedeb/inventory-ids@0.1.0
```

Pin `0.1.0` in a reproducible lockfile and exercise the published JavaScript and TypeScript declarations in an isolated consumer. Do not import files directly from the private source monorepo.

## Production readiness tests

- Validate normal, missing, malformed and boundary inputs using actual package imports.
- Confirm application-owned adapters preserve authorization, tenant separation and durable state where relevant.
- Record deterministic outputs and failure reasons; reject silent coercion or ambiguous success.
- Review data retention, security and third-party licensing where applicable.

## Troubleshooting

**npm 404:** Check the exact immutable version at [npm](https://www.npmjs.com/package/@codedeb/inventory-ids); registry propagation and metadata publication are separate from local tarball packaging. **Incorrect values:** Check whether caller inputs were converted between text, numbers and locale formats. **Unexpected integrations:** Review the application's persistence and authorization boundaries; no hosted platform is included.

## Related developer packages

[catalog engine](/docs/sdk/catalog-engine) · [invoice refs](/docs/sdk/invoice-refs) · [All SDKs](/docs/sdk) · [Developer resources](/docs/resources)
