
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@sharpapi/sharpapi-node-core
Advanced tools
SharpAPI.com Node.js SDK Core - Shared functionality for SharpAPI clients

SharpAPI Node Core is the foundational package that powers all SharpAPI Node.js SDK packages. It provides the base service class, HTTP client functionality, polling mechanisms, error handling, and shared utilities used across all SharpAPI packages.
The SharpAPI Core package provides:
SharpApiCoreService - Foundation for all API servicesnpm install @sharpapi/sharpapi-node-core
Note: This package is typically installed automatically as a dependency of other SharpAPI packages. You only need to install it directly if you're building custom services.
sharpapi-node-core/
├── src/
│ ├── SharpApiCoreService.js # Base service class
│ ├── Dto/
│ │ ├── SharpApiJob.js # Job DTO
│ │ └── SharpApiSubscriptionInfo.js
│ ├── Enums/
│ │ ├── SharpApiJobTypeEnum.js # API endpoint types
│ │ ├── SharpApiJobStatusEnum.js # Job statuses
│ │ ├── SharpApiLanguages.js # Supported languages
│ │ └── SharpApiVoiceTone.js # Voice tone options
│ └── index.js # Package exports
├── package.json
└── README.md
sharpapi-node-core (base package)
↓
[All other SharpAPI packages extend core]
↓
sharpapi-node-product-categories
sharpapi-node-travel-review-sentiment
sharpapi-node-parse-resume
... (27 total packages)
The base class that all SharpAPI services extend.
Key Features:
Constructor:
constructor(apiKey, config = {})
Parameters:
apiKey (string): Your SharpAPI API keyconfig (object, optional):
baseURL (string): API base URL (default: 'https://sharpapi.com/api/v1')timeout (number): Request timeout in ms (default: 30000)maxRetries (number): Max retry attempts (default: 3)retryDelay (number): Initial retry delay in ms (default: 1000)Defines all available API endpoints and their types:
const { SharpApiJobTypeEnum } = require('@sharpapi/sharpapi-node-core');
SharpApiJobTypeEnum.ECOMMERCE_PRODUCT_CATEGORIES
SharpApiJobTypeEnum.HR_PARSE_RESUME
SharpApiJobTypeEnum.CONTENT_SUMMARIZE
// ... and more
Job status enumeration:
const { SharpApiJobStatusEnum } = require('@sharpapi/sharpapi-node-core');
SharpApiJobStatusEnum.PENDING // Job is queued
SharpApiJobStatusEnum.SUCCESS // Job completed successfully
SharpApiJobStatusEnum.FAILED // Job failed
Supported languages (80+ languages):
const { SharpApiLanguages } = require('@sharpapi/sharpapi-node-core');
SharpApiLanguages.ENGLISH
SharpApiLanguages.SPANISH
SharpApiLanguages.FRENCH
// ... and more
Voice tone options for content generation:
const { SharpApiVoiceTone } = require('@sharpapi/sharpapi-node-core');
SharpApiVoiceTone.PROFESSIONAL
SharpApiVoiceTone.CASUAL
SharpApiVoiceTone.FORMAL
// ... and more
Represents an API job with status and results:
const { SharpApiJob } = require('@sharpapi/sharpapi-node-core');
const job = new SharpApiJob(responseData);
console.log(job.getStatus()); // 'success'
console.log(job.getType()); // 'content_paraphrase'
console.log(job.getResultJson()); // Parsed result object
Represents user subscription details:
const { SharpApiSubscriptionInfo } = require('@sharpapi/sharpapi-node-core');
const subscription = new SharpApiSubscriptionInfo(data);
console.log(subscription.getWordsQuota());
console.log(subscription.getWordsUsed());
You can extend SharpApiCoreService to create custom API integrations:
const { SharpApiCoreService, SharpApiJobTypeEnum } = require('@sharpapi/sharpapi-node-core');
class MyCustomService extends SharpApiCoreService {
/**
* Example method for async endpoint
*/
async processContent(content) {
const data = { content };
const response = await this.makeRequest(
'POST',
SharpApiJobTypeEnum.CONTENT_SUMMARIZE.url,
data
);
return this.parseStatusUrl(response);
}
/**
* Example method for sync endpoint
*/
async getData() {
const response = await this.makeRequest('GET', '/utilities/my_endpoint');
return response.data;
}
/**
* Fetch results from async job
*/
async getResults(statusUrl) {
const result = await this.fetchResults(statusUrl);
return result.getResultJson();
}
}
// Usage
const service = new MyCustomService(process.env.SHARP_API_KEY);
// Async endpoint
const statusUrl = await service.processContent('Some text...');
const result = await service.getResults(statusUrl);
// Sync endpoint
const data = await service.getData();
makeRequest(method, endpoint, data?, config?)Make HTTP requests to the API.
Parameters:
method (string): HTTP method ('GET', 'POST', etc.)endpoint (string): API endpoint pathdata (object, optional): Request body or query parametersconfig (object, optional): Axios request configReturns:
fetchResults(statusUrl, maxWaitTime?)Poll an async job until completion.
Parameters:
statusUrl (string): Job status URLmaxWaitTime (number, optional): Max polling time in ms (default: 300000)Returns:
parseStatusUrl(response)Extract status URL from API response.
Parameters:
response (AxiosResponse): API responseReturns:
The core service uses Axios with the following defaults:
https://sharpapi.com/api/v1Authorization: Bearer {apiKey}Accept: application/jsonContent-Type: application/jsonThe core service handles various error types:
try {
const result = await service.makeRequest('POST', '/endpoint', data);
} catch (error) {
if (error.response) {
// API error response
console.error('Status:', error.response.status);
console.error('Message:', error.response.data.message);
} else if (error.request) {
// Network error
console.error('Network error:', error.message);
} else {
// Other errors
console.error('Error:', error.message);
}
}
The API implements rate limiting:
X-RateLimit-Limit: Total requests allowed per minuteX-RateLimit-Remaining: Remaining requestsX-RateLimit-Reset: Reset timestampThe core service automatically handles 429 responses with exponential backoff.
const { SharpApiCoreService, SharpApiJobTypeEnum } = require('@sharpapi/sharpapi-node-core');
class ContentAnalysisService extends SharpApiCoreService {
async analyzeText(text, language = 'English') {
// Submit analysis job
const data = { content: text, language };
const response = await this.makeRequest(
'POST',
SharpApiJobTypeEnum.CONTENT_SUMMARIZE.url,
data
);
// Get status URL
const statusUrl = this.parseStatusUrl(response);
// Poll for results
const job = await this.fetchResults(statusUrl);
// Return parsed results
return job.getResultJson();
}
async getSubscriptionInfo() {
const response = await this.makeRequest('GET', '/subscription');
return response.data;
}
}
// Usage
const service = new ContentAnalysisService(process.env.SHARP_API_KEY, {
timeout: 60000,
maxRetries: 5
});
async function main() {
try {
const analysis = await service.analyzeText('Your text here...');
console.log('Analysis:', analysis);
const subscription = await service.getSubscriptionInfo();
console.log('Quota:', subscription);
} catch (error) {
console.error('Error:', error.message);
}
}
main();
All SharpAPI Node.js packages depend on this core package:
This project is licensed under the MIT License. See the LICENSE.md file for details.
Powered by SharpAPI - AI-Powered API Workflow Automation
FAQs
SharpAPI.com Node.js SDK Core - Shared functionality for SharpAPI clients
The npm package @sharpapi/sharpapi-node-core receives a total of 3 weekly downloads. As such, @sharpapi/sharpapi-node-core popularity was classified as not popular.
We found that @sharpapi/sharpapi-node-core 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.