diff --git a/dist/context.d.ts b/dist/context.d.ts new file mode 100644 index 0000000..1ff7390 --- /dev/null +++ b/dist/context.d.ts @@ -0,0 +1,11 @@ +export interface ContextData { + models: Object; + user: Object; +} +export declare const createExpressContext: (data: any, res: any) => Context; +export declare class Context { + models: Object; + user: Object; + constructor(data: ContextData); + dispose(): void; +} diff --git a/dist/helper.d.ts b/dist/helper.d.ts new file mode 100644 index 0000000..bc3bb32 --- /dev/null +++ b/dist/helper.d.ts @@ -0,0 +1 @@ +export declare const combineResolvers: (resolvers?: any[]) => any; diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..8be43e8 --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,5 @@ +import { usePromise } from './promise'; +import { combineResolvers } from './helper'; +import { createExpressContext } from './context'; +import { createResolver } from './resolver'; +export { usePromise, combineResolvers, createExpressContext, createResolver }; diff --git a/dist/promise.d.ts b/dist/promise.d.ts new file mode 100644 index 0000000..c69594c --- /dev/null +++ b/dist/promise.d.ts @@ -0,0 +1,2 @@ +export declare const usePromise: (pLib: any) => void; +export declare const getPromise: () => PromiseConstructor; diff --git a/dist/resolver.d.ts b/dist/resolver.d.ts new file mode 100644 index 0000000..a00a739 --- /dev/null +++ b/dist/resolver.d.ts @@ -0,0 +1 @@ +export declare const createResolver: (resFn: any, errFn: any) => (root: any, args?: {}, context?: {}) => Promise; diff --git a/dist/util.d.ts b/dist/util.d.ts new file mode 100644 index 0000000..1d83213 --- /dev/null +++ b/dist/util.d.ts @@ -0,0 +1,3 @@ +export declare const isFunction: (fn: any) => boolean; +export declare const Promisify: (fn: any) => (...args: any[]) => Promise<{}>; +export declare const isNotNullOrUndefined: (val: any) => boolean; diff --git a/package.json b/package.json index 23075c5..d37025e 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "1.0.3", "description": "Expressive and composable resolvers for Apollostack's GraphQL server Edit", "main": "dist/index.js", + "types": "dist/index.d.ts", "scripts": { "test": "make test" }, diff --git a/src/context.ts b/src/context.ts index 76f0088..9b9d00c 100644 --- a/src/context.ts +++ b/src/context.ts @@ -1,5 +1,5 @@ import * as assert from 'assert'; -interface ContextData { +export interface ContextData { models: Object; user: Object; }; diff --git a/tsconfig.json b/tsconfig.json index 64eac8b..cb7fe2b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,10 +3,10 @@ "target": "es2015", "module": "commonjs", "moduleResolution": "node", + "declaration": true, "sourceMap": true, "removeComments": false, "noImplicitAny": false, - "allowJs": true, "outDir": "./dist" }, "include": [