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

@tsed/schema

Package Overview
Dependencies
Maintainers
0
Versions
837
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tsed/schema - npm Package Compare versions

Comparing version 8.3.5 to 8.3.6

lib/esm/domain/__fixtures__/inspectOperationsPaths.js

2

.barrelsby.json
{
"directory": ["./src", "./src/components"],
"exclude": ["**/__mock__", "**/__mocks__", "**/*.spec.ts", "**/test", "**/*.benchmark.ts"],
"exclude": ["**/__mock__", "**/__mocks__", "**/__fixtures__", "**/*.spec.ts", "**/test", "**/*.benchmark.ts"],
"delete": true
}

@@ -46,2 +46,3 @@ import { OperationVerbs } from "../../constants/OperationVerbs.js";

...operation,
...operationPath.toJSON(options),
parameters,

@@ -48,0 +49,0 @@ operationId: operation.operationId ||

@@ -12,3 +12,5 @@ import { OperationVerbs } from "../../constants/OperationVerbs.js";

const method = OperationVerbs[this.get("method")] || OperationVerbs.CUSTOM;
path && this.entity.operation.addOperationPath(method, path);
if (path) {
this.operationPath = this.entity.operation.addOperationPath(method, path);
}
}

@@ -22,5 +24,7 @@ onMapKey(key, value) {

case "summary":
this.operationPath?.summary(value);
this.entity.operation.summary(value);
return;
case "description":
this.operationPath?.description(value);
this.entity.operation.description(value);

@@ -27,0 +31,0 @@ return;

@@ -5,2 +5,17 @@ import { deepMerge, uniq, uniqBy } from "@tsed/core";

import { JsonResponse } from "./JsonResponse.js";
export class JsonMethodPath extends JsonMap {
constructor(method, path) {
super();
this.method = method;
this.path = path;
}
summary(summary) {
super.set("summary", summary);
return this;
}
description(description) {
super.set("description", description);
return this;
}
}
export class JsonOperation extends JsonMap {

@@ -138,9 +153,6 @@ #status;

}
addOperationPath(method, path, options = {}) {
this.operationPaths.set(String(method) + String(path), {
...options,
method,
path
});
return this;
addOperationPath(method, path) {
const operationPath = new JsonMethodPath(method, path);
this.operationPaths.set(String(method) + String(path), operationPath);
return operationPath;
}

@@ -147,0 +159,0 @@ getAllowedOperationPath(allowedVerbs) {

@@ -7,6 +7,8 @@ import { OpenSpecSecurity, OpenSpecTag, OS3Operation } from "@tsed/openspec";

import { JsonSchema } from "./JsonSchema.js";
export interface JsonMethodPath {
export declare class JsonMethodPath extends JsonMap<any> {
method: string;
path: string | RegExp;
method: string;
[key: string]: any;
constructor(method: string, path: string | RegExp);
summary(summary: string): this;
description(description: string): this;
}

@@ -50,4 +52,4 @@ export interface JsonOperationOptions extends OS3Operation<JsonSchema, JsonParameter, JsonMap<JsonResponse>> {

addProduce(produce: string): void;
addOperationPath(method: string, path: string | RegExp, options?: any): this;
addOperationPath(method: string, path: string | RegExp): JsonMethodPath;
getAllowedOperationPath(allowedVerbs?: string[]): JsonMethodPath[];
}

@@ -5,3 +5,3 @@ {

"type": "module",
"version": "8.3.5",
"version": "8.3.6",
"source": "./src/index.ts",

@@ -41,3 +41,3 @@ "main": "./lib/esm/index.js",

"dependencies": {
"@tsed/openspec": "8.3.5",
"@tsed/openspec": "8.3.6",
"change-case": "^5.4.4",

@@ -51,7 +51,7 @@ "json-schema": "0.4.0",

"@apidevtools/swagger-parser": "10.1.0",
"@tsed/barrels": "8.3.5",
"@tsed/core": "8.3.5",
"@tsed/hooks": "8.3.5",
"@tsed/openspec": "8.3.5",
"@tsed/typescript": "8.3.5",
"@tsed/barrels": "8.3.6",
"@tsed/core": "8.3.6",
"@tsed/hooks": "8.3.6",
"@tsed/openspec": "8.3.6",
"@tsed/typescript": "8.3.6",
"@types/fs-extra": "11.0.4",

@@ -69,5 +69,5 @@ "@types/json-schema": "7.0.15",

"peerDependencies": {
"@tsed/core": "8.3.5",
"@tsed/hooks": "8.3.5",
"@tsed/openspec": "8.3.5"
"@tsed/core": "8.3.6",
"@tsed/hooks": "8.3.6",
"@tsed/openspec": "8.3.6"
},

@@ -74,0 +74,0 @@ "peerDependenciesMeta": {

@@ -79,2 +79,3 @@ import {OS3Operation, OS3Paths} from "@tsed/openspec";

...operation,
...operationPath.toJSON(options),
parameters,

@@ -81,0 +82,0 @@ operationId:

import {OperationVerbs} from "../../constants/OperationVerbs.js";
import {DecoratorContext} from "../../domain/DecoratorContext.js";
import {JsonMethodStore} from "../../domain/JsonMethodStore.js";
import {JsonMethodPath, type JsonOperation} from "../../domain/JsonOperation.js";
import {mapOperationOptions} from "../../utils/mapOperationOptions.js";

@@ -56,2 +57,3 @@

protected declare entity: JsonMethodStore;
protected operationPath: JsonMethodPath;

@@ -62,3 +64,5 @@ protected beforeInit() {

path && this.entity.operation.addOperationPath(method, path);
if (path) {
this.operationPath = this.entity.operation.addOperationPath(method, path);
}
}

@@ -73,6 +77,9 @@

case "summary":
this.operationPath?.summary(value);
this.entity.operation.summary(value);
return;
case "description":
this.operationPath?.description(value);
this.entity.operation.description(value);
return;

@@ -79,0 +86,0 @@ case "use":

import "../../index.js";
import {OperationVerbs} from "../../constants/OperationVerbs.js";
import {inspectOperationsPaths} from "../../domain/__fixtures__/inspectOperationsPaths.js";
import {JsonEntityStore} from "../../domain/JsonEntityStore.js";

@@ -18,3 +19,3 @@ import {Publish} from "./publish.js";

// THEN
expect([...endpoint.operation!.operationPaths.values()]).toEqual([
expect(inspectOperationsPaths(endpoint)).toEqual([
{

@@ -21,0 +22,0 @@ method: OperationVerbs.PUBLISH,

@@ -0,1 +1,2 @@

import {inspectOperationsPaths} from "../../domain/__fixtures__/inspectOperationsPaths.js";
import {JsonEntityStore, OperationVerbs} from "../../index.js";

@@ -16,3 +17,3 @@ import {All, Delete, Get, Head, Options, Patch, Post, Put} from "./route.js";

// THEN
expect([...endpoint.operation!.operationPaths.values()]).toEqual([
expect(inspectOperationsPaths(endpoint)).toEqual([
{

@@ -38,3 +39,3 @@ method: OperationVerbs.ALL,

// THEN
expect([...endpoint.operation!.operationPaths.values()]).toEqual([
expect(inspectOperationsPaths(endpoint)).toEqual([
{

@@ -59,3 +60,3 @@ method: OperationVerbs.GET,

// THEN
expect([...endpoint.operation!.operationPaths.values()]).toEqual([
expect(inspectOperationsPaths(endpoint)).toEqual([
{

@@ -97,3 +98,3 @@ method: OperationVerbs.GET,

// THEN
expect([...endpoint.operation!.operationPaths.values()]).toEqual([
expect(inspectOperationsPaths(endpoint)).toEqual([
{

@@ -119,3 +120,3 @@ method: OperationVerbs.POST,

// THEN
expect([...endpoint.operation!.operationPaths.values()]).toEqual([
expect(inspectOperationsPaths(endpoint)).toEqual([
{

@@ -144,3 +145,3 @@ method: OperationVerbs.PUT,

// THEN
expect([...endpoint.operation!.operationPaths.values()]).toEqual([
expect(inspectOperationsPaths(endpoint)).toEqual([
{

@@ -166,3 +167,3 @@ method: OperationVerbs.DELETE,

// THEN
expect([...endpoint.operation!.operationPaths.values()]).toEqual([
expect(inspectOperationsPaths(endpoint)).toEqual([
{

@@ -188,3 +189,3 @@ method: OperationVerbs.HEAD,

// THEN
expect([...endpoint.operation!.operationPaths.values()]).toEqual([
expect(inspectOperationsPaths(endpoint)).toEqual([
{

@@ -210,3 +211,3 @@ method: OperationVerbs.PATCH,

// THEN
expect([...endpoint.operation!.operationPaths.values()]).toEqual([
expect(inspectOperationsPaths(endpoint)).toEqual([
{

@@ -213,0 +214,0 @@ method: OperationVerbs.OPTIONS,

import "../../index.js";
import {OperationVerbs} from "../../constants/OperationVerbs.js";
import {inspectOperationsPaths} from "../../domain/__fixtures__/inspectOperationsPaths.js";
import {JsonEntityStore} from "../../domain/JsonEntityStore.js";

@@ -20,3 +21,3 @@ import {Publish} from "./publish.js";

// THEN
expect([...endpoint.operation!.operationPaths.values()]).toEqual([
expect(inspectOperationsPaths(endpoint)).toEqual([
{

@@ -23,0 +24,0 @@ method: OperationVerbs.SUBSCRIBE,

@@ -10,2 +10,3 @@ import {StoreSet} from "@tsed/core";

import {Get} from "../decorators/operations/route.js";
import {inspectOperationsPaths} from "./__fixtures__/inspectOperationsPaths.js";
import {JsonEntityStore} from "./JsonEntityStore.js";

@@ -128,3 +129,3 @@ import {EndpointMetadata, JsonMethodStore} from "./JsonMethodStore.js";

expect([...endpoint.operationPaths.values()]).toEqual([
expect(inspectOperationsPaths(endpoint)).toEqual([
{

@@ -268,10 +269,7 @@ method: OperationVerbs.GET,

expect([...storeMethod?.operationPaths.entries()]).toEqual([
[
"GET/",
{
method: "GET",
path: "/"
}
]
expect(inspectOperationsPaths(storeMethod as JsonMethodStore)).toEqual([
{
method: "GET",
path: "/"
}
]);

@@ -278,0 +276,0 @@ expect(storeMethod?.getResponseOptions(200)).toEqual({

@@ -11,7 +11,21 @@ import {deepMerge, uniq, uniqBy} from "@tsed/core";

export interface JsonMethodPath {
path: string | RegExp;
method: string;
export class JsonMethodPath extends JsonMap<any> {
constructor(
public method: string,
public path: string | RegExp
) {
super();
}
[key: string]: any;
summary(summary: string): this {
super.set("summary", summary);
return this;
}
description(description: string): this {
super.set("description", description);
return this;
}
}

@@ -28,2 +42,3 @@

readonly operationPaths: Map<string, JsonMethodPath> = new Map();
#status: number;

@@ -204,10 +219,7 @@ #redirection: boolean = false;

addOperationPath(method: string, path: string | RegExp, options: any = {}) {
this.operationPaths.set(String(method) + String(path), {
...options,
method,
path
});
addOperationPath(method: string, path: string | RegExp) {
const operationPath = new JsonMethodPath(method, path);
this.operationPaths.set(String(method) + String(path), operationPath);
return this;
return operationPath;
}

@@ -214,0 +226,0 @@

import {BodyParams} from "@tsed/platform-params";
import {OperationVerbs} from "../constants/OperationVerbs.js";
import {Name} from "../decorators/common/name.js";
import {Get} from "../decorators/operations/route.js";
import {JsonEntityStore} from "./JsonEntityStore.js";
import {JsonOperation} from "./JsonOperation.js";
import {JsonMethodPath, JsonOperation} from "./JsonOperation.js";
import {JsonOperationRoute} from "./JsonOperationRoute.js";

@@ -20,10 +21,8 @@

endpoint,
operationPath: {method: "GET", path: "/"},
operationPath: new JsonMethodPath("GET", "/"),
basePath: "/base"
});
expect(operationRoute.operationPath).toEqual({
method: "GET",
path: "/"
});
expect(operationRoute.operationPath?.method).toEqual("GET");
expect(operationRoute.operationPath?.path).toEqual("/");
expect(operationRoute.method).toEqual("GET");

@@ -54,10 +53,8 @@ expect(operationRoute.path).toEqual("/");

endpoint,
operationPath: {method: "GET", path: "/"},
operationPath: new JsonMethodPath(OperationVerbs.GET, "/"),
basePath: "/base"
});
expect(operationRoute.operationPath).toEqual({
method: "GET",
path: "/"
});
expect(operationRoute.operationPath?.method).toEqual("GET");
expect(operationRoute.operationPath?.path).toEqual("/");
expect(operationRoute.method).toEqual("GET");

@@ -87,10 +84,8 @@ expect(operationRoute.path).toEqual("/");

endpoint,
operationPath: {method: "GET", path: "/"},
operationPath: new JsonMethodPath("GET", "/"),
basePath: "/base"
});
expect(operationRoute.operationPath).toEqual({
method: "GET",
path: "/"
});
expect(operationRoute.operationPath?.method).toEqual("GET");
expect(operationRoute.operationPath?.path).toEqual("/");
expect(operationRoute.method).toEqual("GET");

@@ -97,0 +92,0 @@ expect(operationRoute.path).toEqual("/");

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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