Skip to content

Commit

Permalink
Typescript definition generation added to tsconfig.json
Browse files Browse the repository at this point in the history
You already write postgraphql in typescript with this pull request all other typescript progammers can benefit from this when they use postgraphql as library instead as cli tool.
  • Loading branch information
Malte Legenhausen committed Mar 6, 2017
1 parent a88a983 commit 955c9e8
Show file tree
Hide file tree
Showing 19 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/graphql/schema/BuildToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { Inventory, Type, ObjectType } from '../../interface'
* access `Inventory` and other options from arbitrary functions is
* necessary, a `BuildToken` makes that possible.
*/
interface BuildToken {
export interface BuildToken {
// The `Inventory` we are using to build the GraphQL schema.
readonly inventory: Inventory,
// Some options we can use to configure how we build our GraphQL schema.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { formatName, scrib } from '../../utils'
import getGqlInputType from '../type/getGqlInputType'
import BuildToken from '../BuildToken'

type CollectionKeyInputHelpers<TKey> = {
export type CollectionKeyInputHelpers<TKey> = {
fieldEntries: Array<[string, GraphQLInputFieldConfig]>,
getKeyFromInput: (input: { [key: string]: mixed }) => TKey,
}
Expand Down
2 changes: 1 addition & 1 deletion src/graphql/schema/connection/createConnectionGqlField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ export const _pageInfoType: GraphQLObjectType =
*
* @private
*/
interface Connection<TInput, TItemValue, TCursor> {
export interface Connection<TInput, TItemValue, TCursor> {
paginator: Paginator<TInput, TItemValue>
orderingName: string
input: TInput
Expand Down
2 changes: 1 addition & 1 deletion src/graphql/schema/createMutationGqlField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import createMutationPayloadGqlType from './createMutationPayloadGqlType'
*
* @private
*/
type MutationFieldConfig<T> = {
export type MutationFieldConfig<T> = {
name: string,
description?: string | undefined,
inputFields?: Array<[string, GraphQLInputFieldConfig] | false | null | undefined>,
Expand Down
2 changes: 1 addition & 1 deletion src/graphql/schema/type/getGqlInputType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import getGqlOutputType from './getGqlOutputType'
*
* @private
*/
type GetGqlInputReturn<TValue> = {
export type GetGqlInputReturn<TValue> = {
gqlType: GraphQLInputType,
fromGqlInput: (gqlInput: mixed) => TValue,
}
Expand Down
2 changes: 1 addition & 1 deletion src/graphql/schema/type/getGqlOutputType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import aliasGqlType from './aliasGqlType'
*
* @private
*/
type GetGqlOutputTypeReturn<TValue> = {
export type GetGqlOutputTypeReturn<TValue> = {
gqlType: GraphQLOutputType,
intoGqlOutput: (value: TValue) => mixed,
}
Expand Down
20 changes: 10 additions & 10 deletions src/interface/collection/Condition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// TODO: Consider some geographic operators.
// TODO: Consider some array operators.
// TODO: REFACTOR!!!! The fact that this isn’t type safe is a little scary…
type Condition =
export type Condition =
ConstantCondition |
NotCondition |
AndCondition |
Expand Down Expand Up @@ -77,37 +77,37 @@ export namespace conditionHelpers {
*
* As a bonus, this makes for a nice condition DSL experience.
*/
type ConstantCondition = boolean
export type ConstantCondition = boolean

/**
* Inverts the result of a condition. If a condition would be true, it is now
* false.
*/
type NotCondition = {
export type NotCondition = {
type: 'NOT',
condition: Condition,
}

/**
* Ensures all child conditions must be true before this condition is true.
*/
type AndCondition = {
export type AndCondition = {
type: 'AND',
conditions: Array<Condition>,
}

/**
* If even one child condition is true, than this condition will be true.
*/
type OrCondition = {
export type OrCondition = {
type: 'OR',
conditions: Array<Condition>,
}

/**
* Checks that a named field of an object value passes a given condition.
*/
type FieldCondition = {
export type FieldCondition = {
type: 'FIELD',
name: string,
condition: Condition,
Expand All @@ -123,7 +123,7 @@ type FieldCondition = {
* To use an “is null” operator, set `value` to `null`, for “is not null” use a
* `NotCondition` as well.
*/
type EqualCondition = {
export type EqualCondition = {
type: 'EQUAL',
value: mixed,
}
Expand All @@ -135,7 +135,7 @@ type EqualCondition = {
* For a less than or equal to condition, use the `OrCondition` with an
* `EqualCondition`.
*/
type LessThanCondition = {
export type LessThanCondition = {
type: 'LESS_THAN',
value: mixed,
}
Expand All @@ -147,15 +147,15 @@ type LessThanCondition = {
* Use an `OrCondition` with an `EqualCondition` to get a condition for
* greater than or equal to.
*/
type GreaterThanCondition = {
export type GreaterThanCondition = {
type: 'GREATER_THAN',
value: mixed,
}

/**
* Asserts that the actual value matches our provided regular expression.
*/
type RegexpCondition = {
export type RegexpCondition = {
type: 'REGEXP',
regexp: RegExp,
}
2 changes: 1 addition & 1 deletion src/interface/type/switchType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import ScalarType from './ScalarType'
*
* @private
*/
type SwitchTypeCases<T> = {
export type SwitchTypeCases<T> = {
adapter?: (type: AdapterType<mixed>) => T,
nullable: (type: NullableType<mixed>) => T,
list: (type: ListType<mixed, mixed>) => T,
Expand Down
2 changes: 1 addition & 1 deletion src/postgraphql/postgraphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import createPostGraphQLHttpRequestHandler, { HttpRequestHandler } from './http/
import exportPostGraphQLSchema from './schema/exportPostGraphQLSchema'
import watchPgSchemas from './watch/watchPgSchemas'

type PostGraphQLOptions = {
export type PostGraphQLOptions = {
classicIds?: boolean,
dynamicJson?: boolean,
graphqlRoute?: string,
Expand Down
2 changes: 1 addition & 1 deletion src/postgraphql/schema/procedures/PgProcedurePaginator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import createPgProcedureSqlCall from './createPgProcedureSqlCall'
*
* @private
*/
type ProcedureInput = Array<mixed>
export type ProcedureInput = Array<mixed>

/**
* A procedure paginator is one in which a Postgres function is the source of
Expand Down
2 changes: 1 addition & 1 deletion src/postgres/introspection/object/PgCatalogConstraint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export interface PgCatalogUniqueConstraint extends PgCatalogBaseConstraint {
*
* @private
*/
interface PgCatalogBaseConstraint {
export interface PgCatalogBaseConstraint {
readonly kind: 'constraint'
readonly name: string
}
2 changes: 1 addition & 1 deletion src/postgres/introspection/object/PgCatalogType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export interface PgCatalogRangeType extends PgCatalogBaseType {
*
* @private
*/
interface PgCatalogBaseType {
export interface PgCatalogBaseType {
readonly kind: 'type'
readonly id: string
readonly name: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import PgPaginator from './PgPaginator'
*
* @private
*/
type AttributesCursor = Array<mixed>
export type AttributesCursor = Array<mixed>

/**
* The `PgPaginatorOrderingAttributes` paginator ordering implements an
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import PgPaginator from './PgPaginator'
*
* @private
*/
type OffsetCursor = number
export type OffsetCursor = number

/**
* The `PgPaginatorOrderingOffset` implements an ordering strategy based solely
Expand Down
2 changes: 1 addition & 1 deletion src/postgres/inventory/type/PgClassType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import getTypeFromPgType from './getTypeFromPgType'
import PgType from './PgType'

// We use an interface here to hide the implementation destails.
interface PgRow extends Map<string, mixed> {}
export interface PgRow extends Map<string, mixed> {}

class PgClassType extends PgType<PgRow> implements ObjectType<PgRow> {
public readonly kind: 'OBJECT' = 'OBJECT'
Expand Down
2 changes: 1 addition & 1 deletion src/postgres/inventory/type/PgRangeType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { PgCatalog, PgCatalogRangeType } from '../../introspection'
import getTypeFromPgType from './getTypeFromPgType'
import PgType from './PgType'

interface PgRange<T> {
export interface PgRange<T> {
start?: { value: T, inclusive: boolean } | null
end?: { value: T, inclusive: boolean } | null
}
Expand Down
2 changes: 1 addition & 1 deletion src/postgres/inventory/type/custom/pgIntervalType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import pgIntegerType from '../scalar/pgIntegerType'
import PgType from '../PgType'
import PgNullableType from '../PgNullableType'

interface PgInterval {
export interface PgInterval {
seconds?: number
minutes?: number
hours?: number
Expand Down
2 changes: 1 addition & 1 deletion src/postgres/utils/sql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { QueryConfig } from 'pg'
import minify = require('pg-minify')

namespace sql {
type NestedArray<T> = Array<T> | Array<Array<T>> | Array<Array<Array<T>>> | Array<Array<Array<Array<T>>>>
export type NestedArray<T> = Array<T> | Array<Array<T>> | Array<Array<Array<T>>> | Array<Array<Array<Array<T>>>>

/**
* Many `SqlItem`s make up a `Sql` query. Different types of items are used to
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"allowJs": true,
"rootDir": "src",
"outDir": "build",
"declaration": true,
"target": "es5",
"lib": ["es2015"],
"module": "commonjs",
Expand Down

0 comments on commit 955c9e8

Please sign in to comment.