Skip to content

Commit

Permalink
fix: Export schema only once (#736)
Browse files Browse the repository at this point in the history
  • Loading branch information
inaiat committed Mar 12, 2024
1 parent 0d545b8 commit fee69db
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { afterEach, beforeEach, describe, expect, jest, test } from '@jest/globa
import { Collection, Db } from 'mongodb';
import Papr from '../index';
import * as model from '../model';
import schema from '../schema';
import { schema } from '../schema';
import types from '../types';
import { VALIDATION_ACTIONS, VALIDATION_LEVEL } from '../utils';

Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { expectType } from 'ts-expect';
import { Hooks } from '../hooks';
import { abstract, build, Model } from '../model';
import { PaprBulkWriteOperation } from '../mongodbTypes';
import schema from '../schema';
import { schema } from '../schema';
import Types from '../types';

describe('model', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/schema.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, test } from '@jest/globals';
import { ObjectId, Binary, Decimal128 } from 'mongodb';
import { expectType } from 'ts-expect';
import schema from '../schema';
import { schema } from '../schema';
import types from '../types';
import { VALIDATION_ACTIONS, VALIDATION_LEVEL } from '../utils';

Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Db } from 'mongodb';
import { abstract, build, Model } from './model';
import schema, { SchemaOptions } from './schema';
import { SchemaOptions } from './schema';
import types from './types';
import { BaseSchema, ModelOptions } from './utils';

Expand Down Expand Up @@ -175,7 +175,7 @@ export default class Papr {
}
}

export { schema, types, types as Types };
export { types, types as Types };
export * from './hooks';
export * from './model';
export * from './mongodbTypes';
Expand Down
2 changes: 1 addition & 1 deletion src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function sanitize(value: any): void {
* export type UserDocument = (typeof userSchema)[0];
* export type UserOptions = (typeof userSchema)[1];
*/
export default function schema<
export function schema<
TProperties extends Record<string, unknown>,
TOptions extends SchemaOptions<TProperties>,
>(properties: TProperties, options?: TOptions): [SchemaType<TProperties, TOptions>, TOptions] {
Expand Down

0 comments on commit fee69db

Please sign in to comment.