type-graphql 2.0.0-beta.2 → 2.0.0-beta.4
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/LICENSE +1 -1
- package/README.md +42 -39
- package/{dist → build/cjs}/decorators/Arg.js +2 -3
- package/{dist → build/cjs}/decorators/Args.js +2 -3
- package/{dist → build/cjs}/decorators/ArgsType.js +0 -1
- package/{dist → build/cjs}/decorators/Authorized.js +2 -3
- package/{dist → build/cjs}/decorators/Ctx.js +1 -2
- package/build/cjs/decorators/Directive.js +37 -0
- package/{dist → build/cjs}/decorators/Extensions.js +1 -2
- package/{dist → build/cjs}/decorators/Field.js +3 -4
- package/{dist → build/cjs}/decorators/FieldResolver.js +1 -4
- package/{dist → build/cjs}/decorators/Info.js +1 -2
- package/{dist → build/cjs}/decorators/InputType.js +1 -2
- package/{dist → build/cjs}/decorators/InterfaceType.js +1 -2
- package/{dist → build/cjs}/decorators/Mutation.js +2 -3
- package/{dist → build/cjs}/decorators/ObjectType.js +1 -2
- package/{dist → build/cjs}/decorators/Query.js +2 -3
- package/{dist → build/cjs}/decorators/Resolver.js +0 -1
- package/{dist → build/cjs}/decorators/Root.js +2 -4
- package/{dist → build/cjs}/decorators/Subscription.js +4 -4
- package/{dist → build/cjs}/decorators/UseMiddleware.js +2 -3
- package/{dist → build/cjs}/decorators/createMethodDecorator.js +0 -1
- package/{dist → build/cjs}/decorators/createParamDecorator.js +1 -2
- package/{dist → build/cjs}/decorators/enums.js +0 -1
- package/{dist → build/cjs}/decorators/index.js +1 -4
- package/{dist → build/cjs}/decorators/types.js +0 -1
- package/{dist → build/cjs}/decorators/unions.js +0 -1
- package/{dist → build/cjs}/errors/CannotDetermineGraphQLTypeError.js +0 -1
- package/{dist → build/cjs}/errors/ConflictingDefaultValuesError.js +0 -1
- package/{dist → build/cjs}/errors/GeneratingSchemaError.js +0 -1
- package/{dist → build/cjs}/errors/InterfaceResolveTypeError.js +0 -1
- package/{dist → build/cjs}/errors/InvalidDirectiveError.js +0 -1
- package/build/cjs/errors/MissingPubSubError.js +11 -0
- package/{dist → build/cjs}/errors/MissingSubscriptionTopicsError.js +0 -1
- package/{dist → build/cjs}/errors/NoExplicitTypeError.js +0 -1
- package/{dist → build/cjs}/errors/ReflectMetadataMissingError.js +0 -1
- package/{dist → build/cjs}/errors/SymbolKeysNotSupportedError.js +0 -1
- package/{dist → build/cjs}/errors/UnionResolveTypeError.js +0 -1
- package/{dist → build/cjs}/errors/UnmetGraphQLPeerDependencyError.js +3 -5
- package/{dist → build/cjs}/errors/WrongNullableListOptionError.js +0 -1
- package/{dist/errors → build/cjs/errors/graphql}/ArgumentValidationError.js +8 -4
- package/build/cjs/errors/graphql/AuthenticationError.js +15 -0
- package/build/cjs/errors/graphql/AuthorizationError.js +15 -0
- package/build/cjs/errors/graphql/index.js +6 -0
- package/{dist → build/cjs}/errors/index.js +2 -4
- package/{dist → build/cjs}/helpers/auth-middleware.js +2 -3
- package/{dist → build/cjs}/helpers/decorators.js +6 -11
- package/build/cjs/helpers/filesystem.js +33 -0
- package/{dist → build/cjs}/helpers/findType.js +9 -12
- package/{dist → build/cjs}/helpers/isThrowing.js +0 -1
- package/{dist → build/cjs}/helpers/params.js +3 -3
- package/{dist → build/cjs}/helpers/resolver-metadata.js +1 -2
- package/{dist → build/cjs}/helpers/returnTypes.js +0 -1
- package/{dist → build/cjs}/helpers/types.js +11 -18
- package/{dist → build/cjs}/helpers/utils.js +0 -1
- package/{dist → build/cjs}/index.js +1 -5
- package/build/cjs/metadata/definitions/authorized-metadata.js +2 -0
- package/build/cjs/metadata/definitions/class-metadata.js +2 -0
- package/build/cjs/metadata/definitions/directive-metadata.js +2 -0
- package/build/cjs/metadata/definitions/enum-metadata.js +2 -0
- package/build/cjs/metadata/definitions/extensions-metadata.js +2 -0
- package/build/cjs/metadata/definitions/field-metadata.js +2 -0
- package/{dist → build/cjs}/metadata/definitions/index.js +0 -1
- package/build/cjs/metadata/definitions/interface-class-metadata.js +2 -0
- package/build/cjs/metadata/definitions/middleware-metadata.js +2 -0
- package/build/cjs/metadata/definitions/object-class-metadata.js +2 -0
- package/build/cjs/metadata/definitions/param-metadata.js +2 -0
- package/build/cjs/metadata/definitions/resolver-metadata.js +2 -0
- package/build/cjs/metadata/definitions/union-metadata.js +2 -0
- package/build/cjs/metadata/getMetadataStorage.js +11 -0
- package/{dist → build/cjs}/metadata/index.js +0 -1
- package/{dist → build/cjs}/metadata/metadata-storage.js +11 -7
- package/{dist → build/cjs}/metadata/utils.js +16 -21
- package/{dist → build/cjs}/resolvers/convert-args.js +0 -8
- package/{dist → build/cjs}/resolvers/create.js +15 -25
- package/{dist → build/cjs}/resolvers/helpers.js +10 -19
- package/{dist → build/cjs}/resolvers/validate-arg.js +10 -8
- package/{dist → build/cjs}/scalars/aliases.js +0 -1
- package/build/cjs/scalars/index.js +8 -0
- package/{dist → build/cjs}/schema/build-context.js +2 -20
- package/{dist → build/cjs}/schema/definition-node.js +46 -50
- package/{dist → build/cjs}/schema/schema-generator.js +89 -84
- package/{dist → build/cjs}/schema/utils.js +0 -1
- package/build/cjs/shim.js +38 -0
- package/build/cjs/typings/Complexity.js +2 -0
- package/build/cjs/typings/ResolverInterface.js +2 -0
- package/build/cjs/typings/SubscribeResolverData.js +2 -0
- package/build/cjs/typings/SubscriptionHandlerData.js +2 -0
- package/build/cjs/typings/TypeResolver.js +2 -0
- package/build/cjs/typings/ValidatorFn.js +2 -0
- package/build/cjs/typings/auth-checker.js +2 -0
- package/build/cjs/typings/index.js +15 -0
- package/build/cjs/typings/legacy-decorators.js +2 -0
- package/build/cjs/typings/middleware.js +2 -0
- package/build/cjs/typings/resolver-data.js +2 -0
- package/build/cjs/typings/resolvers-map.js +2 -0
- package/build/cjs/typings/subscriptions.js +2 -0
- package/{dist/interfaces → build/cjs/typings/utils}/ClassType.js +0 -1
- package/build/cjs/typings/utils/Constructor.js +2 -0
- package/build/cjs/typings/utils/Except.js +2 -0
- package/build/cjs/typings/utils/IsEqual.js +2 -0
- package/{dist/interfaces → build/cjs/typings/utils}/Maybe.js +0 -1
- package/build/cjs/typings/utils/MaybePromise.js +2 -0
- package/build/cjs/typings/utils/MergeExclusive.js +2 -0
- package/build/cjs/typings/utils/NonEmptyArray.js +2 -0
- package/build/cjs/typings/utils/SetRequired.js +2 -0
- package/build/cjs/typings/utils/Simplify.js +2 -0
- package/build/cjs/typings/utils/index.js +13 -0
- package/{dist → build/cjs}/utils/buildSchema.js +20 -22
- package/{dist → build/cjs}/utils/buildTypeDefsAndResolvers.js +5 -6
- package/{dist → build/cjs}/utils/container.js +0 -6
- package/{dist → build/cjs}/utils/createResolversMap.js +29 -30
- package/{dist → build/cjs}/utils/emitSchemaDefinitionFile.js +5 -6
- package/build/cjs/utils/graphql-version.js +14 -0
- package/{dist → build/cjs}/utils/index.js +2 -1
- package/{dist → build/cjs}/utils/isPromiseLike.js +2 -2
- package/build/esm/decorators/Arg.js +26 -0
- package/build/esm/decorators/Args.js +16 -0
- package/build/esm/decorators/ArgsType.js +13 -0
- package/build/esm/decorators/Authorized.js +20 -0
- package/{dist/decorators/PubSub.js → build/esm/decorators/Ctx.js} +6 -7
- package/build/esm/decorators/Directive.js +37 -0
- package/{dist/decorators/Directive.js → build/esm/decorators/Extensions.js} +7 -9
- package/build/esm/decorators/Field.js +45 -0
- package/build/esm/decorators/FieldResolver.js +42 -0
- package/build/esm/decorators/Info.js +19 -0
- package/build/esm/decorators/InputType.js +16 -0
- package/build/esm/decorators/InterfaceType.js +19 -0
- package/build/esm/decorators/Mutation.js +14 -0
- package/build/esm/decorators/ObjectType.js +19 -0
- package/build/esm/decorators/Query.js +14 -0
- package/build/esm/decorators/Resolver.js +20 -0
- package/build/esm/decorators/Root.js +34 -0
- package/build/esm/decorators/Subscription.js +25 -0
- package/build/esm/decorators/UseMiddleware.js +20 -0
- package/build/esm/decorators/createMethodDecorator.js +8 -0
- package/build/esm/decorators/createParamDecorator.js +20 -0
- package/build/esm/decorators/enums.js +13 -0
- package/build/esm/decorators/index.js +49 -0
- package/build/esm/decorators/types.js +2 -0
- package/build/esm/decorators/unions.js +14 -0
- package/build/esm/errors/CannotDetermineGraphQLTypeError.js +21 -0
- package/build/esm/errors/ConflictingDefaultValuesError.js +12 -0
- package/build/esm/errors/GeneratingSchemaError.js +14 -0
- package/build/esm/errors/InterfaceResolveTypeError.js +11 -0
- package/build/esm/errors/InvalidDirectiveError.js +10 -0
- package/build/esm/errors/MissingPubSubError.js +11 -0
- package/build/esm/errors/MissingSubscriptionTopicsError.js +10 -0
- package/build/esm/errors/NoExplicitTypeError.js +19 -0
- package/build/esm/errors/ReflectMetadataMissingError.js +11 -0
- package/build/esm/errors/SymbolKeysNotSupportedError.js +10 -0
- package/build/esm/errors/UnionResolveTypeError.js +11 -0
- package/build/esm/errors/UnmetGraphQLPeerDependencyError.js +12 -0
- package/build/esm/errors/WrongNullableListOptionError.js +11 -0
- package/build/esm/errors/graphql/ArgumentValidationError.js +16 -0
- package/build/esm/errors/graphql/AuthenticationError.js +15 -0
- package/build/esm/errors/graphql/AuthorizationError.js +15 -0
- package/build/esm/errors/graphql/index.js +6 -0
- package/build/esm/errors/index.js +17 -0
- package/build/esm/helpers/auth-middleware.js +26 -0
- package/build/esm/helpers/decorators.js +38 -0
- package/build/esm/helpers/filesystem.js +33 -0
- package/build/esm/helpers/findType.js +51 -0
- package/build/esm/helpers/isThrowing.js +13 -0
- package/build/esm/helpers/params.js +29 -0
- package/build/esm/helpers/resolver-metadata.js +29 -0
- package/build/esm/helpers/returnTypes.js +5 -0
- package/build/esm/helpers/types.js +85 -0
- package/build/esm/helpers/utils.js +2 -0
- package/build/esm/index.js +9 -0
- package/build/esm/metadata/definitions/authorized-metadata.js +2 -0
- package/build/esm/metadata/definitions/class-metadata.js +2 -0
- package/build/esm/metadata/definitions/directive-metadata.js +2 -0
- package/build/esm/metadata/definitions/enum-metadata.js +2 -0
- package/build/esm/metadata/definitions/extensions-metadata.js +2 -0
- package/build/esm/metadata/definitions/field-metadata.js +2 -0
- package/build/esm/metadata/definitions/index.js +13 -0
- package/build/esm/metadata/definitions/interface-class-metadata.js +2 -0
- package/build/esm/metadata/definitions/middleware-metadata.js +2 -0
- package/build/esm/metadata/definitions/object-class-metadata.js +2 -0
- package/build/esm/metadata/definitions/param-metadata.js +2 -0
- package/build/esm/metadata/definitions/resolver-metadata.js +2 -0
- package/build/esm/metadata/definitions/union-metadata.js +2 -0
- package/build/esm/metadata/getMetadataStorage.js +11 -0
- package/build/esm/metadata/index.js +5 -0
- package/build/esm/metadata/metadata-storage.js +266 -0
- package/build/esm/metadata/utils.js +41 -0
- package/build/esm/package.json +1 -0
- package/build/esm/resolvers/convert-args.js +122 -0
- package/build/esm/resolvers/create.js +81 -0
- package/build/esm/resolvers/helpers.js +83 -0
- package/build/esm/resolvers/validate-arg.js +42 -0
- package/build/esm/scalars/aliases.js +7 -0
- package/build/esm/scalars/index.js +8 -0
- package/build/esm/schema/build-context.js +50 -0
- package/build/esm/schema/definition-node.js +129 -0
- package/build/esm/schema/schema-generator.js +574 -0
- package/build/esm/schema/utils.js +39 -0
- package/build/esm/shim.js +38 -0
- package/build/esm/typings/Complexity.js +2 -0
- package/build/esm/typings/ResolverInterface.js +2 -0
- package/build/esm/typings/SubscribeResolverData.js +2 -0
- package/build/esm/typings/SubscriptionHandlerData.js +2 -0
- package/build/esm/typings/TypeResolver.js +2 -0
- package/build/esm/typings/ValidatorFn.js +2 -0
- package/build/esm/typings/auth-checker.js +2 -0
- package/build/esm/typings/index.js +15 -0
- package/build/esm/typings/legacy-decorators.js +2 -0
- package/build/esm/typings/middleware.js +2 -0
- package/build/esm/typings/resolver-data.js +2 -0
- package/build/esm/typings/resolvers-map.js +2 -0
- package/build/esm/typings/subscriptions.js +2 -0
- package/build/esm/typings/utils/ClassType.js +2 -0
- package/build/esm/typings/utils/Constructor.js +2 -0
- package/build/esm/typings/utils/Except.js +2 -0
- package/build/esm/typings/utils/IsEqual.js +2 -0
- package/build/esm/typings/utils/Maybe.js +2 -0
- package/build/esm/typings/utils/MaybePromise.js +2 -0
- package/build/esm/typings/utils/MergeExclusive.js +2 -0
- package/build/esm/typings/utils/NonEmptyArray.js +2 -0
- package/build/esm/typings/utils/SetRequired.js +2 -0
- package/build/esm/typings/utils/Simplify.js +2 -0
- package/build/esm/typings/utils/index.js +13 -0
- package/build/esm/utils/buildSchema.js +46 -0
- package/build/esm/utils/buildTypeDefsAndResolvers.js +21 -0
- package/build/esm/utils/container.js +37 -0
- package/build/esm/utils/createResolversMap.js +72 -0
- package/build/esm/utils/emitSchemaDefinitionFile.js +29 -0
- package/build/esm/utils/graphql-version.js +14 -0
- package/build/esm/utils/index.js +17 -0
- package/build/esm/utils/isPromiseLike.js +7 -0
- package/{dist → build/typings}/decorators/Arg.d.ts +2 -2
- package/{dist → build/typings}/decorators/Args.d.ts +2 -2
- package/{dist → build/typings}/decorators/Authorized.d.ts +1 -1
- package/{dist → build/typings}/decorators/Ctx.d.ts +1 -1
- package/build/typings/decorators/Directive.d.ts +2 -0
- package/build/typings/decorators/Extensions.d.ts +3 -0
- package/{dist → build/typings}/decorators/Field.d.ts +1 -1
- package/{dist → build/typings}/decorators/FieldResolver.d.ts +1 -1
- package/build/typings/decorators/Info.d.ts +2 -0
- package/{dist → build/typings}/decorators/InputType.d.ts +1 -1
- package/{dist → build/typings}/decorators/InterfaceType.d.ts +1 -1
- package/{dist → build/typings}/decorators/Mutation.d.ts +1 -1
- package/{dist → build/typings}/decorators/ObjectType.d.ts +1 -1
- package/{dist → build/typings}/decorators/Query.d.ts +1 -1
- package/{dist → build/typings}/decorators/Resolver.d.ts +2 -2
- package/{dist → build/typings}/decorators/Root.d.ts +1 -1
- package/{dist → build/typings}/decorators/Subscription.d.ts +5 -5
- package/{dist → build/typings}/decorators/UseMiddleware.d.ts +2 -2
- package/build/typings/decorators/createMethodDecorator.d.ts +2 -0
- package/build/typings/decorators/createParamDecorator.d.ts +2 -0
- package/{dist → build/typings}/decorators/enums.d.ts +1 -1
- package/build/typings/decorators/index.d.ts +29 -0
- package/{dist → build/typings}/decorators/types.d.ts +9 -7
- package/build/typings/decorators/unions.d.ts +9 -0
- package/{dist → build/typings}/errors/ConflictingDefaultValuesError.d.ts +1 -1
- package/build/typings/errors/GeneratingSchemaError.d.ts +5 -0
- package/{dist → build/typings}/errors/InterfaceResolveTypeError.d.ts +1 -1
- package/build/typings/errors/MissingPubSubError.d.ts +3 -0
- package/{dist → build/typings}/errors/UnionResolveTypeError.d.ts +1 -1
- package/build/typings/errors/UnmetGraphQLPeerDependencyError.d.ts +3 -0
- package/{dist → build/typings}/errors/WrongNullableListOptionError.d.ts +1 -1
- package/build/typings/errors/graphql/ArgumentValidationError.d.ts +10 -0
- package/build/typings/errors/graphql/AuthenticationError.d.ts +8 -0
- package/build/typings/errors/graphql/AuthorizationError.d.ts +8 -0
- package/build/typings/errors/graphql/index.d.ts +3 -0
- package/build/typings/errors/index.d.ts +14 -0
- package/build/typings/helpers/auth-middleware.d.ts +4 -0
- package/{dist → build/typings}/helpers/decorators.d.ts +1 -1
- package/build/typings/helpers/filesystem.d.ts +2 -0
- package/{dist → build/typings}/helpers/findType.d.ts +1 -1
- package/{dist → build/typings}/helpers/params.d.ts +2 -2
- package/{dist → build/typings}/helpers/resolver-metadata.d.ts +2 -2
- package/{dist → build/typings}/helpers/types.d.ts +2 -2
- package/build/typings/helpers/utils.d.ts +2 -0
- package/build/typings/index.d.ts +6 -0
- package/{dist → build/typings}/metadata/definitions/class-metadata.d.ts +3 -3
- package/{dist → build/typings}/metadata/definitions/directive-metadata.d.ts +6 -0
- package/{dist → build/typings}/metadata/definitions/enum-metadata.d.ts +1 -1
- package/{dist → build/typings}/metadata/definitions/field-metadata.d.ts +6 -6
- package/build/typings/metadata/definitions/index.d.ts +10 -0
- package/build/typings/metadata/definitions/interface-class-metadata.d.ts +7 -0
- package/{dist → build/typings}/metadata/definitions/middleware-metadata.d.ts +1 -1
- package/build/typings/metadata/definitions/object-class-metadata.d.ts +4 -0
- package/build/typings/metadata/definitions/param-metadata.d.ts +44 -0
- package/build/typings/metadata/definitions/resolver-metadata.d.ts +43 -0
- package/{dist → build/typings}/metadata/definitions/union-metadata.d.ts +3 -3
- package/{dist → build/typings}/metadata/getMetadataStorage.d.ts +1 -1
- package/build/typings/metadata/index.d.ts +1 -0
- package/{dist → build/typings}/metadata/metadata-storage.d.ts +7 -5
- package/{dist → build/typings}/metadata/utils.d.ts +2 -2
- package/{dist → build/typings}/resolvers/convert-args.d.ts +2 -2
- package/{dist → build/typings}/resolvers/create.d.ts +3 -3
- package/build/typings/resolvers/helpers.d.ts +8 -0
- package/build/typings/resolvers/validate-arg.d.ts +4 -0
- package/build/typings/scalars/index.d.ts +2 -0
- package/{dist → build/typings}/schema/build-context.d.ts +11 -14
- package/{dist → build/typings}/schema/definition-node.d.ts +3 -3
- package/{dist → build/typings}/schema/schema-generator.d.ts +4 -4
- package/{dist → build/typings}/schema/utils.d.ts +1 -1
- package/{dist/browser-shim.ts → build/typings/shim.ts} +8 -9
- package/build/typings/typings/Complexity.d.ts +2 -0
- package/build/typings/typings/SubscribeResolverData.d.ts +8 -0
- package/build/typings/typings/SubscriptionHandlerData.d.ts +8 -0
- package/{dist/interfaces → build/typings/typings}/TypeResolver.d.ts +2 -3
- package/build/typings/typings/ValidatorFn.d.ts +13 -0
- package/build/typings/typings/auth-checker.d.ts +8 -0
- package/build/typings/typings/index.d.ts +13 -0
- package/{dist/interfaces/LegacyDecorators.d.ts → build/typings/typings/legacy-decorators.d.ts} +1 -1
- package/build/typings/typings/middleware.d.ts +8 -0
- package/build/typings/typings/resolver-data.d.ts +8 -0
- package/build/typings/typings/resolvers-map.d.ts +11 -0
- package/build/typings/typings/subscriptions.d.ts +10 -0
- package/build/typings/typings/utils/ClassType.d.ts +7 -0
- package/build/typings/typings/utils/Constructor.d.ts +4 -0
- package/build/typings/typings/utils/Except.d.ts +74 -0
- package/build/typings/typings/utils/IsEqual.d.ts +24 -0
- package/build/typings/typings/utils/Maybe.d.ts +1 -0
- package/{dist/interfaces/Maybe.d.ts → build/typings/typings/utils/MaybePromise.d.ts} +0 -1
- package/build/typings/typings/utils/MergeExclusive.d.ts +36 -0
- package/build/typings/typings/utils/NonEmptyArray.d.ts +1 -0
- package/build/typings/typings/utils/SetRequired.d.ts +26 -0
- package/build/typings/typings/utils/Simplify.d.ts +58 -0
- package/build/typings/typings/utils/index.d.ts +10 -0
- package/{dist → build/typings}/utils/buildSchema.d.ts +9 -9
- package/{dist → build/typings}/utils/buildTypeDefsAndResolvers.d.ts +3 -3
- package/{dist → build/typings}/utils/container.d.ts +2 -4
- package/build/typings/utils/createResolversMap.d.ts +3 -0
- package/{dist → build/typings}/utils/emitSchemaDefinitionFile.d.ts +1 -1
- package/build/typings/utils/graphql-version.d.ts +2 -0
- package/build/typings/utils/index.d.ts +8 -0
- package/build/typings/utils/isPromiseLike.d.ts +1 -0
- package/package.json +162 -107
- package/dist/browser-shim.js +0 -73
- package/dist/decorators/Directive.d.ts +0 -2
- package/dist/decorators/Extensions.d.ts +0 -3
- package/dist/decorators/Info.d.ts +0 -2
- package/dist/decorators/PubSub.d.ts +0 -2
- package/dist/decorators/createMethodDecorator.d.ts +0 -2
- package/dist/decorators/createParamDecorator.d.ts +0 -3
- package/dist/decorators/index.d.ts +0 -24
- package/dist/decorators/unions.d.ts +0 -9
- package/dist/errors/ArgumentValidationError.d.ts +0 -5
- package/dist/errors/ForbiddenError.d.ts +0 -3
- package/dist/errors/ForbiddenError.js +0 -11
- package/dist/errors/GeneratingSchemaError.d.ts +0 -5
- package/dist/errors/UnauthorizedError.d.ts +0 -3
- package/dist/errors/UnauthorizedError.js +0 -11
- package/dist/errors/UnmetGraphQLPeerDependencyError.d.ts +0 -3
- package/dist/errors/index.d.ts +0 -15
- package/dist/helpers/auth-middleware.d.ts +0 -4
- package/dist/helpers/filesystem.d.ts +0 -9
- package/dist/helpers/filesystem.js +0 -74
- package/dist/helpers/utils.d.ts +0 -2
- package/dist/index.d.ts +0 -7
- package/dist/interfaces/AuthChecker.d.ts +0 -8
- package/dist/interfaces/AuthChecker.js +0 -3
- package/dist/interfaces/ClassType.d.ts +0 -3
- package/dist/interfaces/Complexity.d.ts +0 -2
- package/dist/interfaces/Complexity.js +0 -3
- package/dist/interfaces/LegacyDecorators.js +0 -3
- package/dist/interfaces/Middleware.d.ts +0 -10
- package/dist/interfaces/Middleware.js +0 -3
- package/dist/interfaces/NonEmptyArray.d.ts +0 -1
- package/dist/interfaces/NonEmptyArray.js +0 -3
- package/dist/interfaces/Publisher.d.ts +0 -1
- package/dist/interfaces/Publisher.js +0 -3
- package/dist/interfaces/ResolverData.d.ts +0 -10
- package/dist/interfaces/ResolverData.js +0 -3
- package/dist/interfaces/ResolverFilterData.d.ts +0 -8
- package/dist/interfaces/ResolverFilterData.js +0 -3
- package/dist/interfaces/ResolverInterface.js +0 -3
- package/dist/interfaces/ResolverTopicData.d.ts +0 -3
- package/dist/interfaces/ResolverTopicData.js +0 -3
- package/dist/interfaces/TypeResolver.js +0 -3
- package/dist/interfaces/ValidatorFn.d.ts +0 -2
- package/dist/interfaces/ValidatorFn.js +0 -3
- package/dist/interfaces/index.d.ts +0 -13
- package/dist/interfaces/index.js +0 -16
- package/dist/interfaces/resolvers-map.d.ts +0 -17
- package/dist/interfaces/resolvers-map.js +0 -3
- package/dist/metadata/definitions/authorized-metadata.js +0 -3
- package/dist/metadata/definitions/class-metadata.js +0 -3
- package/dist/metadata/definitions/directive-metadata.js +0 -3
- package/dist/metadata/definitions/enum-metadata.js +0 -3
- package/dist/metadata/definitions/extensions-metadata.js +0 -3
- package/dist/metadata/definitions/field-metadata.js +0 -3
- package/dist/metadata/definitions/index.d.ts +0 -10
- package/dist/metadata/definitions/interface-class-metadata.d.ts +0 -7
- package/dist/metadata/definitions/interface-class-metadata.js +0 -3
- package/dist/metadata/definitions/middleware-metadata.js +0 -3
- package/dist/metadata/definitions/object-class-metdata.d.ts +0 -4
- package/dist/metadata/definitions/object-class-metdata.js +0 -3
- package/dist/metadata/definitions/param-metadata.d.ts +0 -43
- package/dist/metadata/definitions/param-metadata.js +0 -3
- package/dist/metadata/definitions/resolver-metadata.d.ts +0 -43
- package/dist/metadata/definitions/resolver-metadata.js +0 -3
- package/dist/metadata/definitions/union-metadata.js +0 -3
- package/dist/metadata/getMetadataStorage.js +0 -9
- package/dist/metadata/index.d.ts +0 -1
- package/dist/resolvers/helpers.d.ts +0 -10
- package/dist/resolvers/validate-arg.d.ts +0 -4
- package/dist/scalars/index.d.ts +0 -3
- package/dist/scalars/index.js +0 -7
- package/dist/scalars/isodate.d.ts +0 -2
- package/dist/scalars/isodate.js +0 -35
- package/dist/scalars/timestamp.d.ts +0 -2
- package/dist/scalars/timestamp.js +0 -37
- package/dist/utils/createResolversMap.d.ts +0 -3
- package/dist/utils/graphql-version.d.ts +0 -3
- package/dist/utils/graphql-version.js +0 -25
- package/dist/utils/index.d.ts +0 -5
- package/dist/utils/isPromiseLike.d.ts +0 -1
- package/dist/utils/types.d.ts +0 -4
- package/dist/utils/types.js +0 -5
- /package/{dist → build/typings}/decorators/ArgsType.d.ts +0 -0
- /package/{dist → build/typings}/errors/CannotDetermineGraphQLTypeError.d.ts +0 -0
- /package/{dist → build/typings}/errors/InvalidDirectiveError.d.ts +0 -0
- /package/{dist → build/typings}/errors/MissingSubscriptionTopicsError.d.ts +0 -0
- /package/{dist → build/typings}/errors/NoExplicitTypeError.d.ts +0 -0
- /package/{dist → build/typings}/errors/ReflectMetadataMissingError.d.ts +0 -0
- /package/{dist → build/typings}/errors/SymbolKeysNotSupportedError.d.ts +0 -0
- /package/{dist → build/typings}/helpers/isThrowing.d.ts +0 -0
- /package/{dist → build/typings}/helpers/returnTypes.d.ts +0 -0
- /package/{dist → build/typings}/metadata/definitions/authorized-metadata.d.ts +0 -0
- /package/{dist → build/typings}/metadata/definitions/extensions-metadata.d.ts +0 -0
- /package/{dist → build/typings}/scalars/aliases.d.ts +0 -0
- /package/{dist/interfaces → build/typings/typings}/ResolverInterface.d.ts +0 -0
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
<!-- prettier-ignore-start -->
|
|
2
|
+
<!-- markdownlint-disable-next-line MD041 -->
|
|
3
|
+

|
|
4
|
+
<!-- prettier-ignore-end -->
|
|
2
5
|
|
|
3
6
|
# TypeGraphQL
|
|
4
7
|
|
|
8
|
+
[](https://github.com/MichalLytek/type-graphql/actions/workflows/release.yml)
|
|
9
|
+
[](https://github.com/MichalLytek/type-graphql/actions/workflows/website.yml)
|
|
10
|
+
[](https://github.com/MichalLytek/type-graphql/actions/workflows/codeql.yml)
|
|
5
11
|
[](https://badge.fury.io/js/type-graphql)
|
|
6
|
-
[](https://github.com/MichalLytek/type-graphql/actions/workflows/main.yml?query=branch%3Amaster)
|
|
7
12
|
[](https://codecov.io/gh/MichalLytek/type-graphql)
|
|
8
|
-
](https://packagephobia.now.sh/result?p=type-graphql)
|
|
13
|
+
[](https://opencollective.com/typegraphql)
|
|
14
|
+
[](https://packagephobia.com/result?p=type-graphql)
|
|
11
15
|
|
|
12
|
-
Create GraphQL schema and resolvers with TypeScript, using classes and decorators!
|
|
16
|
+
Create [GraphQL](https://graphql.org) schema and resolvers with [TypeScript](https://www.typescriptlang.org), using classes and decorators!
|
|
13
17
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
[](https://opencollective.com/typegraphql)
|
|
18
|
+
**<https://typegraphql.com>**
|
|
19
|
+
|
|
20
|
+
[](https://opencollective.com/typegraphql)
|
|
18
21
|
|
|
19
22
|
## Introduction
|
|
20
23
|
|
|
21
24
|
**TypeGraphQL** makes developing GraphQL APIs an enjoyable process, i.e. by defining the schema using only classes and a bit of decorator magic.
|
|
22
25
|
|
|
23
|
-
So, to create types like object type or input type, we use a kind of DTO
|
|
26
|
+
So, to create types like object type or input type, we use a kind of DTO class.
|
|
24
27
|
For example, to declare `Recipe` type we simply create a class and annotate it with decorators:
|
|
25
28
|
|
|
26
29
|
```ts
|
|
@@ -51,7 +54,7 @@ type Recipe {
|
|
|
51
54
|
}
|
|
52
55
|
```
|
|
53
56
|
|
|
54
|
-
Then we can create queries, mutations and field resolvers. For this purpose we use controller-like classes that are called "resolvers" by convention. We can also use awesome features like dependency injection and auth guards:
|
|
57
|
+
Then we can create queries, mutations and field resolvers. For this purpose, we use controller-like classes that are called "resolvers" by convention. We can also use awesome features like dependency injection and auth guards:
|
|
55
58
|
|
|
56
59
|
```ts
|
|
57
60
|
@Resolver(Recipe)
|
|
@@ -77,7 +80,7 @@ class RecipeResolver {
|
|
|
77
80
|
}
|
|
78
81
|
```
|
|
79
82
|
|
|
80
|
-
And in this simple way we get this part of the schema in SDL:
|
|
83
|
+
And in this simple way, we get this part of the schema in SDL:
|
|
81
84
|
|
|
82
85
|
```graphql
|
|
83
86
|
type Query {
|
|
@@ -91,11 +94,11 @@ type Mutation {
|
|
|
91
94
|
|
|
92
95
|
## Motivation
|
|
93
96
|
|
|
94
|
-
We all know that GraphQL is great and solves many problems we have with REST APIs, like
|
|
97
|
+
We all know that GraphQL is great and solves many problems we have with REST APIs, like Over-Fetching and Under-Fetching. But developing a GraphQL API in Node.js with TypeScript is sometimes a bit of a pain. Why? Let's take a look at the steps we usually have to take.
|
|
95
98
|
|
|
96
|
-
First, we create all the GraphQL types in `schema.
|
|
99
|
+
First, we create all the GraphQL types in `schema.graphql` using SDL. Then we create our data models using [ORM classes](https://github.com/typeorm/typeorm), which represent our DB entities. Then we start to write resolvers for our queries, mutations and fields, but this forces us to first create TS interfaces for all arguments, inputs, and even object types.
|
|
97
100
|
|
|
98
|
-
Only then can we
|
|
101
|
+
Only then can we implement the resolvers using weird generic signatures and manually performing common tasks, like validation, authorization and loading dependencies:
|
|
99
102
|
|
|
100
103
|
```ts
|
|
101
104
|
export const getRecipesResolver: GraphQLFieldResolver<void, Context, GetRecipesArgs> = async (
|
|
@@ -116,15 +119,15 @@ export const getRecipesResolver: GraphQLFieldResolver<void, Context, GetRecipesA
|
|
|
116
119
|
};
|
|
117
120
|
```
|
|
118
121
|
|
|
119
|
-
The biggest problem is redundancy in our codebase, which makes it difficult to keep things in sync. To add a new field to our entity, we have to jump through all the files - modify an entity class, the schema, as well as the interface. The same goes for inputs or arguments. It's easy to forget to update one piece or make a mistake with a single type. Also, what if we've made a typo in field name? The rename feature (F2) won't work correctly.
|
|
122
|
+
The biggest problem is redundancy in our codebase, which makes it difficult to keep things in sync. To add a new field to our entity, we have to jump through all the files - modify an entity class, the schema, as well as the interface. The same goes for inputs or arguments. It's easy to forget to update one piece or make a mistake with a single type. Also, what if we've made a typo in the field name? The rename feature (F2) won't work correctly.
|
|
120
123
|
|
|
121
|
-
Tools like [GraphQL Code Generator](https://github.com/dotansimha/graphql-code-generator) or [graphqlgen](https://github.com/prisma/graphqlgen) only solve the first part - they generate the corresponding interfaces (and resolvers skeletons) for our GraphQL schema but they don't fix the schema <--> models redundancy and developer experience (F2 rename won't work, you have to remember about the codegen watch task in background, etc.), as well as common tasks like validation, authorization, etc.
|
|
124
|
+
Tools like [GraphQL Code Generator](https://github.com/dotansimha/graphql-code-generator) or [graphqlgen](https://github.com/prisma/graphqlgen) only solve the first part - they generate the corresponding interfaces (and resolvers skeletons) for our GraphQL schema but they don't fix the schema <--> models redundancy and developer experience (F2 rename won't work, you have to remember about the codegen watch task in the background, etc.), as well as common tasks like validation, authorization, etc.
|
|
122
125
|
|
|
123
126
|
**TypeGraphQL** comes to address these issues, based on experience from a few years of developing GraphQL APIs in TypeScript. The main idea is to have only one source of truth by defining the schema using classes and some help from decorators. Additional features like dependency injection, validation and auth guards help with common tasks that normally we would have to handle ourselves.
|
|
124
127
|
|
|
125
128
|
## Documentation
|
|
126
129
|
|
|
127
|
-
The documentation, installation guide, detailed description of the API and all of its features
|
|
130
|
+
The documentation, installation guide, and detailed description of the API and all of its features are [available on the website](https://typegraphql.com).
|
|
128
131
|
|
|
129
132
|
### Getting started
|
|
130
133
|
|
|
@@ -136,9 +139,9 @@ If you prefer video tutorials, you can watch [Ben Awad](https://github.com/benaw
|
|
|
136
139
|
|
|
137
140
|
### Examples
|
|
138
141
|
|
|
139
|
-
You can also check the [examples folder](
|
|
142
|
+
You can also check the [examples folder](./examples) in this repository for more examples of usage: simple fields resolvers, DI Container support, TypeORM integration, automatic validation, etc.
|
|
140
143
|
|
|
141
|
-
The [Tests folder](
|
|
144
|
+
The [Tests folder](./tests) might also give you some tips on how to get various things done.
|
|
142
145
|
|
|
143
146
|
## Security contact information
|
|
144
147
|
|
|
@@ -148,19 +151,19 @@ Tidelift will coordinate the fix and disclosure.
|
|
|
148
151
|
|
|
149
152
|
## The future
|
|
150
153
|
|
|
151
|
-
The currently released version is a stable 1.0.0 release. It is well
|
|
154
|
+
The currently released version is a stable 1.0.0 release. It is well-tested (97% coverage, ~500 test cases) and has most of the planned features already implemented. Plenty of companies and independent developers are using it in production with success.
|
|
152
155
|
|
|
153
|
-
However, there are also plans for a lot more features like better TypeORM, Prisma and
|
|
156
|
+
However, there are also plans for a lot more features like better TypeORM, Prisma and DataLoader integration, custom decorators and metadata annotations support - [the full list of ideas](https://github.com/MichalLytek/type-graphql/issues?q=is%3Aissue+is%3Aopen+label%3A"Enhancement+%3Anew%3A") is available on the GitHub repo. You can also keep track of [development's progress on the project board](https://github.com/MichalLytek/type-graphql/projects/1).
|
|
154
157
|
|
|
155
158
|
If you have any interesting feature requests, feel free to open an issue on GitHub so we can discuss that!
|
|
156
159
|
|
|
157
160
|
## Support
|
|
158
161
|
|
|
159
|
-
TypeGraphQL is an MIT-licensed open
|
|
162
|
+
**TypeGraphQL** is an MIT-licensed open-source project. This framework is a result of the tremendous amount of work - sleepless nights, busy evenings and weekends.
|
|
160
163
|
|
|
161
|
-
It doesn't have a large company that sits behind - its ongoing development is possible only thanks to the support
|
|
164
|
+
It doesn't have a large company that sits behind it - its ongoing development is possible only thanks to the support of the community.
|
|
162
165
|
|
|
163
|
-
[](https://opencollective.com/typegraphql)
|
|
166
|
+
[](https://opencollective.com/typegraphql)
|
|
164
167
|
|
|
165
168
|
### Gold Sponsors 🏆
|
|
166
169
|
|
|
@@ -168,29 +171,29 @@ It doesn't have a large company that sits behind - its ongoing development is po
|
|
|
168
171
|
|
|
169
172
|
### Silver Sponsors 🥈
|
|
170
173
|
|
|
171
|
-
|
|
172
|
-
| :-----------------------------------------------------------------------------------------------------------------------------: |
|
|
173
|
-
| [**Lovd**](https://www.lovd.com/) |
|
|
174
|
+
> Please ask your company to support this open source project by [becoming a silver sponsor](https://opencollective.com/typegraphql/contribute/silver-sponsors-14804).
|
|
174
175
|
|
|
175
176
|
### Bronze Sponsors 🥉
|
|
176
177
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
|
178
|
+
<!-- markdownlint-disable MD033 -->
|
|
179
|
+
|
|
180
|
+
| [<img src="./images/live-graphics-system.png" width="55" alt="live graphic systems" />](https://www.ligrsystems.com) | [<img src="./images/lifex.png" width="60" alt="lifeX aps" />](https://www.joinlifex.com) | [<img src="./images/instinctools.svg" width="100" alt="instinctools" />](https://instinctools.com/manufacturing) | [<img src="./images/vps-server.png" width="125" alt="vps server" />](https://www.vpsserver.com) | [<img src="./images/nongamstopbets.png" width="50" alt="NonGamstopBets" />](https://www.nongamstopbets.com/casinos-not-on-gamstop/) | [<img src="./images/casinodeps.svg" width="80" alt="CasinoDeps.co.nz" />](https://casinodeps.co.nz/1-dollar-casinos/) |
|
|
181
|
+
| :------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------: |
|
|
182
|
+
| [**Live Graphic Systems**](https://www.ligrsystems.com) | [**LifeX Aps**](https://www.joinlifex.com/) | [**instinctools**](https://instinctools.com/manufacturing) | [**VPS Server**](https://www.vpsserver.com) | [**NonGamstopBets**](https://www.nongamstopbets.com/casinos-not-on-gamstop/) | [**CasinoDeps**](https://casinodeps.co.nz/1-dollar-casinos/) |
|
|
180
183
|
|
|
181
|
-
|
|
184
|
+
<!-- markdownlint-enable MD033 -->
|
|
185
|
+
|
|
186
|
+
[](https://opencollective.com/typegraphql)
|
|
182
187
|
|
|
183
188
|
### Members 💪
|
|
184
189
|
|
|
185
|
-
[](https://opencollective.com/typegraphql#contributors)
|
|
190
|
+
[](https://opencollective.com/typegraphql#contributors)
|
|
186
191
|
|
|
187
192
|
### GitHub Sponsors
|
|
188
193
|
|
|
189
|
-
](https://github.com/sponsors/TypeGraphQL)
|
|
190
195
|
|
|
191
196
|
## Want to help?
|
|
192
197
|
|
|
193
|
-
Want to file a bug, contribute some code, or improve documentation? Great! Please read our
|
|
194
|
-
guidelines for [
|
|
195
|
-
|
|
196
|
-
[contributing]: https://github.com/MichalLytek/type-graphql/blob/master/CONTRIBUTING.md
|
|
198
|
+
Want to file a bug, contribute some code, or improve the documentation? Great! Please read our
|
|
199
|
+
guidelines for [CONTRIBUTING](./CONTRIBUTING.md) and then check out one of our [help-wanted issues](https://github.com/MichalLytek/type-graphql/labels/Help%20Wanted%20%3Asos%3A).
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Arg = void 0;
|
|
4
|
-
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
5
|
-
const params_1 = require("../helpers/params");
|
|
6
4
|
const decorators_1 = require("../helpers/decorators");
|
|
5
|
+
const params_1 = require("../helpers/params");
|
|
6
|
+
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
7
7
|
function Arg(name, returnTypeFuncOrOptions, maybeOptions) {
|
|
8
8
|
return (prototype, propertyKey, parameterIndex) => {
|
|
9
9
|
const { options, returnTypeFunc } = (0, decorators_1.getTypeDecoratorParams)(returnTypeFuncOrOptions, maybeOptions);
|
|
@@ -24,4 +24,3 @@ function Arg(name, returnTypeFuncOrOptions, maybeOptions) {
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
exports.Arg = Arg;
|
|
27
|
-
//# sourceMappingURL=Arg.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Args = void 0;
|
|
4
|
-
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
5
|
-
const params_1 = require("../helpers/params");
|
|
6
4
|
const decorators_1 = require("../helpers/decorators");
|
|
5
|
+
const params_1 = require("../helpers/params");
|
|
6
|
+
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
7
7
|
function Args(paramTypeFnOrOptions, maybeOptions) {
|
|
8
8
|
const { options, returnTypeFunc } = (0, decorators_1.getTypeDecoratorParams)(paramTypeFnOrOptions, maybeOptions);
|
|
9
9
|
return (prototype, propertyKey, parameterIndex) => {
|
|
@@ -14,4 +14,3 @@ function Args(paramTypeFnOrOptions, maybeOptions) {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
exports.Args = Args;
|
|
17
|
-
//# sourceMappingURL=Args.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Authorized = void 0;
|
|
4
|
-
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
5
4
|
const errors_1 = require("../errors");
|
|
6
5
|
const decorators_1 = require("../helpers/decorators");
|
|
6
|
+
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
7
7
|
function Authorized(...rolesOrRolesArray) {
|
|
8
8
|
const roles = (0, decorators_1.getArrayFromOverloadedRest)(rolesOrRolesArray);
|
|
9
|
-
return (prototype, propertyKey,
|
|
9
|
+
return (prototype, propertyKey, _descriptor) => {
|
|
10
10
|
if (typeof propertyKey === "symbol") {
|
|
11
11
|
throw new errors_1.SymbolKeysNotSupportedError();
|
|
12
12
|
}
|
|
@@ -18,4 +18,3 @@ function Authorized(...rolesOrRolesArray) {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
exports.Authorized = Authorized;
|
|
21
|
-
//# sourceMappingURL=Authorized.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Ctx = void 0;
|
|
4
|
-
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
5
4
|
const errors_1 = require("../errors");
|
|
5
|
+
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
6
6
|
function Ctx(propertyName) {
|
|
7
7
|
return (prototype, propertyKey, parameterIndex) => {
|
|
8
8
|
if (typeof propertyKey === "symbol") {
|
|
@@ -18,4 +18,3 @@ function Ctx(propertyName) {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
exports.Ctx = Ctx;
|
|
21
|
-
//# sourceMappingURL=Ctx.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Directive = void 0;
|
|
4
|
+
const errors_1 = require("../errors");
|
|
5
|
+
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
6
|
+
function Directive(nameOrDefinition) {
|
|
7
|
+
return (targetOrPrototype, propertyKey, parameterIndexOrDescriptor) => {
|
|
8
|
+
const directive = { nameOrDefinition, args: {} };
|
|
9
|
+
if (typeof propertyKey === "symbol") {
|
|
10
|
+
throw new errors_1.SymbolKeysNotSupportedError();
|
|
11
|
+
}
|
|
12
|
+
if (propertyKey) {
|
|
13
|
+
if (typeof parameterIndexOrDescriptor === "number") {
|
|
14
|
+
(0, getMetadataStorage_1.getMetadataStorage)().collectDirectiveArgumentMetadata({
|
|
15
|
+
target: targetOrPrototype.constructor,
|
|
16
|
+
fieldName: propertyKey,
|
|
17
|
+
parameterIndex: parameterIndexOrDescriptor,
|
|
18
|
+
directive,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
(0, getMetadataStorage_1.getMetadataStorage)().collectDirectiveFieldMetadata({
|
|
23
|
+
target: targetOrPrototype.constructor,
|
|
24
|
+
fieldName: propertyKey,
|
|
25
|
+
directive,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
(0, getMetadataStorage_1.getMetadataStorage)().collectDirectiveClassMetadata({
|
|
31
|
+
target: targetOrPrototype,
|
|
32
|
+
directive,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
exports.Directive = Directive;
|
|
@@ -4,7 +4,7 @@ exports.Extensions = void 0;
|
|
|
4
4
|
const errors_1 = require("../errors");
|
|
5
5
|
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
6
6
|
function Extensions(extensions) {
|
|
7
|
-
return (targetOrPrototype, propertyKey,
|
|
7
|
+
return (targetOrPrototype, propertyKey, _descriptor) => {
|
|
8
8
|
if (typeof propertyKey === "symbol") {
|
|
9
9
|
throw new errors_1.SymbolKeysNotSupportedError();
|
|
10
10
|
}
|
|
@@ -24,4 +24,3 @@ function Extensions(extensions) {
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
exports.Extensions = Extensions;
|
|
27
|
-
//# sourceMappingURL=Extensions.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Field = void 0;
|
|
4
|
-
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
5
|
-
const findType_1 = require("../helpers/findType");
|
|
6
|
-
const decorators_1 = require("../helpers/decorators");
|
|
7
4
|
const errors_1 = require("../errors");
|
|
5
|
+
const decorators_1 = require("../helpers/decorators");
|
|
6
|
+
const findType_1 = require("../helpers/findType");
|
|
7
|
+
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
8
8
|
function Field(returnTypeFuncOrOptions, maybeOptions) {
|
|
9
9
|
return (prototype, propertyKey, descriptor) => {
|
|
10
10
|
if (typeof propertyKey === "symbol") {
|
|
@@ -43,4 +43,3 @@ function Field(returnTypeFuncOrOptions, maybeOptions) {
|
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
45
|
exports.Field = Field;
|
|
46
|
-
//# sourceMappingURL=Field.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FieldResolver = void 0;
|
|
4
|
-
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
5
4
|
const errors_1 = require("../errors");
|
|
6
5
|
const decorators_1 = require("../helpers/decorators");
|
|
7
6
|
const findType_1 = require("../helpers/findType");
|
|
7
|
+
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
8
8
|
function FieldResolver(returnTypeFuncOrOptions, maybeOptions) {
|
|
9
9
|
return (prototype, propertyKey) => {
|
|
10
10
|
if (typeof propertyKey === "symbol") {
|
|
@@ -13,7 +13,6 @@ function FieldResolver(returnTypeFuncOrOptions, maybeOptions) {
|
|
|
13
13
|
let getType;
|
|
14
14
|
let typeOptions;
|
|
15
15
|
const { options, returnTypeFunc } = (0, decorators_1.getTypeDecoratorParams)(returnTypeFuncOrOptions, maybeOptions);
|
|
16
|
-
// try to get return type info
|
|
17
16
|
try {
|
|
18
17
|
const typeInfo = (0, findType_1.findType)({
|
|
19
18
|
metadataKey: "design:returntype",
|
|
@@ -26,7 +25,6 @@ function FieldResolver(returnTypeFuncOrOptions, maybeOptions) {
|
|
|
26
25
|
getType = typeInfo.getType;
|
|
27
26
|
}
|
|
28
27
|
catch {
|
|
29
|
-
// tslint:disable-next-line:no-empty
|
|
30
28
|
}
|
|
31
29
|
(0, getMetadataStorage_1.getMetadataStorage)().collectFieldResolverMetadata({
|
|
32
30
|
kind: "external",
|
|
@@ -42,4 +40,3 @@ function FieldResolver(returnTypeFuncOrOptions, maybeOptions) {
|
|
|
42
40
|
};
|
|
43
41
|
}
|
|
44
42
|
exports.FieldResolver = FieldResolver;
|
|
45
|
-
//# sourceMappingURL=FieldResolver.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Info = void 0;
|
|
4
|
-
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
5
4
|
const errors_1 = require("../errors");
|
|
5
|
+
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
6
6
|
function Info() {
|
|
7
7
|
return (prototype, propertyKey, parameterIndex) => {
|
|
8
8
|
if (typeof propertyKey === "symbol") {
|
|
@@ -17,4 +17,3 @@ function Info() {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
exports.Info = Info;
|
|
20
|
-
//# sourceMappingURL=Info.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InputType = void 0;
|
|
4
|
-
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
5
4
|
const decorators_1 = require("../helpers/decorators");
|
|
5
|
+
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
6
6
|
function InputType(nameOrOptions, maybeOptions) {
|
|
7
7
|
const { name, options } = (0, decorators_1.getNameDecoratorParams)(nameOrOptions, maybeOptions);
|
|
8
8
|
return target => {
|
|
@@ -14,4 +14,3 @@ function InputType(nameOrOptions, maybeOptions) {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
exports.InputType = InputType;
|
|
17
|
-
//# sourceMappingURL=InputType.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InterfaceType = void 0;
|
|
4
|
-
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
5
4
|
const decorators_1 = require("../helpers/decorators");
|
|
5
|
+
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
6
6
|
function InterfaceType(nameOrOptions, maybeOptions) {
|
|
7
7
|
const { name, options } = (0, decorators_1.getNameDecoratorParams)(nameOrOptions, maybeOptions);
|
|
8
8
|
const interfaceClasses = options.implements && [].concat(options.implements);
|
|
@@ -17,4 +17,3 @@ function InterfaceType(nameOrOptions, maybeOptions) {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
exports.InterfaceType = InterfaceType;
|
|
20
|
-
//# sourceMappingURL=InterfaceType.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Mutation = void 0;
|
|
4
|
-
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
5
|
-
const resolver_metadata_1 = require("../helpers/resolver-metadata");
|
|
6
4
|
const decorators_1 = require("../helpers/decorators");
|
|
5
|
+
const resolver_metadata_1 = require("../helpers/resolver-metadata");
|
|
6
|
+
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
7
7
|
function Mutation(returnTypeFuncOrOptions, maybeOptions) {
|
|
8
8
|
const { options, returnTypeFunc } = (0, decorators_1.getTypeDecoratorParams)(returnTypeFuncOrOptions, maybeOptions);
|
|
9
9
|
return (prototype, methodName) => {
|
|
@@ -12,4 +12,3 @@ function Mutation(returnTypeFuncOrOptions, maybeOptions) {
|
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
exports.Mutation = Mutation;
|
|
15
|
-
//# sourceMappingURL=Mutation.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ObjectType = void 0;
|
|
4
|
-
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
5
4
|
const decorators_1 = require("../helpers/decorators");
|
|
5
|
+
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
6
6
|
function ObjectType(nameOrOptions, maybeOptions) {
|
|
7
7
|
const { name, options } = (0, decorators_1.getNameDecoratorParams)(nameOrOptions, maybeOptions);
|
|
8
8
|
const interfaceClasses = options.implements && [].concat(options.implements);
|
|
@@ -17,4 +17,3 @@ function ObjectType(nameOrOptions, maybeOptions) {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
exports.ObjectType = ObjectType;
|
|
20
|
-
//# sourceMappingURL=ObjectType.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Query = void 0;
|
|
4
|
-
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
5
|
-
const resolver_metadata_1 = require("../helpers/resolver-metadata");
|
|
6
4
|
const decorators_1 = require("../helpers/decorators");
|
|
5
|
+
const resolver_metadata_1 = require("../helpers/resolver-metadata");
|
|
6
|
+
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
7
7
|
function Query(returnTypeFuncOrOptions, maybeOptions) {
|
|
8
8
|
const { options, returnTypeFunc } = (0, decorators_1.getTypeDecoratorParams)(returnTypeFuncOrOptions, maybeOptions);
|
|
9
9
|
return (prototype, methodName) => {
|
|
@@ -12,4 +12,3 @@ function Query(returnTypeFuncOrOptions, maybeOptions) {
|
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
exports.Query = Query;
|
|
15
|
-
//# sourceMappingURL=Query.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Root = void 0;
|
|
4
|
-
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
5
|
-
const findType_1 = require("../helpers/findType");
|
|
6
4
|
const errors_1 = require("../errors");
|
|
5
|
+
const findType_1 = require("../helpers/findType");
|
|
6
|
+
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
7
7
|
function Root(propertyName) {
|
|
8
8
|
return (prototype, propertyKey, parameterIndex) => {
|
|
9
9
|
if (typeof propertyKey === "symbol") {
|
|
@@ -20,7 +20,6 @@ function Root(propertyName) {
|
|
|
20
20
|
getType = typeInfo.getType;
|
|
21
21
|
}
|
|
22
22
|
catch {
|
|
23
|
-
// tslint:disable-next-line:no-empty
|
|
24
23
|
}
|
|
25
24
|
(0, getMetadataStorage_1.getMetadataStorage)().collectHandlerParamMetadata({
|
|
26
25
|
kind: "root",
|
|
@@ -33,4 +32,3 @@ function Root(propertyName) {
|
|
|
33
32
|
};
|
|
34
33
|
}
|
|
35
34
|
exports.Root = Root;
|
|
36
|
-
//# sourceMappingURL=Root.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Subscription = void 0;
|
|
4
|
-
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
5
|
-
const resolver_metadata_1 = require("../helpers/resolver-metadata");
|
|
6
|
-
const decorators_1 = require("../helpers/decorators");
|
|
7
4
|
const errors_1 = require("../errors");
|
|
5
|
+
const decorators_1 = require("../helpers/decorators");
|
|
6
|
+
const resolver_metadata_1 = require("../helpers/resolver-metadata");
|
|
7
|
+
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
8
8
|
function Subscription(returnTypeFuncOrOptions, maybeOptions) {
|
|
9
9
|
const params = (0, decorators_1.getTypeDecoratorParams)(returnTypeFuncOrOptions, maybeOptions);
|
|
10
10
|
const options = params.options;
|
|
@@ -16,10 +16,10 @@ function Subscription(returnTypeFuncOrOptions, maybeOptions) {
|
|
|
16
16
|
(0, getMetadataStorage_1.getMetadataStorage)().collectSubscriptionHandlerMetadata({
|
|
17
17
|
...metadata,
|
|
18
18
|
topics: options.topics,
|
|
19
|
+
topicId: options.topicId,
|
|
19
20
|
filter: options.filter,
|
|
20
21
|
subscribe: options.subscribe,
|
|
21
22
|
});
|
|
22
23
|
};
|
|
23
24
|
}
|
|
24
25
|
exports.Subscription = Subscription;
|
|
25
|
-
//# sourceMappingURL=Subscription.js.map
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UseMiddleware = void 0;
|
|
4
4
|
const errors_1 = require("../errors");
|
|
5
|
-
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
6
5
|
const decorators_1 = require("../helpers/decorators");
|
|
6
|
+
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
7
7
|
function UseMiddleware(...middlewaresOrMiddlewareArray) {
|
|
8
8
|
const middlewares = (0, decorators_1.getArrayFromOverloadedRest)(middlewaresOrMiddlewareArray);
|
|
9
|
-
return (prototype, propertyKey,
|
|
9
|
+
return (prototype, propertyKey, _descriptor) => {
|
|
10
10
|
if (typeof propertyKey === "symbol") {
|
|
11
11
|
throw new errors_1.SymbolKeysNotSupportedError();
|
|
12
12
|
}
|
|
@@ -18,4 +18,3 @@ function UseMiddleware(...middlewaresOrMiddlewareArray) {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
exports.UseMiddleware = UseMiddleware;
|
|
21
|
-
//# sourceMappingURL=UseMiddleware.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createParamDecorator = void 0;
|
|
4
|
-
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
5
4
|
const errors_1 = require("../errors");
|
|
5
|
+
const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
|
|
6
6
|
function createParamDecorator(resolver) {
|
|
7
7
|
return (prototype, propertyKey, parameterIndex) => {
|
|
8
8
|
if (typeof propertyKey === "symbol") {
|
|
@@ -18,4 +18,3 @@ function createParamDecorator(resolver) {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
exports.createParamDecorator = createParamDecorator;
|
|
21
|
-
//# sourceMappingURL=createParamDecorator.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UseMiddleware = exports.createUnionType = exports.Subscription = exports.Root = exports.Resolver = exports.Query = exports.
|
|
3
|
+
exports.UseMiddleware = exports.createUnionType = exports.Subscription = exports.Root = exports.Resolver = exports.Query = exports.ObjectType = exports.Mutation = exports.InterfaceType = exports.InputType = exports.Info = exports.FieldResolver = exports.Field = exports.registerEnumType = exports.Extensions = exports.Directive = exports.Ctx = exports.createMethodDecorator = exports.createParamDecorator = exports.Authorized = exports.ArgsType = exports.Args = exports.Arg = void 0;
|
|
4
4
|
var Arg_1 = require("./Arg");
|
|
5
5
|
Object.defineProperty(exports, "Arg", { enumerable: true, get: function () { return Arg_1.Arg; } });
|
|
6
6
|
var Args_1 = require("./Args");
|
|
@@ -35,8 +35,6 @@ var Mutation_1 = require("./Mutation");
|
|
|
35
35
|
Object.defineProperty(exports, "Mutation", { enumerable: true, get: function () { return Mutation_1.Mutation; } });
|
|
36
36
|
var ObjectType_1 = require("./ObjectType");
|
|
37
37
|
Object.defineProperty(exports, "ObjectType", { enumerable: true, get: function () { return ObjectType_1.ObjectType; } });
|
|
38
|
-
var PubSub_1 = require("./PubSub");
|
|
39
|
-
Object.defineProperty(exports, "PubSub", { enumerable: true, get: function () { return PubSub_1.PubSub; } });
|
|
40
38
|
var Query_1 = require("./Query");
|
|
41
39
|
Object.defineProperty(exports, "Query", { enumerable: true, get: function () { return Query_1.Query; } });
|
|
42
40
|
var Resolver_1 = require("./Resolver");
|
|
@@ -49,4 +47,3 @@ var unions_1 = require("./unions");
|
|
|
49
47
|
Object.defineProperty(exports, "createUnionType", { enumerable: true, get: function () { return unions_1.createUnionType; } });
|
|
50
48
|
var UseMiddleware_1 = require("./UseMiddleware");
|
|
51
49
|
Object.defineProperty(exports, "UseMiddleware", { enumerable: true, get: function () { return UseMiddleware_1.UseMiddleware; } });
|
|
52
|
-
//# sourceMappingURL=index.js.map
|