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

@travetto/model

Package Overview
Dependencies
Maintainers
1
Versions
371
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@travetto/model - npm Package Compare versions

Comparing version 0.0.21 to 0.0.22

2

package.json

@@ -23,3 +23,3 @@ {

},
"version": "0.0.21"
"version": "0.0.22"
}

@@ -9,6 +9,6 @@ export type Point = [number, number];

(T[K] extends (Primitive | undefined) ? K :
(T[K] extends (...args: any[]) => any ? never :
(T[K] extends (Function | undefined) ? never :
K))
}[keyof T];
export type RetainFields<T> = Pick<T, ValidFieldNames<T>>;
export type RetainFields<T> = Pick<T, ValidFieldNames<T>>;

@@ -44,3 +44,3 @@ import { RetainFields, Point } from './common';

type _PropWhereClause<T> = {
export type PropWhereClause<T> = {
[P in keyof T]?:

@@ -53,3 +53,3 @@ (T[P] extends (number | undefined) ? ComparableFieldQuery<number> | number :

(T[P] extends ((infer U)[] | undefined) ? ArrayFieldQuery<U> :
(T[P] extends (object | undefined) ? _PropWhereClause<RetainFields<T[P]>> : never)))))));
(T[P] extends (object | undefined) ? PropWhereClause<RetainFields<T[P]>> : never)))))));
}

@@ -61,4 +61,4 @@

({ $not: _WhereClause<T>; } & { [P in keyof T]?: never }) |
(_PropWhereClause<T> & { $and?: never; $or?: never; $not?: never });
(PropWhereClause<T> & { $and?: never; $or?: never; $not?: never });
export type WhereClause<T> = _WhereClause<RetainFields<T>>;

@@ -40,3 +40,3 @@ import { ModelSource, Query, BulkResponse, BulkState, QueryOptions, ModelService, ModelCore, ModelQuery, PageableModelQuery } from '../index';

}
query<T extends ModelCore, U>(cls: Class<T>, builder: Query<T>): U[] {
query<T extends ModelCore, U>(cls: Class<T>, builder: Query<T>): Promise<U[]> {
throw new Error('Method not implemented.');

@@ -43,0 +43,0 @@ }

import { Suite, Test, BeforeAll } from '@travetto/test';
import { Model, ModelQuery } from '..';
import { Model, ModelQuery, ModelCore, WhereClause, BaseModel, PropWhereClause } from '..';
import { Schema, SchemaRegistry } from '@travetto/schema';

@@ -7,2 +7,3 @@ import { DependencyRegistry } from '@travetto/di';

import { RetainFields } from '../src/model/query/common';
import { Class } from '@travetto/registry';

@@ -22,2 +23,7 @@ @Schema()

@Model()
class ModelUser extends BaseModel {
}
@Suite()

@@ -33,2 +39,22 @@ export class VerifyTest {

@Test()
async verifyModelCore() {
const verifier = await DependencyRegistry.getInstance(QueryVerifierService);
const t2: PropWhereClause<RetainFields<ModelCore>> = {
}
const test = <T extends ModelCore>(cls: Class<T>) => {
const t: WhereClause<ModelCore> = {
id: {
$eq: '5'
},
};
verifier.verify(User, t);
}
test(ModelUser);
}
@Test()
async verifyNested() {

@@ -35,0 +61,0 @@ const verifier = await DependencyRegistry.getInstance(QueryVerifierService);

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