
Research
/Security News
Miasma Mini Shai-Hulud Hits ImmobiliareLabs npm Packages
Miasma Mini Shai-Hulud hits @immobiliarelabs Backstage plugins, targeting GitLab and LDAP auth packages on npm.
@nldoc/types
Advanced tools
TypeScript type definitions and validation schemas for the NLdoc Document Specification. This library provides runtime type validation using Zod schemas, ensuring type safety for document processing and validation.
This package provides:
The types are designed to work seamlessly with the NLdoc Document Specification and provide both compile-time type safety and runtime validation capabilities.
Install the package via npm:
npm install @nldoc/types
Or using yarn:
yarn add @nldoc/types
import { Document, Asset, Footnote } from '@nldoc/types';
// Type-safe document creation
const document: Document = {
type: 'Document',
// ... other document properties
};
// Runtime validation
try {
const validatedDocument = await Document.parseAsync(documentData);
console.log('Document is valid:', validatedDocument);
} catch (error) {
console.error('Validation failed:', error);
}
The package exports Zod schemas for runtime validation:
import { Document } from '@nldoc/types';
// Validate and parse document data
const result = Document.safeParse(documentData);
if (result.success) {
// TypeScript knows result.data is a valid Document
console.log('Valid document:', result.data);
} else {
// Handle validation errors
console.error('Validation errors:', result.error.issues);
}
Clone the repository:
git clone https://gitlab.com/logius/nldoc/lib/typescript/types.git
cd types
Install dependencies:
npm install
Build the project:
npm run build
npm run test - Run the test suite with Vitest and coveragenpm run test:watch - Run tests in watch mode with coveragenpm run build - Compile TypeScript to JavaScriptnpm run build:check - Type check without emitting filesnpm run lint - Lint the codebase using ESLintnpm run format - Format code using Prettiernpm run format:check - Check code formattingnpm run fix - Auto-fix linting and formatting issuesnpm run commit - Use conventional commits with CommitizenThe package exports TypeScript types for all NLdoc document resources:
When adding new types, they should be added to src/resources.ts. All types are contained in one file because some have recursive dependencies on others, which prevents breaking them into separate files while maintaining proper import relationships.
See Zod's documentation on recursive types for more information.
The types are tested against a comprehensive collection of valid and invalid examples from the NLdoc document specification. Test examples are automatically downloaded on first test run.
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
Tests validate:
We welcome contributions! Please ensure:
npm test)npm run format:check)npm run lint)npm run build:check)npm run commit)This project is licensed under the European Union Public License 1.2 - see LICENSE for details.
FAQs
NLdoc's Type Definitions for Document Specification
The npm package @nldoc/types receives a total of 86 weekly downloads. As such, @nldoc/types popularity was classified as not popular.
We found that @nldoc/types demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Miasma Mini Shai-Hulud hits @immobiliarelabs Backstage plugins, targeting GitLab and LDAP auth packages on npm.

Security News
Rolldown paused Rust React Compiler integration after a 5MB binary size increase raised concerns about shipping React-specific code to all Vite users.

Security News
/Research
Mini Shai-Hulud expands into the Go ecosystem after hitting LeoPlatform npm packages and targeting GitHub Actions workflows.