meteorjs-decorators 1.0.0 → 1.0.2

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # meteor-decorators
1
+ # meteorjs-decorators
2
2
 
3
3
  NestJS-style decorators for Meteor methods, publications, dependency injection, and DTO validation.
4
4
 
@@ -9,7 +9,7 @@ NestJS-style decorators for Meteor methods, publications, dependency injection,
9
9
 
10
10
  ## Install
11
11
  ```bash
12
- npm install meteor-decorators
12
+ npm install meteorjs-decorators
13
13
  ```
14
14
 
15
15
  ## Setup
@@ -30,8 +30,8 @@ import 'reflect-metadata';
30
30
 
31
31
  ## Quick start
32
32
  ```ts
33
- import { Controller, Method, Auth, Validate, Dto, Injectable, BaseController } from 'meteor-decorators';
34
- import { RequestDto, ResponseDto } from 'meteor-decorators';
33
+ import { Controller, Method, Auth, Validate, Dto, Injectable, BaseController } from 'meteorjs-decorators';
34
+ import { RequestDto, ResponseDto } from 'meteorjs-decorators';
35
35
  import { IsEmail, IsString } from 'class-validator';
36
36
 
37
37
  class CreateUserDto extends RequestDto {
@@ -81,7 +81,7 @@ export class UsersController extends BaseController {
81
81
 
82
82
  ## Publications (with optional DTO mapping)
83
83
  ```ts
84
- import { Publication, ReactiveDto, BasePublication, Injectable } from 'meteor-decorators';
84
+ import { Publication, ReactiveDto, BasePublication, Injectable } from 'meteorjs-decorators';
85
85
 
86
86
  @Injectable()
87
87
  class UsersService {
@@ -107,7 +107,7 @@ export class UsersPublication extends BasePublication {
107
107
 
108
108
  ## Modules and DI
109
109
  ```ts
110
- import { Module, forwardRef } from 'meteor-decorators';
110
+ import { Module, forwardRef } from 'meteorjs-decorators';
111
111
 
112
112
  @Module({
113
113
  imports: [forwardRef(() => AuthModule)],
@@ -119,7 +119,7 @@ export class UsersModule {}
119
119
 
120
120
  Use `@Inject(token)` when you need a custom token or to resolve circular deps:
121
121
  ```ts
122
- import { Inject, Injectable, forwardRef } from 'meteor-decorators';
122
+ import { Inject, Injectable, forwardRef } from 'meteorjs-decorators';
123
123
 
124
124
  @Injectable()
125
125
  class BillingService {
@@ -129,7 +129,7 @@ class BillingService {
129
129
 
130
130
  ## Entities and indexes
131
131
  ```ts
132
- import { Entity, Index, BaseEntity } from 'meteor-decorators';
132
+ import { Entity, Index, BaseEntity } from 'meteorjs-decorators';
133
133
 
134
134
  @Entity('widgets')
135
135
  export class WidgetEntity extends BaseEntity {
@@ -33,9 +33,9 @@ function Validate(...dtos) {
33
33
  const errors = (0, class_validator_1.validateSync)(requestDto);
34
34
  if (errors.length > 0) {
35
35
  const details = errors
36
- .flatMap((error) => Object.values(error.constraints ?? {}).map((message) => `${error.property}: ${message}`))
36
+ .map((error) => error.toString(false, false, '', true) + '\n')
37
37
  .join('; ');
38
- throw new Meteor.Error('validation-error', 'Validation failed', details || 'Validation failed');
38
+ throw new Meteor.Error('validation-error', 'Validation failed', details);
39
39
  }
40
40
  // Replace object argument with validated DTO
41
41
  args[i] = requestDto;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meteorjs-decorators",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Meteor decorators to make your Meteor app with NestJS-style pattern.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -23,4 +23,4 @@
23
23
  "mongodb": "^6.13.1",
24
24
  "typescript": "^5.4.5"
25
25
  }
26
- }
26
+ }