@tsed/mongoose 6.102.4 → 6.102.8-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/lib/cjs/package.json +3 -0
  2. package/lib/esm/MongooseModule.js +2 -2
  3. package/lib/esm/decorators/auto.js +1 -1
  4. package/lib/esm/decorators/discriminatorKey.js +2 -2
  5. package/lib/esm/decorators/dynamicRef.js +1 -1
  6. package/lib/esm/decorators/excludeIndexes.js +1 -1
  7. package/lib/esm/decorators/expires.js +1 -1
  8. package/lib/esm/decorators/immutable.js +1 -1
  9. package/lib/esm/decorators/index.js +26 -26
  10. package/lib/esm/decorators/indexed.js +1 -1
  11. package/lib/esm/decorators/lowercase.js +1 -1
  12. package/lib/esm/decorators/model.js +3 -3
  13. package/lib/esm/decorators/mongooseIndex.js +1 -1
  14. package/lib/esm/decorators/mongooseIndexes.js +1 -1
  15. package/lib/esm/decorators/mongoosePlugin.js +1 -1
  16. package/lib/esm/decorators/numberDecimal.js +1 -1
  17. package/lib/esm/decorators/postHook.js +1 -1
  18. package/lib/esm/decorators/preHook.js +1 -1
  19. package/lib/esm/decorators/ref.js +3 -3
  20. package/lib/esm/decorators/schema.js +2 -2
  21. package/lib/esm/decorators/schemaIgnore.js +1 -1
  22. package/lib/esm/decorators/select.js +1 -1
  23. package/lib/esm/decorators/sparse.js +1 -1
  24. package/lib/esm/decorators/text.js +1 -1
  25. package/lib/esm/decorators/trim.js +1 -1
  26. package/lib/esm/decorators/unique.js +1 -1
  27. package/lib/esm/decorators/uppercase.js +1 -1
  28. package/lib/esm/decorators/versionKey.js +1 -1
  29. package/lib/esm/decorators/virtualRef.js +2 -2
  30. package/lib/esm/index.js +6 -6
  31. package/lib/esm/interfaces/index.js +6 -6
  32. package/lib/esm/package.json +3 -0
  33. package/lib/esm/services/MongooseConnections.js +1 -1
  34. package/lib/esm/utils/createModel.js +3 -3
  35. package/lib/esm/utils/createSchema.js +3 -3
  36. package/lib/esm/utils/index.js +2 -2
  37. package/lib/esm/utils/resolveRefType.js +1 -1
  38. package/lib/esm/utils/schemaOptions.js +1 -1
  39. package/package.json +13 -12
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -1,8 +1,8 @@
1
1
  import { __decorate, __metadata, __param } from "tslib";
2
2
  import { Configuration } from "@tsed/di";
3
3
  import { Module } from "@tsed/di";
4
- import { MONGOOSE_CONNECTIONS } from "./services/MongooseConnections";
5
- import { MongooseService } from "./services/MongooseService";
4
+ import { MONGOOSE_CONNECTIONS } from "./services/MongooseConnections.js";
5
+ import { MongooseService } from "./services/MongooseService.js";
6
6
  /**
7
7
  * @ignore
8
8
  */
@@ -1,4 +1,4 @@
1
- import { MongooseSchema } from "./schema";
1
+ import { MongooseSchema } from "./schema.js";
2
2
  /**
3
3
  * If true, uses Mongoose's default _id settings. Only allowed for ObjectIds
4
4
  *
@@ -1,6 +1,6 @@
1
1
  import { Store, useDecorators } from "@tsed/core";
2
- import { MONGOOSE_SCHEMA_OPTIONS } from "../constants";
3
- import { SchemaIgnore } from "./schemaIgnore";
2
+ import { MONGOOSE_SCHEMA_OPTIONS } from "../constants.js";
3
+ import { SchemaIgnore } from "./schemaIgnore.js";
4
4
  import { Property } from "@tsed/schema";
5
5
  export function DiscriminatorKey() {
6
6
  return useDecorators(Property(), SchemaIgnore(), (target, propertyKey) => {
@@ -1,7 +1,7 @@
1
1
  import { StoreMerge, useDecorators } from "@tsed/core";
2
2
  import { Description, Example, Property } from "@tsed/schema";
3
3
  import { Schema as MongooseSchema } from "mongoose";
4
- import { MONGOOSE_SCHEMA } from "../constants";
4
+ import { MONGOOSE_SCHEMA } from "../constants.js";
5
5
  /**
6
6
  * Define a property as mongoose reference to other Model (decorated with @Model).
7
7
  *
@@ -1,4 +1,4 @@
1
- import { MongooseSchema } from "./schema";
1
+ import { MongooseSchema } from "./schema.js";
2
2
  /**
3
3
  * If true, Mongoose will skip gathering indexes on subpaths. Only allowed for subdocuments and subdocument arrays.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { MongooseSchema } from "./schema";
1
+ import { MongooseSchema } from "./schema.js";
2
2
  /**
3
3
  * Defines a TTL index on this path. Only allowed for dates.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { MongooseSchema } from "./schema";
1
+ import { MongooseSchema } from "./schema.js";
2
2
  /**
3
3
  * If [truthy](https://masteringjs.io/tutorials/fundamentals/truthy), Mongoose will
4
4
  * disallow changes to this path once the document is saved to the database for the first time. Read more
@@ -1,27 +1,27 @@
1
- export * from "./auto";
2
- export * from "./discriminatorKey";
3
- export * from "./dynamicRef";
4
- export * from "./excludeIndexes";
5
- export * from "./expires";
6
- export * from "./immutable";
7
- export * from "./indexed";
8
- export * from "./lowercase";
9
- export * from "./model";
10
- export * from "./mongooseIndex";
11
- export * from "./mongoosePlugin";
12
- export * from "./numberDecimal";
13
- export * from "./objectID";
14
- export * from "./postHook";
15
- export * from "./preHook";
16
- export * from "./ref";
17
- export * from "./schema";
18
- export * from "./schemaIgnore";
19
- export * from "./select";
20
- export * from "./sparse";
21
- export * from "./text";
22
- export * from "./trim";
23
- export * from "./unique";
24
- export * from "./uppercase";
25
- export * from "./versionKey";
26
- export * from "./virtualRef";
1
+ export * from "./auto.js";
2
+ export * from "./discriminatorKey.js";
3
+ export * from "./dynamicRef.js";
4
+ export * from "./excludeIndexes.js";
5
+ export * from "./expires.js";
6
+ export * from "./immutable.js";
7
+ export * from "./indexed.js";
8
+ export * from "./lowercase.js";
9
+ export * from "./model.js";
10
+ export * from "./mongooseIndex.js";
11
+ export * from "./mongoosePlugin.js";
12
+ export * from "./numberDecimal.js";
13
+ export * from "./objectID.js";
14
+ export * from "./postHook.js";
15
+ export * from "./preHook.js";
16
+ export * from "./ref.js";
17
+ export * from "./schema.js";
18
+ export * from "./schemaIgnore.js";
19
+ export * from "./select.js";
20
+ export * from "./sparse.js";
21
+ export * from "./text.js";
22
+ export * from "./trim.js";
23
+ export * from "./unique.js";
24
+ export * from "./uppercase.js";
25
+ export * from "./versionKey.js";
26
+ export * from "./virtualRef.js";
27
27
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { MongooseSchema } from "./schema";
1
+ import { MongooseSchema } from "./schema.js";
2
2
  /**
3
3
  * Tell Mongoose whether to define an index for the property.
4
4
  * ### Example
@@ -1,4 +1,4 @@
1
- import { MongooseSchema } from "./schema";
1
+ import { MongooseSchema } from "./schema.js";
2
2
  /**
3
3
  * If truthy, Mongoose will add a custom setter that lowercases this string using JavaScript's built-in String#toLowerCase().
4
4
  *
@@ -1,7 +1,7 @@
1
1
  import { registerProvider } from "@tsed/di";
2
- import { MONGOOSE_CONNECTIONS } from "../services/MongooseConnections";
3
- import { createModel, getModelToken, getSchema } from "../utils";
4
- import { applySchemaOptions, schemaOptions } from "../utils/schemaOptions";
2
+ import { MONGOOSE_CONNECTIONS } from "../services/MongooseConnections.js";
3
+ import { createModel, getModelToken, getSchema } from "../utils.js";
4
+ import { applySchemaOptions, schemaOptions } from "../utils/schemaOptions.js";
5
5
  /**
6
6
  * Define a class as a Mongoose Model. The model can be injected to the Service, Controller, Middleware, Converters or Filter with
7
7
  * `@Inject` annotation.
@@ -1,4 +1,4 @@
1
- import { schemaOptions } from "../utils/schemaOptions";
1
+ import { schemaOptions } from "../utils/schemaOptions.js";
2
2
  /**
3
3
  * Calls schema.index() to define an index (most likely compound) for the schema.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { schemaOptions } from "../utils/schemaOptions";
1
+ import { schemaOptions } from "../utils/schemaOptions.js";
2
2
  /**
3
3
  * Calls schema.index() to define multiple indexes (most likely compound) for the schema.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { schemaOptions } from "../utils/schemaOptions";
1
+ import { schemaOptions } from "../utils/schemaOptions.js";
2
2
  /**
3
3
  *
4
4
  * @param {(schema: "mongoose".Schema, options?: any) => void} plugin
@@ -4,7 +4,7 @@ import { isNumber, isString, StoreMerge, useDecorators } from "@tsed/core";
4
4
  import { OnDeserialize, OnSerialize } from "@tsed/json-mapper";
5
5
  import { Example, Format, Property } from "@tsed/schema";
6
6
  import { Types, Schema as MongooseSchema } from "mongoose";
7
- import { MONGOOSE_SCHEMA } from "../constants";
7
+ import { MONGOOSE_SCHEMA } from "../constants.js";
8
8
  let DecimalFormat = class DecimalFormat {
9
9
  validate(num) {
10
10
  return isString(num) || isNumber(num);
@@ -1,5 +1,5 @@
1
1
  import { decoratorTypeOf, DecoratorTypes } from "@tsed/core";
2
- import { schemaOptions } from "../utils/schemaOptions";
2
+ import { schemaOptions } from "../utils/schemaOptions.js";
3
3
  export function PostHook(method, ...params) {
4
4
  return ((...args) => {
5
5
  let options = params[1];
@@ -1,5 +1,5 @@
1
1
  import { decoratorTypeOf, DecoratorTypes } from "@tsed/core";
2
- import { schemaOptions } from "../utils/schemaOptions";
2
+ import { schemaOptions } from "../utils/schemaOptions.js";
3
3
  /**
4
4
  *
5
5
  * We can simply attach a `@PreHook` decorator to your model class and
@@ -2,9 +2,9 @@ import { isArrowFn, isObject, isString, StoreMerge, useDecorators } from "@tsed/
2
2
  import { OnDeserialize, OnSerialize, serialize } from "@tsed/json-mapper";
3
3
  import { ForwardGroups, JsonEntityFn, lazyRef, matchGroups, OneOf, Property, string } from "@tsed/schema";
4
4
  import { Schema as MongooseSchema } from "mongoose";
5
- import { MONGOOSE_SCHEMA } from "../constants";
6
- import { MongooseSchemaTypes } from "../interfaces/MongooseSchemaTypes";
7
- import { MongooseModels } from "../registries/MongooseModels";
5
+ import { MONGOOSE_SCHEMA } from "../constants.js";
6
+ import { MongooseSchemaTypes } from "../interfaces/MongooseSchemaTypes.js";
7
+ import { MongooseModels } from "../registries/MongooseModels.js";
8
8
  function isRef(value) {
9
9
  return (value && value._bsontype) || isString(value);
10
10
  }
@@ -1,8 +1,8 @@
1
1
  import { decoratorTypeOf, StoreMerge, useDecorators } from "@tsed/core";
2
2
  import { registerProvider } from "@tsed/di";
3
3
  import { Property } from "@tsed/schema";
4
- import { MONGOOSE_SCHEMA } from "../constants";
5
- import { getSchema, getSchemaToken } from "../utils/createSchema";
4
+ import { MONGOOSE_SCHEMA } from "../constants.js";
5
+ import { getSchema, getSchemaToken } from "../utils/createSchema.js";
6
6
  export function Schema(options = {}) {
7
7
  return (...parameters) => {
8
8
  switch (decoratorTypeOf(parameters)) {
@@ -1,4 +1,4 @@
1
- import { MongooseSchema } from "./schema";
1
+ import { MongooseSchema } from "./schema.js";
2
2
  /**
3
3
  * Do not apply this property to schema (create virtual property)
4
4
  *
@@ -1,4 +1,4 @@
1
- import { MongooseSchema } from "./schema";
1
+ import { MongooseSchema } from "./schema.js";
2
2
  /**
3
3
  * Tell Mongoose to set default select() behavior for this path.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { MongooseSchema } from "./schema";
1
+ import { MongooseSchema } from "./schema.js";
2
2
  /**
3
3
  * If [truthy](https://masteringjs.io/tutorials/fundamentals/truthy), Mongoose will
4
4
  * disallow changes to this path once the document is saved to the database for the first time. Read more
@@ -1,4 +1,4 @@
1
- import { MongooseSchema } from "./schema";
1
+ import { MongooseSchema } from "./schema.js";
2
2
  /**
3
3
  * If [truthy](https://masteringjs.io/tutorials/fundamentals/truthy), Mongoose
4
4
  * will build a text index on this path.
@@ -1,4 +1,4 @@
1
- import { MongooseSchema } from "./schema";
1
+ import { MongooseSchema } from "./schema.js";
2
2
  /**
3
3
  * Tell Mongoose to make the property trimmable.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { MongooseSchema } from "./schema";
1
+ import { MongooseSchema } from "./schema.js";
2
2
  /**
3
3
  * Tell Mongoose to ensure a unique index is created for this path.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { MongooseSchema } from "./schema";
1
+ import { MongooseSchema } from "./schema.js";
2
2
  /**
3
3
  * If truthy, Mongoose will add a custom setter that uppercases this string using JavaScript's built-in String#toUpperCase().
4
4
  *
@@ -1,5 +1,5 @@
1
1
  import { Store } from "@tsed/core";
2
- import { MONGOOSE_SCHEMA_OPTIONS } from "../constants";
2
+ import { MONGOOSE_SCHEMA_OPTIONS } from "../constants.js";
3
3
  export function VersionKey() {
4
4
  return (target, propertyKey) => {
5
5
  Store.from(target).merge(MONGOOSE_SCHEMA_OPTIONS, { versionKey: propertyKey });
@@ -1,7 +1,7 @@
1
1
  import { isPlainObject, isString, Store, StoreMerge, useDecorators } from "@tsed/core";
2
2
  import { CollectionOf, Property } from "@tsed/schema";
3
- import { MONGOOSE_MODEL_NAME, MONGOOSE_SCHEMA } from "../constants";
4
- import { MongooseModels } from "../registries/MongooseModels";
3
+ import { MONGOOSE_MODEL_NAME, MONGOOSE_SCHEMA } from "../constants.js";
4
+ import { MongooseModels } from "../registries/MongooseModels.js";
5
5
  function getRef(opts) {
6
6
  const ref = opts.ref || opts.type;
7
7
  return isString(ref) ? ref : Store.from(ref).get(MONGOOSE_MODEL_NAME);
package/lib/esm/index.js CHANGED
@@ -1,7 +1,7 @@
1
- export * from "./interfaces";
2
- export * from "./constants";
3
- export * from "./services/MongooseService";
4
- export * from "./MongooseModule";
5
- export * from "./utils";
6
- export * from "./decorators";
1
+ export * from "./interfaces.js";
2
+ export * from "./constants.js";
3
+ export * from "./services/MongooseService.js";
4
+ export * from "./MongooseModule.js";
5
+ export * from "./utils.js";
6
+ export * from "./decorators.js";
7
7
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
- export * from "./MongooseConnectionOptions";
2
- export * from "./MongooseDocument";
3
- export * from "./MongooseModel";
4
- export * from "./MongooseModelOptions";
5
- export * from "./MongooseSchemaOptions";
6
- export * from "./MongooseVirtualRefOptions";
1
+ export * from "./MongooseConnectionOptions.js";
2
+ export * from "./MongooseDocument.js";
3
+ export * from "./MongooseModel.js";
4
+ export * from "./MongooseModelOptions.js";
5
+ export * from "./MongooseSchemaOptions.js";
6
+ export * from "./MongooseVirtualRefOptions.js";
7
7
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -1,6 +1,6 @@
1
1
  import { Configuration, registerProvider } from "@tsed/di";
2
2
  import { isArray } from "@tsed/core";
3
- import { MongooseService } from "../services/MongooseService";
3
+ import { MongooseService } from "../services/MongooseService.js";
4
4
  /**
5
5
  * @ignore
6
6
  */
@@ -1,8 +1,8 @@
1
1
  import { ancestorsOf, nameOf, Store } from "@tsed/core";
2
2
  import mongoose from "mongoose";
3
- import { MONGOOSE_MODEL, MONGOOSE_MODEL_NAME, MONGOOSE_SCHEMA_OPTIONS } from "../constants";
4
- import { MongooseModels } from "../registries/MongooseModels";
5
- import { getSchemaToken } from "./createSchema";
3
+ import { MONGOOSE_MODEL, MONGOOSE_MODEL_NAME, MONGOOSE_SCHEMA_OPTIONS } from "../constants.js";
4
+ import { MongooseModels } from "../registries/MongooseModels.js";
5
+ import { getSchemaToken } from "./createSchema.js";
6
6
  export function getModelToken(target, options) {
7
7
  const { collectionName, token } = getSchemaToken(target, options);
8
8
  Store.from(target).set(MONGOOSE_MODEL_NAME, collectionName);
@@ -3,9 +3,9 @@ import { deserialize, serialize } from "@tsed/json-mapper";
3
3
  import { getProperties } from "@tsed/schema";
4
4
  import { pascalCase } from "change-case";
5
5
  import mongoose from "mongoose";
6
- import { MONGOOSE_SCHEMA, MONGOOSE_SCHEMA_OPTIONS } from "../constants";
7
- import { resolveRefType } from "./resolveRefType";
8
- import { schemaOptions } from "./schemaOptions";
6
+ import { MONGOOSE_SCHEMA, MONGOOSE_SCHEMA_OPTIONS } from "../constants.js";
7
+ import { resolveRefType } from "./resolveRefType.js";
8
+ import { schemaOptions } from "./schemaOptions.js";
9
9
  const MONGOOSE_RESERVED_KEYS = ["_id"];
10
10
  /**
11
11
  * @ignore
@@ -1,3 +1,3 @@
1
- export * from "./createSchema";
2
- export * from "./createModel";
1
+ export * from "./createSchema.js";
2
+ export * from "./createModel.js";
3
3
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  import { isClass, isString, nameOf, Store } from "@tsed/core";
2
- import { MONGOOSE_MODEL_NAME } from "../constants";
2
+ import { MONGOOSE_MODEL_NAME } from "../constants.js";
3
3
  /**
4
4
  * @ignore
5
5
  */
@@ -1,5 +1,5 @@
1
1
  import { deepMerge, Store } from "@tsed/core";
2
- import { MONGOOSE_SCHEMA_OPTIONS } from "../constants";
2
+ import { MONGOOSE_SCHEMA_OPTIONS } from "../constants.js";
3
3
  /**
4
4
  * @ignore
5
5
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/mongoose",
3
- "version": "6.102.4",
3
+ "version": "6.102.8-rc.1",
4
4
  "description": "Mongoose package for Ts.ED framework",
5
5
  "private": false,
6
6
  "keywords": [
@@ -12,6 +12,7 @@
12
12
  ],
13
13
  "source": "./src/index.ts",
14
14
  "main": "./lib/cjs/index.js",
15
+ "module": "./lib/esm/index.js",
15
16
  "typings": "./lib/types/index.d.ts",
16
17
  "exports": {
17
18
  "types": "./lib/types/index.d.ts",
@@ -30,28 +31,28 @@
30
31
  "tslib": "2.2.0"
31
32
  },
32
33
  "devDependencies": {
33
- "@tsed/ajv": "6.102.4",
34
- "@tsed/core": "6.102.4",
35
- "@tsed/di": "6.102.4",
36
- "@tsed/json-mapper": "6.102.4",
34
+ "@tsed/ajv": "6.102.8-rc.1",
35
+ "@tsed/core": "6.102.8-rc.1",
36
+ "@tsed/di": "6.102.8-rc.1",
37
+ "@tsed/json-mapper": "6.102.8-rc.1",
37
38
  "@tsed/logger": ">=6.0.2",
38
- "@tsed/schema": "6.102.4",
39
+ "@tsed/schema": "6.102.8-rc.1",
39
40
  "mongoose": "^5.12.2"
40
41
  },
41
42
  "peerDependencies": {
42
- "@tsed/ajv": "^6.102.4",
43
- "@tsed/core": "^6.102.4",
44
- "@tsed/di": "^6.102.4",
45
- "@tsed/json-mapper": "^6.102.4",
43
+ "@tsed/ajv": "^6.102.8-rc.1",
44
+ "@tsed/core": "^6.102.8-rc.1",
45
+ "@tsed/di": "^6.102.8-rc.1",
46
+ "@tsed/json-mapper": "^6.102.8-rc.1",
46
47
  "@tsed/logger": ">=6.0.2",
47
- "@tsed/schema": "^6.102.4",
48
+ "@tsed/schema": "^6.102.8-rc.1",
48
49
  "mongoose": ">=5.12.2"
49
50
  },
50
51
  "repository": "https://github.com/tsedio/tsed",
51
52
  "bugs": {
52
53
  "url": "https://github.com/tsedio/tsed/issues"
53
54
  },
54
- "homepage": "https://github.com/tsedio/tsed/tree/production/packages/orm/mongoose",
55
+ "homepage": "https://github.com/tsedio/tsed/tree/rc/packages/orm/mongoose",
55
56
  "author": "Romain Lenzotti",
56
57
  "license": "MIT"
57
58
  }