New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

std-json-api

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

std-json-api - npm Package Compare versions

Comparing version
1.5.0
to
1.6.0
+1
-1
package.json
{
"name": "std-json-api",
"version": "1.5.0",
"version": "1.6.0",
"description": "JSON-API standard utilities for NestJS",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -80,2 +80,3 @@ /**

cursor: string;
field: string;
limit: number;

@@ -82,0 +83,0 @@ };

@@ -140,3 +140,3 @@ "use strict";

// If no valid limit, return just cursor (though technically incomplete)
return { cursor, limit: 10 }; // Default limit
return { cursor, limit: 10 };
}

@@ -143,0 +143,0 @@ // Check for offset-based pagination

# std-json-api
Functional standard `JSON:API` serializers, schemas, and utilities for building
`JSON:API` compliant applications.
A comprehensive TypeScript library for building
[JSON:API v1.1](https://jsonapi.org/format/) compliant applications.
## Types & Schemas
### TODO
All types are exported from `std-api`. Each type has a `zod` schema that can be
used to validate the data structure.
```typescript
import type { MetaObject } from "std-json-api/std-api";
import type { metaObject } from "std-json-api/schemas/meta-object";
// validate a meta object example
metaObject.parse({});
```
## ResourceDescriptor
A utility to describe a `JSON:API` resource with its attributes and
relationships.
```typescript
import Describe from "std-json-api/descriptor";
const desc = Describe("resource-id")
.addAttr("name", "string")
.addReleationship("related-resource", "related-type", "related-id")
.build();
```
## Functional Builder API
Provides a functional API for building `JSON:API` documents.
```typescript
import {SingleDocument, Attributes, Meta, Resource, Id, Type} from "std-json-api/builder-fn";
const doc = SingleDocument(
Meta({}),
Data(
Resource(
Id('...'),
Type('...'),
Attributes({
...
})
)
)
);
```
## Builder API
Provides an API for building `JSON:API` documents.
```typescript
import JsonApiBuilder from "std-json-api/builder";
const doc = JsonApiBuilder
.singleDocument()
.meta({})
.data(
JsonApiBuilder.resource()
.id('...')
.type('...')
.attributes({
...
})
)
```
- [ ] Add pagination builders by strategy (offset, cursor).