Comparing version 2.3.0 to 3.0.0
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
import { WithId } from 'mongodb'; | ||
import { ObjectType } from './types'; | ||
import { TimestampSchema, VALIDATION_ACTIONS, VALIDATION_LEVEL } from './utils'; | ||
interface SchemaOptions<TProperties, TDefaults extends Partial<TProperties>> { | ||
defaults?: TDefaults; | ||
interface SchemaOptions<TProperties> { | ||
defaults?: Partial<TProperties>; | ||
timestamps?: boolean; | ||
@@ -10,4 +10,4 @@ validationAction?: VALIDATION_ACTIONS; | ||
} | ||
declare type TimestampsOptions = Required<Pick<SchemaOptions<unknown, any>, 'timestamps'>>; | ||
export declare type SchemaType<TProperties extends Record<string, unknown>, TOptions extends SchemaOptions<unknown, any>> = TOptions extends TimestampsOptions ? ObjectType<WithId<TProperties> & TimestampSchema> : ObjectType<WithId<TProperties>>; | ||
declare type TimestampsOptions = Required<Pick<SchemaOptions<unknown>, 'timestamps'>>; | ||
export declare type SchemaType<TProperties extends Record<string, unknown>, TOptions extends SchemaOptions<unknown>> = TOptions extends TimestampsOptions ? ObjectType<WithId<TProperties> & TimestampSchema> : ObjectType<WithId<TProperties>>; | ||
/** | ||
@@ -66,3 +66,3 @@ * @module intro | ||
*/ | ||
export default function schema<TProperties extends Record<string, unknown>, TDefaults extends Partial<TProperties>, TOptions extends SchemaOptions<TProperties, TDefaults>>(properties: TProperties, options?: TOptions): [SchemaType<TProperties, TOptions>, TDefaults]; | ||
export default function schema<TProperties extends Record<string, unknown>, TOptions extends SchemaOptions<TProperties>, TDefaults extends TOptions['defaults'] = object>(properties: TProperties, options?: TOptions): [SchemaType<TProperties, TOptions>, TDefaults]; | ||
export {}; |
import { WithId } from 'mongodb'; | ||
import { ObjectType } from './types'; | ||
import { TimestampSchema, VALIDATION_ACTIONS, VALIDATION_LEVEL } from './utils'; | ||
interface SchemaOptions<TProperties, TDefaults extends Partial<TProperties>> { | ||
defaults?: TDefaults; | ||
interface SchemaOptions<TProperties> { | ||
defaults?: Partial<TProperties>; | ||
timestamps?: boolean; | ||
@@ -10,4 +10,4 @@ validationAction?: VALIDATION_ACTIONS; | ||
} | ||
declare type TimestampsOptions = Required<Pick<SchemaOptions<unknown, any>, 'timestamps'>>; | ||
export declare type SchemaType<TProperties extends Record<string, unknown>, TOptions extends SchemaOptions<unknown, any>> = TOptions extends TimestampsOptions ? ObjectType<WithId<TProperties> & TimestampSchema> : ObjectType<WithId<TProperties>>; | ||
declare type TimestampsOptions = Required<Pick<SchemaOptions<unknown>, 'timestamps'>>; | ||
export declare type SchemaType<TProperties extends Record<string, unknown>, TOptions extends SchemaOptions<unknown>> = TOptions extends TimestampsOptions ? ObjectType<WithId<TProperties> & TimestampSchema> : ObjectType<WithId<TProperties>>; | ||
/** | ||
@@ -66,3 +66,3 @@ * @module intro | ||
*/ | ||
export default function schema<TProperties extends Record<string, unknown>, TDefaults extends Partial<TProperties>, TOptions extends SchemaOptions<TProperties, TDefaults>>(properties: TProperties, options?: TOptions): [SchemaType<TProperties, TOptions>, TDefaults]; | ||
export default function schema<TProperties extends Record<string, unknown>, TOptions extends SchemaOptions<TProperties>, TDefaults extends TOptions['defaults'] = object>(properties: TProperties, options?: TOptions): [SchemaType<TProperties, TOptions>, TDefaults]; | ||
export {}; |
@@ -5,3 +5,3 @@ { | ||
"author": "Plex Inc.", | ||
"version": "2.3.0", | ||
"version": "3.0.0", | ||
"keywords": [ | ||
@@ -62,3 +62,3 @@ "mongodb", | ||
"@commitlint/config-conventional": "16.2.1", | ||
"@types/jest": "27.0.1", | ||
"@types/jest": "27.4.1", | ||
"@typescript-eslint/eslint-plugin": "4.33.0", | ||
@@ -69,5 +69,5 @@ "@typescript-eslint/parser": "4.33.0", | ||
"eslint": "7.32.0", | ||
"eslint-config-prettier": "8.3.0", | ||
"eslint-config-prettier": "8.5.0", | ||
"eslint-config-standard": "16.0.3", | ||
"eslint-plugin-import": "2.25.2", | ||
"eslint-plugin-import": "2.26.0", | ||
"eslint-plugin-node": "11.1.0", | ||
@@ -81,10 +81,10 @@ "eslint-plugin-prettier": "4.0.0", | ||
"lint-staged": "12.3.4", | ||
"mongodb": "4.4.0", | ||
"mongodb-memory-server": "8.1.0", | ||
"mongodb": "4.5.0", | ||
"mongodb-memory-server": "8.4.0", | ||
"mongoose": "6.0.6", | ||
"prettier": "2.5.0", | ||
"prettier": "2.6.0", | ||
"standard-version": "9.3.0", | ||
"ts-expect": "1.3.0", | ||
"ts-node": "10.4.0", | ||
"typescript": "4.5.2" | ||
"ts-node": "10.7.0", | ||
"typescript": "4.6.2" | ||
}, | ||
@@ -91,0 +91,0 @@ "peerDependencies": { |
168830
4403