@globalart/nestjs-swagger 1.2.7 → 1.2.8

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.
package/dist/index.cjs CHANGED
@@ -1,3 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1
2
  let _nestjs_common = require("@nestjs/common");
2
3
  let _nestjs_swagger = require("@nestjs/swagger");
3
4
 
@@ -16,13 +17,13 @@ const ERROR_DESCRIPTIONS = {
16
17
  };
17
18
 
18
19
  //#endregion
19
- //#region \0@oxc-project+runtime@0.106.0/helpers/decorateMetadata.js
20
+ //#region \0@oxc-project+runtime@0.112.0/helpers/decorateMetadata.js
20
21
  function __decorateMetadata(k, v) {
21
22
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
22
23
  }
23
24
 
24
25
  //#endregion
25
- //#region \0@oxc-project+runtime@0.106.0/helpers/decorate.js
26
+ //#region \0@oxc-project+runtime@0.112.0/helpers/decorate.js
26
27
  function __decorate(decorators, target, key, desc) {
27
28
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
28
29
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../src/constants.ts","../src/dtos/index.ts","../src/decorators/index.ts"],"sourcesContent":["export const API_RESPONSE_DESCRIPTION =\n \"If the server is available, it always responds with code 200 or 201. Error code 400 and higher will replace the ok field: it equals false and the error text in the error field. If the input data does not pass validation, the error field contains an object with invalid fields and error text\";\n\nexport const ERROR_DESCRIPTIONS = {\n BAD_REQUEST: \"Invalid request data or parameters\",\n UNAUTHORIZED: \"Authentication required\",\n FORBIDDEN: \"Access denied\",\n NOT_FOUND: \"Resource not found\",\n CONFLICT: \"Resource already exists or conflict detected\",\n UNPROCESSABLE_ENTITY: \"Validation error\",\n RATE_LIMIT_EXCEEDED: \"Rate limit exceeded. Too many requests\",\n INTERNAL_SERVER_ERROR: \"Internal server error\",\n SERVICE_UNAVAILABLE: \"Service temporarily unavailable\",\n};\n","import { ApiProperty } from \"@nestjs/swagger\";\n\nexport class PaginatedResponseDto<T> {\n data!: T[];\n\n @ApiProperty()\n totalCount!: number;\n\n @ApiProperty()\n offset!: number;\n\n @ApiProperty()\n limit!: number;\n}\n","import { applyDecorators } from \"@nestjs/common\";\nimport {\n ApiBadRequestResponse,\n ApiConflictResponse,\n ApiExtraModels,\n ApiForbiddenResponse,\n ApiInternalServerErrorResponse,\n ApiNotFoundResponse,\n ApiOkResponse,\n ApiOperation,\n ApiServiceUnavailableResponse,\n ApiTooManyRequestsResponse,\n ApiUnauthorizedResponse,\n ApiUnprocessableEntityResponse,\n getSchemaPath,\n} from \"@nestjs/swagger\";\nimport { API_RESPONSE_DESCRIPTION } from \"../constants\";\nimport { PaginatedResponseDto } from \"../dtos\";\nimport { SwaggerDocumentationOptions } from \"../interfaces\";\nimport { createHash } from \"crypto\";\n\n// SwaggerDocumentation is a decorator function to generate Swagger documentation for endpoints based on the provided options.\nexport const SwaggerDocumentation = (data: SwaggerDocumentationOptions) => {\n const operationId = data.operationId;\n\n const decorators = [\n ApiOperation({\n operationId,\n description: data.endpointDescription,\n summary: data.endpointSummary,\n deprecated: data.deprecated,\n }),\n ];\n\n if (data.error400Description) {\n decorators.push(\n ApiBadRequestResponse({\n description: data.error400Description,\n })\n );\n }\n\n if (data.error401Description) {\n decorators.push(\n ApiUnauthorizedResponse({\n description: data.error401Description,\n })\n );\n }\n\n if (data.error403Description) {\n decorators.push(\n ApiForbiddenResponse({\n description: data.error403Description,\n })\n );\n }\n\n if (data.error404Description) {\n decorators.push(\n ApiNotFoundResponse({\n description: data.error404Description,\n })\n );\n }\n\n if (data.error409Description) {\n decorators.push(\n ApiConflictResponse({\n description: data.error409Description,\n })\n );\n }\n\n if (data.error422Description) {\n decorators.push(\n ApiUnprocessableEntityResponse({\n description: data.error422Description,\n })\n );\n }\n\n if (data.error429Description) {\n decorators.push(\n ApiTooManyRequestsResponse({\n description: data.error429Description,\n })\n );\n }\n\n if (data.error500Description) {\n decorators.push(\n ApiInternalServerErrorResponse({\n description: data.error500Description,\n })\n );\n }\n\n if (data.error503Description) {\n decorators.push(\n ApiServiceUnavailableResponse({\n description: data.error503Description,\n })\n );\n }\n\n if (data.isPaginated && data.responseDto) {\n decorators.push(\n ApiOkResponse({\n schema: {\n allOf: [\n { $ref: getSchemaPath(PaginatedResponseDto) },\n {\n properties: {\n data: {\n type: \"array\",\n items: {\n $ref: getSchemaPath(data.responseDto),\n },\n },\n },\n },\n ],\n },\n description: API_RESPONSE_DESCRIPTION,\n }),\n ApiExtraModels(data.responseDto, PaginatedResponseDto)\n );\n } else if (data.responseDto) {\n decorators.push(\n ApiOkResponse({\n schema: data.isArray\n ? {\n type: \"array\",\n items: { $ref: getSchemaPath(data.responseDto) },\n }\n : { $ref: getSchemaPath(data.responseDto) },\n description: API_RESPONSE_DESCRIPTION,\n }),\n ApiExtraModels(data.responseDto)\n );\n } else {\n decorators.push(\n ApiOkResponse({\n description: API_RESPONSE_DESCRIPTION,\n })\n );\n }\n\n return applyDecorators(...decorators);\n};\n"],"mappings":";;;;AAAA,MAAa,2BACX;AAEF,MAAa,qBAAqB;CAChC,aAAa;CACb,cAAc;CACd,WAAW;CACX,WAAW;CACX,UAAU;CACV,sBAAsB;CACtB,qBAAqB;CACrB,uBAAuB;CACvB,qBAAqB;CACtB;;;;;;;;;;;;;;;;;;;ACXD,IAAa,uBAAb,MAAqC;CACnC;CAEA,AACA;CAEA,AACA;CAEA,AACA;;8CAPc;8CAGA;8CAGA;;;;ACWhB,MAAa,wBAAwB,SAAsC;CACzE,MAAM,cAAc,KAAK;CAEzB,MAAM,aAAa,mCACJ;EACX;EACA,aAAa,KAAK;EAClB,SAAS,KAAK;EACd,YAAY,KAAK;EAClB,CAAC,CACH;AAED,KAAI,KAAK,oBACP,YAAW,gDACa,EACpB,aAAa,KAAK,qBACnB,CAAC,CACH;AAGH,KAAI,KAAK,oBACP,YAAW,kDACe,EACtB,aAAa,KAAK,qBACnB,CAAC,CACH;AAGH,KAAI,KAAK,oBACP,YAAW,+CACY,EACnB,aAAa,KAAK,qBACnB,CAAC,CACH;AAGH,KAAI,KAAK,oBACP,YAAW,8CACW,EAClB,aAAa,KAAK,qBACnB,CAAC,CACH;AAGH,KAAI,KAAK,oBACP,YAAW,8CACW,EAClB,aAAa,KAAK,qBACnB,CAAC,CACH;AAGH,KAAI,KAAK,oBACP,YAAW,yDACsB,EAC7B,aAAa,KAAK,qBACnB,CAAC,CACH;AAGH,KAAI,KAAK,oBACP,YAAW,qDACkB,EACzB,aAAa,KAAK,qBACnB,CAAC,CACH;AAGH,KAAI,KAAK,oBACP,YAAW,yDACsB,EAC7B,aAAa,KAAK,qBACnB,CAAC,CACH;AAGH,KAAI,KAAK,oBACP,YAAW,wDACqB,EAC5B,aAAa,KAAK,qBACnB,CAAC,CACH;AAGH,KAAI,KAAK,eAAe,KAAK,YAC3B,YAAW,wCACK;EACZ,QAAQ,EACN,OAAO,CACL,EAAE,yCAAoB,qBAAqB,EAAE,EAC7C,EACE,YAAY,EACV,MAAM;GACJ,MAAM;GACN,OAAO,EACL,yCAAoB,KAAK,YAAY,EACtC;GACF,EACF,EACF,CACF,EACF;EACD,aAAa;EACd,CAAC,sCACa,KAAK,aAAa,qBAAqB,CACvD;UACQ,KAAK,YACd,YAAW,wCACK;EACZ,QAAQ,KAAK,UACT;GACE,MAAM;GACN,OAAO,EAAE,yCAAoB,KAAK,YAAY,EAAE;GACjD,GACD,EAAE,yCAAoB,KAAK,YAAY,EAAE;EAC7C,aAAa;EACd,CAAC,sCACa,KAAK,YAAY,CACjC;KAED,YAAW,wCACK,EACZ,aAAa,0BACd,CAAC,CACH;AAGH,4CAAuB,GAAG,WAAW"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/constants.ts","../src/dtos/index.ts","../src/decorators/index.ts"],"sourcesContent":["export const API_RESPONSE_DESCRIPTION =\n \"If the server is available, it always responds with code 200 or 201. Error code 400 and higher will replace the ok field: it equals false and the error text in the error field. If the input data does not pass validation, the error field contains an object with invalid fields and error text\";\n\nexport const ERROR_DESCRIPTIONS = {\n BAD_REQUEST: \"Invalid request data or parameters\",\n UNAUTHORIZED: \"Authentication required\",\n FORBIDDEN: \"Access denied\",\n NOT_FOUND: \"Resource not found\",\n CONFLICT: \"Resource already exists or conflict detected\",\n UNPROCESSABLE_ENTITY: \"Validation error\",\n RATE_LIMIT_EXCEEDED: \"Rate limit exceeded. Too many requests\",\n INTERNAL_SERVER_ERROR: \"Internal server error\",\n SERVICE_UNAVAILABLE: \"Service temporarily unavailable\",\n};\n","import { ApiProperty } from \"@nestjs/swagger\";\n\nexport class PaginatedResponseDto<T> {\n data!: T[];\n\n @ApiProperty()\n totalCount!: number;\n\n @ApiProperty()\n offset!: number;\n\n @ApiProperty()\n limit!: number;\n}\n","import { applyDecorators } from \"@nestjs/common\";\nimport {\n ApiBadRequestResponse,\n ApiConflictResponse,\n ApiExtraModels,\n ApiForbiddenResponse,\n ApiInternalServerErrorResponse,\n ApiNotFoundResponse,\n ApiOkResponse,\n ApiOperation,\n ApiServiceUnavailableResponse,\n ApiTooManyRequestsResponse,\n ApiUnauthorizedResponse,\n ApiUnprocessableEntityResponse,\n getSchemaPath,\n} from \"@nestjs/swagger\";\nimport { API_RESPONSE_DESCRIPTION } from \"../constants\";\nimport { PaginatedResponseDto } from \"../dtos\";\nimport { SwaggerDocumentationOptions } from \"../interfaces\";\nimport { createHash } from \"crypto\";\n\n// SwaggerDocumentation is a decorator function to generate Swagger documentation for endpoints based on the provided options.\nexport const SwaggerDocumentation = (data: SwaggerDocumentationOptions) => {\n const operationId = data.operationId;\n\n const decorators = [\n ApiOperation({\n operationId,\n description: data.endpointDescription,\n summary: data.endpointSummary,\n deprecated: data.deprecated,\n }),\n ];\n\n if (data.error400Description) {\n decorators.push(\n ApiBadRequestResponse({\n description: data.error400Description,\n })\n );\n }\n\n if (data.error401Description) {\n decorators.push(\n ApiUnauthorizedResponse({\n description: data.error401Description,\n })\n );\n }\n\n if (data.error403Description) {\n decorators.push(\n ApiForbiddenResponse({\n description: data.error403Description,\n })\n );\n }\n\n if (data.error404Description) {\n decorators.push(\n ApiNotFoundResponse({\n description: data.error404Description,\n })\n );\n }\n\n if (data.error409Description) {\n decorators.push(\n ApiConflictResponse({\n description: data.error409Description,\n })\n );\n }\n\n if (data.error422Description) {\n decorators.push(\n ApiUnprocessableEntityResponse({\n description: data.error422Description,\n })\n );\n }\n\n if (data.error429Description) {\n decorators.push(\n ApiTooManyRequestsResponse({\n description: data.error429Description,\n })\n );\n }\n\n if (data.error500Description) {\n decorators.push(\n ApiInternalServerErrorResponse({\n description: data.error500Description,\n })\n );\n }\n\n if (data.error503Description) {\n decorators.push(\n ApiServiceUnavailableResponse({\n description: data.error503Description,\n })\n );\n }\n\n if (data.isPaginated && data.responseDto) {\n decorators.push(\n ApiOkResponse({\n schema: {\n allOf: [\n { $ref: getSchemaPath(PaginatedResponseDto) },\n {\n properties: {\n data: {\n type: \"array\",\n items: {\n $ref: getSchemaPath(data.responseDto),\n },\n },\n },\n },\n ],\n },\n description: API_RESPONSE_DESCRIPTION,\n }),\n ApiExtraModels(data.responseDto, PaginatedResponseDto)\n );\n } else if (data.responseDto) {\n decorators.push(\n ApiOkResponse({\n schema: data.isArray\n ? {\n type: \"array\",\n items: { $ref: getSchemaPath(data.responseDto) },\n }\n : { $ref: getSchemaPath(data.responseDto) },\n description: API_RESPONSE_DESCRIPTION,\n }),\n ApiExtraModels(data.responseDto)\n );\n } else {\n decorators.push(\n ApiOkResponse({\n description: API_RESPONSE_DESCRIPTION,\n })\n );\n }\n\n return applyDecorators(...decorators);\n};\n"],"mappings":";;;;;AAAA,MAAa,2BACX;AAEF,MAAa,qBAAqB;CAChC,aAAa;CACb,cAAc;CACd,WAAW;CACX,WAAW;CACX,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,KAAK,aAAa,qBAAqB,CACvD;UACQ,KAAK,YACd,YAAW,wCACK;EACZ,QAAQ,KAAK,UACT;GACE,MAAM;GACN,OAAO,EAAE,yCAAoB,KAAK,YAAY,EAAE;GACjD,GACD,EAAE,yCAAoB,KAAK,YAAY,EAAE;EAC7C,aAAa;EACd,CAAC,sCACa,KAAK,YAAY,CACjC;KAED,YAAW,wCACK,EACZ,aAAa,0BACd,CAAC,CACH;AAGH,4CAAuB,GAAG,WAAW"}
package/dist/index.mjs CHANGED
@@ -16,13 +16,13 @@ const ERROR_DESCRIPTIONS = {
16
16
  };
17
17
 
18
18
  //#endregion
19
- //#region \0@oxc-project+runtime@0.106.0/helpers/decorateMetadata.js
19
+ //#region \0@oxc-project+runtime@0.112.0/helpers/decorateMetadata.js
20
20
  function __decorateMetadata(k, v) {
21
21
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
22
22
  }
23
23
 
24
24
  //#endregion
25
- //#region \0@oxc-project+runtime@0.106.0/helpers/decorate.js
25
+ //#region \0@oxc-project+runtime@0.112.0/helpers/decorate.js
26
26
  function __decorate(decorators, target, key, desc) {
27
27
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
28
28
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@globalart/nestjs-swagger",
3
- "version": "1.2.7",
3
+ "version": "1.2.8",
4
4
  "description": "A simple documentation builder for NestJS Swagger Module",
5
5
  "author": {
6
6
  "name": "GlobalArt, Inc"
@@ -48,25 +48,25 @@
48
48
  "publish:npm": "release-it --config ../../.release-it.json"
49
49
  },
50
50
  "dependencies": {
51
- "@nestjs/common": "11.1.11",
52
- "@nestjs/core": "11.1.11",
53
- "@nestjs/swagger": "^11.2.3",
54
- "@nestjs/testing": "11.1.11",
51
+ "@nestjs/common": "11.1.13",
52
+ "@nestjs/core": "11.1.13",
53
+ "@nestjs/swagger": "^11.2.5",
54
+ "@nestjs/testing": "11.1.13",
55
55
  "@nestjs/typeorm": "^11.0.0",
56
56
  "mysql": "^2.18.1"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/jest": "^30.0.0",
60
- "@types/node": "25.0.3",
60
+ "@types/node": "25.2.1",
61
61
  "coveralls": "^3.1.1",
62
62
  "jest": "^30.2.0",
63
- "prettier": "3.7.4",
63
+ "prettier": "3.8.1",
64
64
  "reflect-metadata": "^0.2.2",
65
- "release-it": "19.2.3",
65
+ "release-it": "19.2.4",
66
66
  "rxjs": "^7.8.2",
67
67
  "ts-jest": "29.4.6",
68
68
  "ts-node": "^10.9.2",
69
- "tsdown": "0.19.0-beta.3",
69
+ "tsdown": "0.20.3",
70
70
  "typeorm": "0.3.28",
71
71
  "typescript": "^5.9.3"
72
72
  },