Socket
Socket
Sign inDemoInstall

@tsed/schema

Package Overview
Dependencies
Maintainers
0
Versions
788
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 7.82.2 to 7.82.3

5

lib/cjs/decorators/operations/operation.js

@@ -8,3 +8,6 @@ "use strict";

class OperationDecoratorContext extends DecoratorContext_js_1.DecoratorContext {
methods = ["name", "description", "summary", "method", "id", "use", "useAfter", "useBefore"];
constructor() {
super(...arguments);
this.methods = ["name", "description", "summary", "method", "id", "use", "useAfter", "useBefore"];
}
beforeInit() {

@@ -11,0 +14,0 @@ const path = this.get("path");

43

lib/cjs/decorators/operations/returns.js

@@ -32,26 +32,25 @@ "use strict";

class ReturnDecoratorContext extends DecoratorContext_js_1.DecoratorContext {
methods = [
"contentType",
"description",
"examples",
"type",
"status",
"of",
"ofInteger",
"oneOf",
"allOf",
"anyOf",
"nested",
"header",
"headers",
"schema",
"title",
"groups",
"allowedGroups",
"location",
"binary"
];
hasOfTypes;
constructor({ status, model }) {
super();
this.methods = [
"contentType",
"description",
"examples",
"type",
"status",
"of",
"ofInteger",
"oneOf",
"allOf",
"anyOf",
"nested",
"header",
"headers",
"schema",
"title",
"groups",
"allowedGroups",
"location",
"binary"
];
this.model(model);

@@ -58,0 +57,0 @@ this.status(status);

@@ -11,8 +11,5 @@ "use strict";

class DecoratorContext extends Map {
methods;
decoratorType;
entity;
actions = [];
constructor(opts = {}) {
super();
this.actions = [];
Object.entries(opts).forEach(([key, value]) => {

@@ -19,0 +16,0 @@ this.set(key, value);

@@ -10,6 +10,9 @@ "use strict";

let JsonClassStore = class JsonClassStore extends JsonEntityStore_js_1.JsonEntityStore {
/**
* List of children JsonEntityStore (properties or methods or params)
*/
children = new Map();
constructor() {
super(...arguments);
/**
* List of children JsonEntityStore (properties or methods or params)
*/
this.children = new Map();
}
get path() {

@@ -16,0 +19,0 @@ return this.store.get("path", "/");

@@ -6,7 +6,5 @@ "use strict";

class Discriminator {
propertyName;
base;
values = new Map();
types = new Map();
constructor({ base, propertyName, types, values } = {}) {
this.values = new Map();
this.types = new Map();
Object.assign(this, (0, core_1.cleanObject)({

@@ -13,0 +11,0 @@ base,

@@ -10,40 +10,4 @@ "use strict";

class JsonEntityStore {
/**
* Original property key decorated by the decorator
*/
propertyKey;
/**
* Alias of the property
*/
propertyName;
/**
* Parameter index
*/
index;
/**
* Method's descriptor
*/
descriptor;
/**
* Decorator type used to declare the JsonSchemaStore.
*/
decoratorType;
/**
* Type of the collection (Array, Map, Set, etc...)
*/
collectionType;
token;
store;
isStore = true;
parent;
target;
/**
*
*/
_type;
/**
* Ref to JsonSchema
*/
_schema;
constructor(options) {
this.isStore = true;
const { target, propertyKey, descriptor, index, decoratorType } = options;

@@ -50,0 +14,0 @@ this.target = target;

@@ -7,6 +7,5 @@ "use strict";

class JsonLazyRef {
getType;
isLazyRef = true;
constructor(getType) {
this.getType = getType;
this.isLazyRef = true;
}

@@ -13,0 +12,0 @@ get target() {

@@ -7,6 +7,6 @@ "use strict";

class JsonMap extends Map {
$kind = "map";
$isJsonDocument = true;
constructor(obj = {}) {
super();
this.$kind = "map";
this.$isJsonDocument = true;
this.assign(obj);

@@ -13,0 +13,0 @@ }

@@ -6,6 +6,7 @@ "use strict";

class JsonMedia extends JsonMap_js_1.JsonMap {
$kind = "operationMedia";
groups = [];
groupsName;
allowedGroups;
constructor() {
super(...arguments);
this.$kind = "operationMedia";
this.groups = [];
}
schema(schema) {

@@ -12,0 +13,0 @@ this.set("schema", schema);

@@ -11,14 +11,2 @@ "use strict";

let JsonMethodStore = class JsonMethodStore extends JsonEntityStore_js_1.JsonEntityStore {
parent = JsonEntityStore_js_1.JsonEntityStore.from(this.target);
middlewares = [];
beforeMiddlewares = [];
afterMiddlewares = [];
/**
* Ref to JsonOperation when the decorated object is a method.
*/
operation = new JsonOperation_js_1.JsonOperation();
/**
* List of children JsonEntityStore (properties or methods or params)
*/
children = new Map();
constructor(options) {

@@ -30,2 +18,14 @@ super({

});
this.parent = JsonEntityStore_js_1.JsonEntityStore.from(this.target);
this.middlewares = [];
this.beforeMiddlewares = [];
this.afterMiddlewares = [];
/**
* Ref to JsonOperation when the decorated object is a method.
*/
this.operation = new JsonOperation_js_1.JsonOperation();
/**
* List of children JsonEntityStore (properties or methods or params)
*/
this.children = new Map();
const { beforeMiddlewares = [], middlewares = [], afterMiddlewares = [] } = options;

@@ -32,0 +32,0 @@ this.after(afterMiddlewares);

@@ -9,8 +9,9 @@ "use strict";

class JsonOperation extends JsonMap_js_1.JsonMap {
$kind = "operation";
operationPaths = new Map();
#status;
#redirection = false;
#redirection;
constructor(obj = {}) {
super({ parameters: [], responses: new JsonMap_js_1.JsonMap(), ...obj });
this.$kind = "operation";
this.operationPaths = new Map();
this.#redirection = false;
}

@@ -17,0 +18,0 @@ get response() {

@@ -5,4 +5,8 @@ "use strict";

class JsonOperationPathsMap extends Map {
$kind = "operationPaths";
$isJsonDocument = true;
constructor() {
super(...arguments);
this.$kind = "operationPaths";
this.$isJsonDocument = true;
this.getKey = (method, path) => `${method}-${path}`;
}
setOperationPath(operationPath) {

@@ -14,5 +18,4 @@ // if (operationPath.method !== OperationVerbs.CUSTOM) {

}
getKey = (method, path) => `${method}-${path}`;
}
exports.JsonOperationPathsMap = JsonOperationPathsMap;
//# sourceMappingURL=JsonOperationPathsMap.js.map

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

class JsonOperationRoute {
token;
endpoint;
operationPath;
basePath;
paramsTypes;
constructor(options) {

@@ -13,0 +8,0 @@ Object.assign(this, options);

@@ -8,8 +8,7 @@ "use strict";

class JsonParameter extends JsonMap_js_1.JsonMap {
$kind = "operationInParameter";
nestedGenerics = [];
groups;
groupsName;
$schema;
expression;
constructor() {
super(...arguments);
this.$kind = "operationInParameter";
this.nestedGenerics = [];
}
getName() {

@@ -16,0 +15,0 @@ const name = this.get("name");

@@ -11,16 +11,9 @@ "use strict";

let JsonParameterStore = class JsonParameterStore extends JsonEntityStore_js_1.JsonEntityStore {
paramType;
expression;
dataPath;
/**
* Define pipes can be called by the framework to transform input parameter
*/
pipes;
/**
* Ref to JsonParameter when the decorated object is a parameter.
*/
parameter = new JsonParameter_js_1.JsonParameter();
parent = JsonEntityStore_js_1.JsonEntityStore.fromMethod(this.target, this.propertyKey);
constructor(options) {
super(options);
/**
* Ref to JsonParameter when the decorated object is a parameter.
*/
this.parameter = new JsonParameter_js_1.JsonParameter();
this.parent = JsonEntityStore_js_1.JsonEntityStore.fromMethod(this.target, this.propertyKey);
this.pipes = options.pipes || [];

@@ -27,0 +20,0 @@ this.paramType = options.paramType || this.paramType;

@@ -10,3 +10,6 @@ "use strict";

let JsonPropertyStore = class JsonPropertyStore extends JsonEntityStore_js_1.JsonEntityStore {
parent = JsonEntityStore_js_1.JsonEntityStore.from(this.target);
constructor() {
super(...arguments);
this.parent = JsonEntityStore_js_1.JsonEntityStore.from(this.target);
}
/**

@@ -13,0 +16,0 @@ * Return the required state.

@@ -7,5 +7,5 @@ "use strict";

class JsonRequestBody extends JsonMap_js_1.JsonMap {
$kind = "operationRequestBody";
constructor(obj = {}) {
super(obj);
this.$kind = "operationRequestBody";
this.content(obj.content || {});

@@ -12,0 +12,0 @@ }

@@ -9,6 +9,5 @@ "use strict";

class JsonResponse extends JsonMap_js_1.JsonMap {
$kind = "operationResponse";
status;
constructor(obj = {}) {
super(obj);
this.$kind = "operationResponse";
this.content(obj.content || {});

@@ -15,0 +14,0 @@ }

@@ -42,24 +42,30 @@ "use strict";

class JsonSchema extends Map {
$kind = "schema";
$isJsonDocument = true;
$hooks = new core_1.Hooks();
$required = new Set();
$allow = [];
$selfRequired;
$forwardGroups = false;
$ignore = false;
isDiscriminatorKey = false;
isDiscriminator = false;
#nullable = false;
#discriminator = null;
#nullable;
#discriminator;
#genericLabels;
#nestedGenerics = [];
#alias = new Map();
#nestedGenerics;
#alias;
#itemSchema;
#target;
#isGeneric = false;
#isCollection = false;
#ref = false;
#isGeneric;
#isCollection;
#ref;
constructor(obj = {}) {
super();
this.$kind = "schema";
this.$isJsonDocument = true;
this.$hooks = new core_1.Hooks();
this.$required = new Set();
this.$allow = [];
this.$forwardGroups = false;
this.$ignore = false;
this.isDiscriminatorKey = false;
this.isDiscriminator = false;
this.#nullable = false;
this.#discriminator = null;
this.#nestedGenerics = [];
this.#alias = new Map();
this.#isGeneric = false;
this.#isCollection = false;
this.#ref = false;
if (obj) {

@@ -66,0 +72,0 @@ this.assign(obj);

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

class Converter {
spec;
constructor(spec) {

@@ -129,0 +128,0 @@ this.spec = JSON.parse(JSON.stringify(spec));

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

class OperationDecoratorContext extends DecoratorContext {
methods = ["name", "description", "summary", "method", "id", "use", "useAfter", "useBefore"];
constructor() {
super(...arguments);
this.methods = ["name", "description", "summary", "method", "id", "use", "useAfter", "useBefore"];
}
beforeInit() {

@@ -8,0 +11,0 @@ const path = this.get("path");

@@ -29,26 +29,25 @@ import { decorateMethodsOf, decoratorTypeOf, DecoratorTypes, isArray, isCollection, isObject, isPlainObject, isPrimitiveOrPrimitiveClass, isString } from "@tsed/core";

class ReturnDecoratorContext extends DecoratorContext {
methods = [
"contentType",
"description",
"examples",
"type",
"status",
"of",
"ofInteger",
"oneOf",
"allOf",
"anyOf",
"nested",
"header",
"headers",
"schema",
"title",
"groups",
"allowedGroups",
"location",
"binary"
];
hasOfTypes;
constructor({ status, model }) {
super();
this.methods = [
"contentType",
"description",
"examples",
"type",
"status",
"of",
"ofInteger",
"oneOf",
"allOf",
"anyOf",
"nested",
"header",
"headers",
"schema",
"title",
"groups",
"allowedGroups",
"location",
"binary"
];
this.model(model);

@@ -55,0 +54,0 @@ this.status(status);

@@ -8,8 +8,5 @@ import { DecoratorTypes } from "@tsed/core";

export class DecoratorContext extends Map {
methods;
decoratorType;
entity;
actions = [];
constructor(opts = {}) {
super();
this.actions = [];
Object.entries(opts).forEach(([key, value]) => {

@@ -16,0 +13,0 @@ this.set(key, value);

@@ -7,6 +7,9 @@ import { __decorate } from "tslib";

let JsonClassStore = class JsonClassStore extends JsonEntityStore {
/**
* List of children JsonEntityStore (properties or methods or params)
*/
children = new Map();
constructor() {
super(...arguments);
/**
* List of children JsonEntityStore (properties or methods or params)
*/
this.children = new Map();
}
get path() {

@@ -13,0 +16,0 @@ return this.store.get("path", "/");

import { cleanObject } from "@tsed/core";
export class Discriminator {
propertyName;
base;
values = new Map();
types = new Map();
constructor({ base, propertyName, types, values } = {}) {
this.values = new Map();
this.types = new Map();
Object.assign(this, cleanObject({

@@ -9,0 +7,0 @@ base,

@@ -7,40 +7,4 @@ import { ancestorsOf, classOf, decoratorTypeOf, descriptorOf, isArrayOrArrayClass, isArrowFn, isClass, isClassObject, isCollection, isDate, isObject, isPlainObject, isPrimitiveOrPrimitiveClass, nameOf, prototypeOf, Store } from "@tsed/core";

export class JsonEntityStore {
/**
* Original property key decorated by the decorator
*/
propertyKey;
/**
* Alias of the property
*/
propertyName;
/**
* Parameter index
*/
index;
/**
* Method's descriptor
*/
descriptor;
/**
* Decorator type used to declare the JsonSchemaStore.
*/
decoratorType;
/**
* Type of the collection (Array, Map, Set, etc...)
*/
collectionType;
token;
store;
isStore = true;
parent;
target;
/**
*
*/
_type;
/**
* Ref to JsonSchema
*/
_schema;
constructor(options) {
this.isStore = true;
const { target, propertyKey, descriptor, index, decoratorType } = options;

@@ -47,0 +11,0 @@ this.target = target;

import { nameOf } from "@tsed/core";
import { getJsonEntityStore } from "../utils/getJsonEntityStore.js";
export class JsonLazyRef {
getType;
isLazyRef = true;
constructor(getType) {
this.getType = getType;
this.isLazyRef = true;
}

@@ -9,0 +8,0 @@ get target() {

import { isFunction } from "@tsed/core";
import { execMapper } from "../registries/JsonSchemaMapperContainer.js";
export class JsonMap extends Map {
$kind = "map";
$isJsonDocument = true;
constructor(obj = {}) {
super();
this.$kind = "map";
this.$isJsonDocument = true;
this.assign(obj);

@@ -9,0 +9,0 @@ }

import { JsonMap } from "./JsonMap.js";
export class JsonMedia extends JsonMap {
$kind = "operationMedia";
groups = [];
groupsName;
allowedGroups;
constructor() {
super(...arguments);
this.$kind = "operationMedia";
this.groups = [];
}
schema(schema) {

@@ -8,0 +9,0 @@ this.set("schema", schema);

@@ -8,14 +8,2 @@ import { __decorate, __metadata } from "tslib";

let JsonMethodStore = class JsonMethodStore extends JsonEntityStore {
parent = JsonEntityStore.from(this.target);
middlewares = [];
beforeMiddlewares = [];
afterMiddlewares = [];
/**
* Ref to JsonOperation when the decorated object is a method.
*/
operation = new JsonOperation();
/**
* List of children JsonEntityStore (properties or methods or params)
*/
children = new Map();
constructor(options) {

@@ -27,2 +15,14 @@ super({

});
this.parent = JsonEntityStore.from(this.target);
this.middlewares = [];
this.beforeMiddlewares = [];
this.afterMiddlewares = [];
/**
* Ref to JsonOperation when the decorated object is a method.
*/
this.operation = new JsonOperation();
/**
* List of children JsonEntityStore (properties or methods or params)
*/
this.children = new Map();
const { beforeMiddlewares = [], middlewares = [], afterMiddlewares = [] } = options;

@@ -29,0 +29,0 @@ this.after(afterMiddlewares);

@@ -6,8 +6,9 @@ import { deepMerge, uniq, uniqBy } from "@tsed/core";

export class JsonOperation extends JsonMap {
$kind = "operation";
operationPaths = new Map();
#status;
#redirection = false;
#redirection;
constructor(obj = {}) {
super({ parameters: [], responses: new JsonMap(), ...obj });
this.$kind = "operation";
this.operationPaths = new Map();
this.#redirection = false;
}

@@ -14,0 +15,0 @@ get response() {

export class JsonOperationPathsMap extends Map {
$kind = "operationPaths";
$isJsonDocument = true;
constructor() {
super(...arguments);
this.$kind = "operationPaths";
this.$isJsonDocument = true;
this.getKey = (method, path) => `${method}-${path}`;
}
setOperationPath(operationPath) {

@@ -10,4 +14,3 @@ // if (operationPath.method !== OperationVerbs.CUSTOM) {

}
getKey = (method, path) => `${method}-${path}`;
}
//# sourceMappingURL=JsonOperationPathsMap.js.map
import { concatPath } from "../utils/concatPath.js";
export class JsonOperationRoute {
token;
endpoint;
operationPath;
basePath;
paramsTypes;
constructor(options) {

@@ -9,0 +4,0 @@ Object.assign(this, options);

@@ -5,8 +5,7 @@ import { execMapper } from "../registries/JsonSchemaMapperContainer.js";

export class JsonParameter extends JsonMap {
$kind = "operationInParameter";
nestedGenerics = [];
groups;
groupsName;
$schema;
expression;
constructor() {
super(...arguments);
this.$kind = "operationInParameter";
this.nestedGenerics = [];
}
getName() {

@@ -13,0 +12,0 @@ const name = this.get("name");

@@ -8,16 +8,9 @@ import { __decorate, __metadata } from "tslib";

let JsonParameterStore = class JsonParameterStore extends JsonEntityStore {
paramType;
expression;
dataPath;
/**
* Define pipes can be called by the framework to transform input parameter
*/
pipes;
/**
* Ref to JsonParameter when the decorated object is a parameter.
*/
parameter = new JsonParameter();
parent = JsonEntityStore.fromMethod(this.target, this.propertyKey);
constructor(options) {
super(options);
/**
* Ref to JsonParameter when the decorated object is a parameter.
*/
this.parameter = new JsonParameter();
this.parent = JsonEntityStore.fromMethod(this.target, this.propertyKey);
this.pipes = options.pipes || [];

@@ -24,0 +17,0 @@ this.paramType = options.paramType || this.paramType;

@@ -7,3 +7,6 @@ import { __decorate } from "tslib";

let JsonPropertyStore = class JsonPropertyStore extends JsonEntityStore {
parent = JsonEntityStore.from(this.target);
constructor() {
super(...arguments);
this.parent = JsonEntityStore.from(this.target);
}
/**

@@ -10,0 +13,0 @@ * Return the required state.

import { toJsonMapCollection } from "../utils/toJsonMapCollection.js";
import { JsonMap } from "./JsonMap.js";
export class JsonRequestBody extends JsonMap {
$kind = "operationRequestBody";
constructor(obj = {}) {
super(obj);
this.$kind = "operationRequestBody";
this.content(obj.content || {});

@@ -8,0 +8,0 @@ }

@@ -6,6 +6,5 @@ import { mapHeaders } from "../utils/mapHeaders.js";

export class JsonResponse extends JsonMap {
$kind = "operationResponse";
status;
constructor(obj = {}) {
super(obj);
this.$kind = "operationResponse";
this.content(obj.content || {});

@@ -12,0 +11,0 @@ }

@@ -39,24 +39,30 @@ import { ancestorsOf, classOf, Hooks, isArray, isClass, isFunction, isObject, isPrimitiveClass, nameOf, uniq } from "@tsed/core";

export class JsonSchema extends Map {
$kind = "schema";
$isJsonDocument = true;
$hooks = new Hooks();
$required = new Set();
$allow = [];
$selfRequired;
$forwardGroups = false;
$ignore = false;
isDiscriminatorKey = false;
isDiscriminator = false;
#nullable = false;
#discriminator = null;
#nullable;
#discriminator;
#genericLabels;
#nestedGenerics = [];
#alias = new Map();
#nestedGenerics;
#alias;
#itemSchema;
#target;
#isGeneric = false;
#isCollection = false;
#ref = false;
#isGeneric;
#isCollection;
#ref;
constructor(obj = {}) {
super();
this.$kind = "schema";
this.$isJsonDocument = true;
this.$hooks = new Hooks();
this.$required = new Set();
this.$allow = [];
this.$forwardGroups = false;
this.$ignore = false;
this.isDiscriminatorKey = false;
this.isDiscriminator = false;
this.#nullable = false;
this.#discriminator = null;
this.#nestedGenerics = [];
this.#alias = new Map();
this.#isGeneric = false;
this.#isCollection = false;
this.#ref = false;
if (obj) {

@@ -63,0 +69,0 @@ this.assign(obj);

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

export class Converter {
spec;
constructor(spec) {

@@ -125,0 +124,0 @@ this.spec = JSON.parse(JSON.stringify(spec));

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

"type": "commonjs",
"version": "7.82.2",
"version": "7.82.3",
"source": "./src/index.ts",

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

"dependencies": {
"@tsed/openspec": "7.82.2",
"@tsed/openspec": "7.82.3",
"change-case": "^4.1.2",

@@ -52,6 +52,6 @@ "fs-extra": "^11.2.0",

"@apidevtools/swagger-parser": "10.1.0",
"@tsed/barrels": "7.82.2",
"@tsed/core": "7.82.2",
"@tsed/openspec": "7.82.2",
"@tsed/typescript": "7.82.2",
"@tsed/barrels": "7.82.3",
"@tsed/core": "7.82.3",
"@tsed/openspec": "7.82.3",
"@tsed/typescript": "7.82.3",
"@types/fs-extra": "11.0.4",

@@ -67,4 +67,4 @@ "@types/json-schema": "7.0.15",

"peerDependencies": {
"@tsed/core": "7.82.2",
"@tsed/openspec": "7.82.2"
"@tsed/core": "7.82.3",
"@tsed/openspec": "7.82.3"
},

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

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

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

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

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

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

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

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

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

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

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

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