Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
@pentops/jsonapi-request
Advanced tools
A TypeScript fetch wrapper for making requests to [jsonapi](https://github.com/pentops/jsonapi) projects.
A TypeScript fetch wrapper for making requests to jsonapi projects.
Basic use example:
import { buildMergedRequestInit, buildSplitRequestInit, makeRequest } from '@pentops/jsonapi-request';
interface LoginRequest {
username: string;
password: string;
}
interface LoginResponse {
token: string;
}
export async function login(request: LoginRequest): Promise<LoginResponse> {
return makeRequest<LoginResponse, LoginRequest>(...buildMergedRequestInit('POST', '/api/v1', '/login', request));
};
interface GetUserRequestPathParameters {
id: string;
}
interface GetUserRequestQueryParameters {
includeProfile?: boolean;
}
interface User {
id: string;
username: string;
email: string;
}
interface UserResponse {
user: User;
}
export async function getUser(id: string, includeProfile?: boolean): Promise<UserResponse> {
return makeRequest<UserResponse>(...buildSplitRequestInit<GetUserRequestPathParameters, GetUserRequestQueryParameters>('GET', '/api/v1', '/users/:id', { id }, { includeProfile }));
}
Use buildSplitRequestInit if your types are separated into request bodies, path parameters, and query parameters.
Use buildMergedRequestInit if your types are merged into a single request type. Path parameters (denoted using colon format, e.g., :id) are replaced with the values in the request path. Other parameters will be added to the query string for GET requests and the request body for other requests.
You will need to have uuid
installed as a peer dependency.
FAQs
A TypeScript fetch wrapper for making requests to [jsonapi](https://github.com/pentops/jsonapi) projects.
The npm package @pentops/jsonapi-request receives a total of 17 weekly downloads. As such, @pentops/jsonapi-request popularity was classified as not popular.
We found that @pentops/jsonapi-request demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.