@digicom-mt/digicom-nodejs-sdk
v1.0.3
Published
TypeScript SDK for Digicom Nexus API project-scoped resources.
Readme
Digicom Node.js SDK
Type-safe TypeScript SDK for Digicom Nexus API project resources.
Install
npm install @digicom-mt/digicom-nodejs-sdkUsage
import { createDigicomClient } from "@digicom-mt/digicom-nodejs-sdk";
const client = createDigicomClient({
baseUrl: "https://api.example.com",
token: process.env.DIGICOM_TOKEN,
tenantId: process.env.DIGICOM_TENANT_ID,
});
const slides = await client.siteConfig.getHeroCarousel({
projectKey: "silent-natural-farms",
});Features
- Modular route groups (
siteConfig,taxRates,brands,categories,attributeDefinitions,products,customerGroups,customers) - Runtime-configurable
baseUrl, timeout, retries, and headers - Interceptor hooks for request, response, and error flows
- Retry with exponential backoff for transient HTTP/network failures
- Typed errors (
DigicomHttpError,DigicomNetworkError,DigicomValidationError) - Tree-shakeable ESM and CJS bundles with declaration files
Build Targets
dist/esmfor ESM consumersdist/cjsfor CommonJS consumersdist/typesfor.d.tsdeclarations
Scripts
npm run build
npm run typecheck
npm run testBuild and Install Locally
npm run typecheck && npm test && npm run build
npm installPublishing
Manual Publish
To publish the SDK manually to npm:
- Create or update
~/.npmrc:
//registry.npmjs.org/:_authToken=[youraccesstoken]
@digicom-mt:registry=https://registry.npmjs.org/Replace [youraccesstoken] with your npm access token.
- Build and test the package:
npm run typecheck && npm test && npm run build- Publish to npm:
npm publish --access publicGitLab CI/CD Publish
Pushing to main runs the GitLab pipeline in .gitlab-ci.yml.
The pipeline:
- Installs dependencies
- Runs typecheck, tests, and build
- Creates
~/.npmrcin CI using theNPM_TOKENGitLab CI variable - Bumps the version automatically
- Publishes the package to npm
- Pushes the updated version back to
main
Add these GitLab CI variables before using the pipeline:
NPM_TOKEN: npm access token used to publish the packageGITLAB_TOKEN: optional token withwrite_repositoryaccess ifCI_JOB_TOKENcannot push back tomain
The CI job creates this npm config automatically:
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
@digicom-mt:registry=https://registry.npmjs.org/Versioning in CI:
- Default bump:
PATCH(0.0.1) - Major bump: include
[major],BREAKING CHANGE, or!:in the commit message - If the version-bump commit cannot be pushed with
CI_JOB_TOKEN, setGITLAB_TOKENin GitLab CI/CD variables
Versioning
This SDK follows semantic versioning:
MAJOR: breaking API changesMINOR: backward-compatible featuresPATCH: backward-compatible fixes
