
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
ns-inventory-api-types
Advanced tools
Types-only package that re-exports the Hono AppType for RPC clients.
TypeScript types for NS Inventory Management API, auto-generated from the Hono server's AppType.
npm install @ns-inventory/api-types hono
import { hc } from 'hono/client';
import type { AppType } from '@ns-inventory/api-types';
// Create a typed client
const client = hc<AppType>('http://localhost:3000');
// Now you have full type safety!
const response = await client.api.auth['product-stock'].all.$get();
const data = await response.json(); // Fully typed response
import type {
AppType,
ApiResponse,
ProductStock,
ProductStockWithEmployee,
Employee,
WithdrawOrder,
WithdrawOrderDetails,
CreateWithdrawOrderRequest,
UpdateWithdrawOrderRequest,
} from '@ns-inventory/api-types';
const fetchProductStock = async () => {
const response = await client.api.auth['product-stock'].all.$get();
const data: ApiResponse<ProductStock[]> = await response.json();
if (data.success) {
return data.data; // ProductStock[]
}
throw new Error(data.message);
};
const fetchProductStockWithEmployee = async () => {
const response = await client.api.auth['product-stock']['with-employee'].$get();
const data: ApiResponse<ProductStockWithEmployee[]> = await response.json();
return data.data?.map(item => ({
productStock: item.product_stock,
employee: item.employee
})) || [];
};
const createWithdrawOrder = async (orderData: CreateWithdrawOrderRequest) => {
const response = await client.api.auth['withdraw-orders'].create.$post({
json: orderData
});
const data: ApiResponse<WithdrawOrder> = await response.json();
if (!data.success) {
throw new Error(data.message);
}
return data.data;
};
// Usage
const newOrder = await createWithdrawOrder({
dateWithdraw: '2024-12-20',
userId: 'user-123',
numItems: 3,
isComplete: false
});
const fetchEmployee = async (userId: string) => {
const response = await client.api.auth.employee.all.$get({
query: { userId }
});
const data: ApiResponse<EmployeeWithPermissions[]> = await response.json();
return data.data;
};
const safeApiCall = async () => {
try {
const response = await client.api.auth['product-stock'].all.$get();
const data = await response.json();
if (!data.success) {
console.error('API Error:', data.message);
return null;
}
return data.data;
} catch (error) {
console.error('Network Error:', error);
return null;
}
};
import { useState, useEffect } from 'react';
import { hc } from 'hono/client';
import type { AppType, ProductStock } from '@ns-inventory/api-types';
const client = hc<AppType>(process.env.NEXT_PUBLIC_API_URL!);
export function useProductStock() {
const [products, setProducts] = useState<ProductStock[]>([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
useEffect(() => {
const fetchProducts = async () => {
try {
const response = await client.api.auth['product-stock'].all.$get();
const data = await response.json();
if (data.success) {
setProducts(data.data || []);
} else {
setError(data.message || 'Failed to fetch products');
}
} catch (err) {
setError('Network error');
} finally {
setLoading(false);
}
};
fetchProducts();
}, []);
return { products, loading, error };
}
This package is automatically generated from the NS Inventory API server. When new routes are added to the server, run:
npm run publish:types
This will automatically:
MIT
FAQs
Types-only package that re-exports the Hono AppType for RPC clients.
We found that ns-inventory-api-types demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.