mongodb-dynamic-api 2.14.2 → 3.0.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 (35) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +745 -69
  3. package/package.json +15 -15
  4. package/src/decorators/api-endpoint-visibility.decorator.js +2 -1
  5. package/src/decorators/api-endpoint-visibility.decorator.js.map +1 -1
  6. package/src/guards/base-policies.guard.d.ts +1 -0
  7. package/src/helpers/repository.helper.d.ts +1 -0
  8. package/src/helpers/schema.helper.d.ts +1 -0
  9. package/src/interfaces/dynamic-api-cache-options.interface.d.ts +2 -2
  10. package/src/interfaces/dynamic-api-global-state.interface.d.ts +1 -0
  11. package/src/interfaces/dynamic-api-policy-handler.interface.d.ts +1 -0
  12. package/src/interfaces/dynamic-api-schema-options.interface.d.ts +1 -0
  13. package/src/interfaces/dynamic-api-service-callback.interface.d.ts +1 -0
  14. package/src/models/base-entity.model.d.ts +1 -0
  15. package/src/modules/auth/auth.module.d.ts +1 -1
  16. package/src/modules/auth/services/base-auth.service.d.ts +1 -0
  17. package/src/modules/auth/strategies/jwt.strategy.d.ts +3 -1
  18. package/src/routes/aggregate/base-aggregate.service.d.ts +1 -0
  19. package/src/routes/create-many/base-create-many.service.d.ts +1 -0
  20. package/src/routes/create-one/base-create-one.service.d.ts +1 -0
  21. package/src/routes/delete-many/base-delete-many.service.d.ts +1 -0
  22. package/src/routes/delete-one/base-delete-one.service.d.ts +1 -0
  23. package/src/routes/duplicate-many/base-duplicate-many.service.d.ts +1 -0
  24. package/src/routes/duplicate-one/base-duplicate-one.service.d.ts +1 -0
  25. package/src/routes/get-many/base-get-many.service.d.ts +1 -0
  26. package/src/routes/get-one/base-get-one.service.d.ts +1 -0
  27. package/src/routes/replace-one/base-replace-one.service.d.ts +1 -0
  28. package/src/routes/update-many/base-update-many.service.d.ts +1 -0
  29. package/src/routes/update-one/base-update-one.service.d.ts +1 -0
  30. package/src/services/base/base.service.d.ts +1 -0
  31. package/src/services/dynamic-api-global-state/dynamic-api-global-state.service.d.ts +2 -1
  32. package/src/version.json +1 -1
  33. package/test/e2e.setup.d.ts +1 -0
  34. package/test/utils.d.ts +2 -1
  35. package/tsconfig.tsbuildinfo +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mongodb-dynamic-api",
3
- "version": "2.14.2",
3
+ "version": "3.0.1",
4
4
  "description": "Auto generated CRUD API for MongoDB using NestJS",
5
5
  "readmeFilename": "README.md",
6
6
  "main": "index.js",
@@ -40,25 +40,25 @@
40
40
  },
41
41
  "homepage": "https://mikedev75015.github.io",
42
42
  "dependencies": {
43
- "@nestjs/cache-manager": "^2.2.1",
44
- "@nestjs/common": "^10.3.2",
45
- "@nestjs/core": "^10.3.2",
46
- "@nestjs/jwt": "^10.2.0",
47
- "@nestjs/mongoose": "^10.0.4",
48
- "@nestjs/passport": "^10.0.3",
49
- "@nestjs/platform-express": "^10.3.2",
50
- "@nestjs/platform-socket.io": "^10.3.8",
51
- "@nestjs/swagger": "^7.3.0",
52
- "@nestjs/websockets": "^10.3.8",
43
+ "@nestjs/cache-manager": "^3.0.1",
44
+ "@nestjs/common": "^11.1.13",
45
+ "@nestjs/core": "^11.1.13",
46
+ "@nestjs/jwt": "^10.0.2",
47
+ "@nestjs/mongoose": "^11.0.4",
48
+ "@nestjs/passport": "^11.0.5",
49
+ "@nestjs/platform-express": "^11.1.13",
50
+ "@nestjs/platform-socket.io": "^11.1.13",
51
+ "@nestjs/swagger": "^11.2.6",
52
+ "@nestjs/websockets": "^11.1.13",
53
53
  "@types/lodash": "^4.14.202",
54
54
  "bcrypt": "^5.1.1",
55
- "cache-manager": "^5.4.0",
55
+ "cache-manager": "^6.1.6",
56
56
  "class-transformer": "^0.5.1",
57
57
  "class-validator": "^0.14.1",
58
58
  "dotenv": "^16.4.5",
59
- "lodash": "^4.17.21",
59
+ "lodash": "4.17.23",
60
60
  "mongodb-pipeline-builder": "^4.0.2",
61
- "mongoose": "^8.1.1",
61
+ "mongoose": "8.9.5",
62
62
  "passport": "^0.7.0",
63
63
  "passport-jwt": "^4.0.1",
64
64
  "passport-local": "^1.0.0",
@@ -84,7 +84,7 @@
84
84
  "@types/supertest": "^6.0.2",
85
85
  "@typescript-eslint/eslint-plugin": "^6.21.0",
86
86
  "@typescript-eslint/parser": "^6.21.0",
87
- "eslint": "^8.56.0",
87
+ "eslint": "9.26.0",
88
88
  "eslint-config-prettier": "^9.1.0",
89
89
  "eslint-plugin-prettier": "^5.1.3",
90
90
  "jest": "^29.7.0",
@@ -4,7 +4,8 @@ exports.ApiEndpointVisibility = void 0;
4
4
  const common_1 = require("@nestjs/common");
5
5
  const swagger_1 = require("@nestjs/swagger");
6
6
  function ApiEndpointVisibility(condition, decorator) {
7
- const decoratorToApply = decorator ?? ((_) => undefined)();
7
+ const noopDecorator = () => { };
8
+ const decoratorToApply = decorator ?? noopDecorator;
8
9
  return (0, common_1.applyDecorators)(!condition ? (0, swagger_1.ApiExcludeEndpoint)() : decoratorToApply);
9
10
  }
10
11
  exports.ApiEndpointVisibility = ApiEndpointVisibility;
@@ -1 +1 @@
1
- {"version":3,"file":"api-endpoint-visibility.decorator.js","sourceRoot":"","sources":["../../../libs/dynamic-api/src/decorators/api-endpoint-visibility.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAkE;AAClE,6CAAqD;AAErD,SAAS,qBAAqB,CAC5B,SAAkB,EAClB,SAA6C;IAE7C,MAAM,gBAAgB,GAAG,SAAS,IAAI,CAAC,CAAC,CAAO,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,CAAA;IAChE,OAAO,IAAA,wBAAe,EAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAA,4BAAkB,GAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;AAC/E,CAAC;AAEQ,sDAAqB"}
1
+ {"version":3,"file":"api-endpoint-visibility.decorator.js","sourceRoot":"","sources":["../../../libs/dynamic-api/src/decorators/api-endpoint-visibility.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAkE;AAClE,6CAAqD;AAErD,SAAS,qBAAqB,CAC5B,SAAkB,EAClB,SAA6C;IAE7C,MAAM,aAAa,GAAoB,GAAG,EAAE,GAAE,CAAC,CAAC;IAChD,MAAM,gBAAgB,GAAG,SAAS,IAAI,aAAa,CAAC;IACpD,OAAO,IAAA,wBAAe,EAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAA,4BAAkB,GAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;AAC/E,CAAC;AAEQ,sDAAqB"}
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { CanActivate, ExecutionContext, Type } from '@nestjs/common';
26
27
  import { PipelineStage } from 'mongodb-pipeline-builder';
27
28
  import { Model } from 'mongoose';
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { Type } from '@nestjs/common';
26
27
  import { GetPagingResultResponse, GetResultResponse, PipelineStage } from 'mongodb-pipeline-builder';
27
28
  import { FilterQuery, QueryOptions } from 'mongoose';
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { Type } from '@nestjs/common';
26
27
  import { Schema } from 'mongoose';
27
28
  declare function buildSchemaFromEntity<Entity>(entity: Type<Entity>): Schema<Entity>;
@@ -1,8 +1,8 @@
1
- import { CacheStore, CacheStoreFactory } from '@nestjs/cache-manager/dist/interfaces/cache-manager.interface';
1
+ import type Keyv from 'keyv';
2
2
  interface DynamicApiCacheOptions {
3
3
  max?: number;
4
4
  ttl?: number;
5
- store?: string | CacheStoreFactory | CacheStore;
5
+ store?: string | Keyv | Keyv[];
6
6
  isCacheableValue?: (value: any) => boolean;
7
7
  excludePaths?: string[];
8
8
  }
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { GatewayMetadata } from '@nestjs/websockets';
26
27
  import { Schema } from 'mongoose';
27
28
  import { RouteType } from './dynamic-api-route-type.type';
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { ExecutionContext } from '@nestjs/common';
26
27
  import { Model } from 'mongoose';
27
28
  import { BaseEntity } from '../models';
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { IndexDefinition, IndexOptions, Schema } from 'mongoose';
26
27
  import { RouteType } from './dynamic-api-route-type.type';
27
28
  type HookEvent = RouteType;
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { Type } from '@nestjs/common';
26
27
  import { PipelineStage } from 'mongodb-pipeline-builder';
27
28
  import { FilterQuery, UpdateQuery, UpdateWithAggregationPipeline } from 'mongoose';
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { ObjectId } from 'mongoose';
26
27
  export declare abstract class BaseEntity {
27
28
  _id: ObjectId;
@@ -3,7 +3,7 @@ import { DynamicApiAuthOptions } from './interfaces';
3
3
  export declare class AuthModule {
4
4
  static forRoot<Entity extends BaseEntity>(options: DynamicApiAuthOptions<Entity>): {
5
5
  module: typeof AuthModule;
6
- imports: (import("@nestjs/common").Type<any> | import("@nestjs/common").DynamicModule | Promise<import("@nestjs/common").DynamicModule> | import("@nestjs/common").ForwardReference<any>)[];
6
+ imports: (import("@nestjs/common").Type<any> | import("@nestjs/common").ForwardReference<any> | import("@nestjs/common").DynamicModule | Promise<import("@nestjs/common").DynamicModule>)[];
7
7
  providers: (import("../../interfaces/dynamic-api-service-provider.interface").DynamicAPIServiceProvider | import("@nestjs/common").Provider)[];
8
8
  controllers: import("@nestjs/common").Type<any>[];
9
9
  };
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { Type } from '@nestjs/common';
26
27
  import { JwtService } from '@nestjs/jwt';
27
28
  import { Model } from 'mongoose';
@@ -1,5 +1,7 @@
1
1
  import { Strategy } from 'passport-jwt';
2
- declare const JwtStrategy_base: new (...args: any[]) => Strategy;
2
+ declare const JwtStrategy_base: new (...args: [opt: import("passport-jwt").StrategyOptionsWithRequest] | [opt: import("passport-jwt").StrategyOptionsWithoutRequest]) => Strategy & {
3
+ validate(...args: any[]): unknown;
4
+ };
3
5
  export declare class JwtStrategy extends JwtStrategy_base {
4
6
  protected loginField: string;
5
7
  constructor();
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { Type } from '@nestjs/common';
26
27
  import { PipelineStage } from 'mongodb-pipeline-builder';
27
28
  import { Model } from 'mongoose';
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { Type } from '@nestjs/common';
26
27
  import { Model } from 'mongoose';
27
28
  import { DynamicApiServiceCallback } from '../../interfaces';
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { Model } from 'mongoose';
26
27
  import { DynamicApiServiceBeforeSaveCallback, DynamicApiServiceBeforeSaveCreateContext, DynamicApiServiceCallback } from '../../interfaces';
27
28
  import { BaseEntity } from '../../models';
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { Model } from 'mongoose';
26
27
  import { DeletePresenter } from '../../dtos';
27
28
  import { BaseEntity } from '../../models';
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { Model } from 'mongoose';
26
27
  import { DeletePresenter } from '../../dtos';
27
28
  import { BaseEntity } from '../../models';
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { Type } from '@nestjs/common';
26
27
  import { Model } from 'mongoose';
27
28
  import { DynamicApiServiceCallback } from '../../interfaces';
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { Type } from '@nestjs/common';
26
27
  import { Model } from 'mongoose';
27
28
  import { DynamicApiServiceCallback } from '../../interfaces';
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { Model } from 'mongoose';
26
27
  import { DynamicApiServiceCallback } from '../../interfaces';
27
28
  import { BaseEntity } from '../../models';
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { Model } from 'mongoose';
26
27
  import { DynamicApiServiceCallback } from '../../interfaces';
27
28
  import { BaseEntity } from '../../models';
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { Type } from '@nestjs/common';
26
27
  import { Model } from 'mongoose';
27
28
  import { DynamicApiServiceCallback } from '../../interfaces';
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { Model } from 'mongoose';
26
27
  import { DynamicApiServiceCallback } from '../../interfaces';
27
28
  import { BaseEntity } from '../../models';
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { Model } from 'mongoose';
26
27
  import { DynamicApiServiceBeforeSaveCallback, DynamicApiServiceBeforeSaveUpdateContext, DynamicApiServiceCallback } from '../../interfaces';
27
28
  import { BaseEntity } from '../../models';
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { Type } from '@nestjs/common';
26
27
  import { PipelineStage } from 'mongodb-pipeline-builder';
27
28
  import { FilterQuery, Model, Schema, UpdateQuery, UpdateWithAggregationPipeline } from 'mongoose';
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { Type } from '@nestjs/common';
26
27
  import { Model, Schema } from 'mongoose';
27
28
  import { BehaviorSubject } from 'rxjs';
@@ -35,7 +36,7 @@ export declare class DynamicApiGlobalStateService {
35
36
  constructor(initialGlobalState?: Partial<DynamicApiGlobalState>);
36
37
  static onInitialized(): BehaviorSubject<boolean>;
37
38
  static addEntitySchema<T = any>(entity: Type<T>, schema: Schema<T>): void;
38
- static getEntityModel<T = any>(entity: Type<T>): Promise<Model<T, {}, {}, {}, import("mongoose").IfAny<T, any, import("mongoose").Document<unknown, {}, T> & import("mongoose").Require_id<T>>, any>>;
39
+ static getEntityModel<T = any>(entity: Type<T>): Promise<Model<T, {}, {}, {}, import("mongoose").IfAny<T, any, import("mongoose").Document<unknown, {}, T> & import("mongoose").Default__v<import("mongoose").Require_id<T>>>, any>>;
39
40
  set<V>([target, value]: ([keyof DynamicApiGlobalState, value: V] | ['partial', Partial<DynamicApiGlobalState>])): void;
40
41
  get<T = DynamicApiGlobalState>(key?: keyof DynamicApiGlobalState): T;
41
42
  private resetState;
package/src/version.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "2.14.2"
2
+ "version": "3.0.1"
3
3
  }
@@ -23,6 +23,7 @@
23
23
  /// <reference types="mongoose/types/validation" />
24
24
  /// <reference types="mongoose/types/virtuals" />
25
25
  /// <reference types="mongoose/types/inferschematype" />
26
+ /// <reference types="mongoose/types/inferrawdoctype" />
26
27
  import { INestApplication } from '@nestjs/common';
27
28
  import { TestingModule } from '@nestjs/testing';
28
29
  import mongoose from 'mongoose';
package/test/utils.d.ts CHANGED
@@ -22,7 +22,8 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
25
26
  import { Type } from '@nestjs/common';
26
27
  import { Model } from 'mongoose';
27
28
  export declare const wait: (ms: number) => Promise<unknown>;
28
- export declare const getModelFromEntity: <Entity>(entity: Type<Entity>) => Promise<Model<Entity, {}, {}, {}, import("mongoose").IfAny<Entity, any, import("mongoose").Document<unknown, {}, Entity> & import("mongoose").Require_id<Entity>>, any>>;
29
+ export declare const getModelFromEntity: <Entity>(entity: Type<Entity>) => Promise<Model<Entity, {}, {}, {}, import("mongoose").IfAny<Entity, any, import("mongoose").Document<unknown, {}, Entity> & import("mongoose").Default__v<import("mongoose").Require_id<Entity>>>, any>>;