Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@clipboard-health/json-api-nestjs

Package Overview
Dependencies
Maintainers
0
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@clipboard-health/json-api-nestjs - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

src/lib/query/createInclude.d.ts

5

package.json
{
"name": "@clipboard-health/json-api-nestjs",
"description": "Utilities for adhering to the JSON:API specification with NestJS.",
"version": "0.2.0",
"version": "0.3.0",
"dependencies": {

@@ -15,2 +15,5 @@ "tslib": "2.7.0",

},
"scripts": {
"embed": "embedme README.md"
},
"type": "commonjs",

@@ -17,0 +20,0 @@ "typings": "./src/index.d.ts",

@@ -27,2 +27,36 @@ # @clipboard-health/json-api-nestjs

// ./examples/query.ts
import {
booleanString,
createCursorPagination,
createFields,
createFilter,
createInclude,
createSort,
} from "@clipboard-health/json-api-nestjs";
import { z } from "zod";
export const query = z
.object({
...createCursorPagination(),
...createFields({ user: ["age", "name"], article: ["title"] }),
...createFilter({
age: {
filters: ["eq", "gt"],
schema: z.coerce.number().int().positive().max(125),
},
isActive: {
filters: ["eq"],
schema: booleanString,
},
dateOfBirth: {
filters: ["gte"],
schema: z.coerce.date().min(new Date("1900-01-01")),
},
}),
...createSort(["age", "name"]),
...createInclude(["articles", "articles.comments"]),
})
.strict();
```

@@ -29,0 +63,0 @@

1

src/index.d.ts
export * from "./lib/query/createCursorPagination";
export * from "./lib/query/createFields";
export * from "./lib/query/createFilter";
export * from "./lib/query/createInclude";
export * from "./lib/query/createSort";
export * from "./lib/schemas";
export * from "./lib/types";

@@ -7,2 +7,3 @@ "use strict";

tslib_1.__exportStar(require("./lib/query/createFilter"), exports);
tslib_1.__exportStar(require("./lib/query/createInclude"), exports);
tslib_1.__exportStar(require("./lib/query/createSort"), exports);

@@ -9,0 +10,0 @@ tslib_1.__exportStar(require("./lib/schemas"), exports);

import { z } from "zod";
import { type Field } from "../types";
export type SortSchema<T extends readonly Field[]> = z.ZodEffects<z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString>>>, Array<`-${T[number]}` | T[number]> | undefined, unknown>>;
/**

@@ -5,0 +4,0 @@ * Creates a Zod schema for JSON:API sort parameters.

@@ -28,2 +28,3 @@ "use strict";

message: `Invalid sort field: '${field}'`,
path: ["sort", field],
});

@@ -30,0 +31,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc