@tinkerstack/graphql-annotation 0.0.1 → 0.0.3

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @tinkerstack/graphql-annotation@0.0.1 build C:\Users\mori\Documents\Work\tinkerstack\packages\graphql-annotation
2
+ > @tinkerstack/graphql-annotation@0.0.2 build C:\Users\mori\Documents\Work\tinkerstack\packages\graphql-annotation
3
3
  > tsup
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -10,11 +10,11 @@
10
10
  CLI Cleaning output folder
11
11
  ESM Build start
12
12
  CJS Build start
13
- CJS dist\index.js 21.07 KB
14
- CJS ⚡️ Build success in 54ms
15
- ESM dist\index.mjs 19.14 KB
16
- ESM ⚡️ Build success in 55ms
13
+ CJS dist\index.js 21.17 KB
14
+ CJS ⚡️ Build success in 645ms
15
+ ESM dist\index.mjs 19.24 KB
16
+ ESM ⚡️ Build success in 646ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 1760ms
18
+ DTS ⚡️ Build success in 2927ms
19
19
  DTS dist\index.d.mts 2.89 KB
20
20
  DTS dist\index.d.ts 2.89 KB
package/dist/index.d.mts CHANGED
@@ -10,6 +10,8 @@ declare function Annotate(name: string, opts?: {
10
10
  declare function Annotate(name: string, opts: {
11
11
  data?: Record<string, any>;
12
12
  parameter: string;
13
+ description?: string;
14
+ type?: () => any;
13
15
  }): ParameterDecorator & MethodDecorator;
14
16
  declare function ResolveAnnotation(): MethodDecorator;
15
17
  declare function ResolveAnnotation(annotation: string): MethodDecorator;
package/dist/index.d.ts CHANGED
@@ -10,6 +10,8 @@ declare function Annotate(name: string, opts?: {
10
10
  declare function Annotate(name: string, opts: {
11
11
  data?: Record<string, any>;
12
12
  parameter: string;
13
+ description?: string;
14
+ type?: () => any;
13
15
  }): ParameterDecorator & MethodDecorator;
14
16
  declare function ResolveAnnotation(): MethodDecorator;
15
17
  declare function ResolveAnnotation(annotation: string): MethodDecorator;
package/dist/index.js CHANGED
@@ -67,7 +67,11 @@ function Annotate(name, opts) {
67
67
  const paramIndex = descriptorOrParameterIndex;
68
68
  const paramName = opts?.parameter;
69
69
  if (!paramName) throw new Error(`Unable to apply annotation "${annotationName}". Parameter name not specified.`);
70
- (0, import_graphql.Args)(paramName)(target, propertyKey, paramIndex);
70
+ (0, import_graphql.Args)({
71
+ name: paramName,
72
+ type: opts?.type,
73
+ description: opts?.description
74
+ })(target, propertyKey, paramIndex);
71
75
  _updateAnnotation(target.constructor, (meta) => ({
72
76
  ...meta,
73
77
  [`${annotationName}@${paramIndex}`]: {
package/dist/index.mjs CHANGED
@@ -38,7 +38,11 @@ function Annotate(name, opts) {
38
38
  const paramIndex = descriptorOrParameterIndex;
39
39
  const paramName = opts?.parameter;
40
40
  if (!paramName) throw new Error(`Unable to apply annotation "${annotationName}". Parameter name not specified.`);
41
- Args(paramName)(target, propertyKey, paramIndex);
41
+ Args({
42
+ name: paramName,
43
+ type: opts?.type,
44
+ description: opts?.description
45
+ })(target, propertyKey, paramIndex);
42
46
  _updateAnnotation(target.constructor, (meta) => ({
43
47
  ...meta,
44
48
  [`${annotationName}@${paramIndex}`]: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinkerstack/graphql-annotation",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Better type-safe-able graphql directives",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -1,5 +1,5 @@
1
1
  import { SetMetadata } from "@nestjs/common";
2
- import { Args } from "@nestjs/graphql";
2
+ import { Args, ArgsOptions } from "@nestjs/graphql";
3
3
  import "reflect-metadata";
4
4
  import {
5
5
  ANNOTATION_METADATA,
@@ -30,7 +30,12 @@ export function Annotate(
30
30
  */
31
31
  export function Annotate(
32
32
  name: string,
33
- opts: { data?: Record<string, any>; parameter: string },
33
+ opts: {
34
+ data?: Record<string, any>;
35
+ parameter: string;
36
+ description?: string;
37
+ type?: () => any;
38
+ },
34
39
  ): ParameterDecorator & MethodDecorator;
35
40
  /**
36
41
  * Applies an annotation to a Query or Mutation handler or parameter for
@@ -42,7 +47,12 @@ export function Annotate(
42
47
  */
43
48
  export function Annotate(
44
49
  name: string,
45
- opts?: { data?: Record<string, any>; parameter?: string },
50
+ opts?: {
51
+ data?: Record<string, any>;
52
+ parameter?: string;
53
+ description?: string;
54
+ type?: () => any;
55
+ },
46
56
  ): MethodDecorator & ParameterDecorator {
47
57
  const annotationName = name;
48
58
  const annotationData = opts?.data;
@@ -79,7 +89,11 @@ export function Annotate(
79
89
  `Unable to apply annotation "${annotationName}". Parameter name not specified.`,
80
90
  );
81
91
 
82
- Args(paramName)(target, propertyKey, paramIndex);
92
+ Args({
93
+ name: paramName,
94
+ type: opts?.type,
95
+ description: opts?.description,
96
+ })(target, propertyKey, paramIndex);
83
97
  _updateAnnotation(
84
98
  target.constructor,
85
99
  (meta) => ({