Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript #8

Closed
TimMikeladze opened this issue May 26, 2016 · 12 comments
Closed

Typescript #8

TimMikeladze opened this issue May 26, 2016 · 12 comments

Comments

@TimMikeladze
Copy link

TimMikeladze commented May 26, 2016

Since the client is written in Typescript, I think it makes sense for server to be as well.

@helfer
Copy link
Contributor

helfer commented May 26, 2016

@TimMikeladze Yeah, we have an issue open on graphql-tools (which originally contained apollo server) ardatan/graphql-tools#6

Would be great to use Typescript for apollo-server as well, and should be less work than for graphql-tools, because there's less code. Do you want to take a stab at it and work on a PR? I'm sure @jbaxleyiii would be happy to give guidance.

@TimMikeladze
Copy link
Author

Yep, going through the code now. Will send a PR.

@helfer
Copy link
Contributor

helfer commented May 26, 2016

Awesome!

@helfer
Copy link
Contributor

helfer commented May 27, 2016

@nnance also expressed interest in working on this. We could do this rewrite in conjunction with adding Hapi support. Let's use this issue thread to talk about the typescript implementation, and how we can factor out the core parts of Apollo server so it's easy to write bindings for Hapi, Express and Koa!

@bkinsey808
Copy link

Hi folks, I'm interested in possibly helping with this. I like typescript and I like graphql, so what will it take to get these two playing nicely together on the server?

@nnance
Copy link
Contributor

nnance commented May 27, 2016

I have started a prototype of the architecture I would recommend based on TypeScript. You can find it here. I will try to have it working with Express and Hapi by the end of the day. This is a super naive implementation but represents the architecture I would recommend. Apollo server should be a wrapper / extension of the core Graphql JS library and completely separated from the web frameworks like Express, Hapi, Koa, etc. In fact the Apollo server should have an API that doesn't interact with the aspects of HTTP (Request, Response) at all. To this point I think we should start a conversation of what the API for Apollo Server should be. From there we can divid up the work with someone building the Apollo Server core and others building the web framework wrappers. To start the conversation I would recommend the following:

  1. Apollo Server would be a class that would be instantiated with a schema and validation rules
  2. It would have a method called fulfillQuery that would parse, validate and execute the query returning an object that would contain an errors and or data

This matches my prototype. However, we could change the api to separate the calls to parse, validate and execute much like the Graphql api. I prefer a simple api.

Thoughts?

@HriBB
Copy link
Contributor

HriBB commented May 28, 2016

I use Koa and would love to help. Will check out your implementation soon

@helfer
Copy link
Contributor

helfer commented Jun 1, 2016

I will try to do start a rewrite today, and do #11 at the same time.

@nnance
Copy link
Contributor

nnance commented Jun 1, 2016

@helfer I am interested in helping if you can think of a plan to divid up the work. just let me know.

@helfer
Copy link
Contributor

helfer commented Jun 1, 2016

@nnance Yes, we can definitely split it up. I think the easiest way is if I write the core, and you write the bindings for express and HAPI.

@HriBB would you be interested in writing the bindings for Koa?

@HriBB
Copy link
Contributor

HriBB commented Jun 2, 2016

@helfer sure, I can give it a try. Will do some research ...

@helfer
Copy link
Contributor

helfer commented Jun 29, 2016

Closing this in favor of #11, which is implemented in typescript.

@helfer helfer closed this as completed Jun 29, 2016
evans pushed a commit that referenced this issue Jun 27, 2018
…rver-env (#1259)

* Export polyfills and types separately

* More imports from apollo-server-env

* Initial commit

* Add .npmignore to avoid ignoring lib when publishing

* 0.0.2

* Reorganize code and clean up GraphQLExtension interface

* 0.0.3

* Add support for timing callbacks and add GraphQLExtensionStack

* 0.0.4

* Downgrade target in tsconfig.json from es2015 to es5

* 0.0.5

* Bump `graphql` peerDependency. (#3)

* 0.0.6

* Update dependencies

* 0.0.7

* whenResultIsFinished fix for array results (#4)

* 0.0.8

* [apollo-bot] Update the Issue/PR Templates with auto label (#6)

* Bump `graphql` peerDependency. (#7)

* Update `graphql` peer dependency range to allow 0.13.x. (#8)

* Update `devDependencies` to latest versions. (#9)

* dev: Update TypeScript to latest version, v2.7.2.

* dev: Update `graphql` to latest version, v0.13.2.

* dev: Update jest & dependencies to latest versions.

* dev: Update type definitions for `graphql`, `node` and `jest`.

* Allow `undefined` return values to `GraphQLExtension`'s `format()`. (#10)

In some cases, it's conceivable that the `format()` method may need to abort
its decision to provide extension information at runtime, in the event that
it doesn't have the proper information to return a full-result.

The `format` method already removed false-y results, so this simply changes
the types to allow the same.

* 0.0.9

* Fix lifecycle method invocations on extensions

* 0.0.10

* Add changelog

* Upgrade to TypeScript 2.8

Makes my editor integration happier (a bugfix in tsserver I think)

* Add tslint and prettier

Same configuration as apollo-engine-js

* Remove magic from GraphQLExtensionStack constructor

It's not hard to consistently pass in an actual extension object to this
low-level API.

* New extension API: didStart handlers return didEnd handlers

This is a backwards-incompatible change: GraphQLExtension implementations and
users of GraphQLExtensionStack (ie apollo-server-core) must change their
implementations, if they implement any of the xDidStart/xDidEnd APIs.

This allows "didEnd" handlers to refer to closure variables from the "didStart"
handler rather than needing to store state on the extension.

The new "didEnd" handlers run in the opposite order of the "didStart" handlers,
so that they properly nest.

* 0.1.0-beta.0

* Changelog

* Add magic back into GraphQLExtensionStack constructor

But now it actually gets more context (the execution arguments) and doesn't have
to be a constructor.

* 0.1.0-beta.1

* Export more types

* 0.1.0-beta.2

* Fix lifecycle handlers to pass proper "this"

* 0.1.0-beta.3

* Pass options directly to start handlers; eliminate factory again

* 0.1.0-beta.4

* error handling in didEnd

* 0.1.0-beta.5

* pass multiple errors to EndHandler

* 0.1.0-beta.6

* add willSendResponse

* 0.1.0-beta.7

* prettier

* setFieldResolver for custom fieldResolver

* reverse

* get more initial options into requestDidStart

* 0.1.0-beta.8

* 0.1.0-beta.9

* Actually, we already get the fieldResolver!

* 0.1.0-beta.10

* work without extensionStack

* 0.1.0-beta.11

* 0.1.0-beta.12

* Send errors to willResolveField callback

* 0.1.0-beta.13

* willSendResponse can return a result

* 0.1.0-beta.14

* Revert 1063be8..56912fc

This reverts commit 1063be8..56912fc.

* add PQ options to requestDidStart

* 0.1.0-beta.14

* 0.1.0-beta.15

* Initialize an empty TypeScript/Jest package

Template based on apollo-engine-js

* Basic trace node structure building

* basic timing

* Checkpoint towards signature implementation

The new signature implementation does not try to compress whitespace.

* Basic signature implementation

* progress towards actual reporting

* basic checkpoint for reporting

* 0.0.0-beta.1

* pull in @types/long, since it is in the external api

* 0.0.0-beta.2

* get rid of Long

* 0.0.0-beta.3

* debug log request what happened

* 0.0.0-beta.4

* 0.0.0-beta.5

* correct url

* 0.0.0-beta.6

* request headers

* 0.0.0-beta.7

* leave out a few headers

* 0.0.0-beta.8

* prettier

* move stuff into multiple files, and stop exporting the extension

* lots of doc comments

* address agent.ts XXX comments

* implement privateVariables

simplify API by removing flush() and allowing flush-ers to just call sendReport
directly

* privateHeaders and error tracking

* gzip, signals

* fix test

* 0.0.0-beta.9

* Error handling for reports

* 0.0.0-beta.10

* no need to include boring stacktrace

* 0.0.0-beta.11

* tweak error reporting

* 0.0.0-beta.12

* package-lock update (npm@6?)

* Reduce target report size to 512KB from 4MB.

Load testing revealed that protobuf encoding for large FullTraceReports could
tie up CPU and reduce p99 request latency (eg, to 200ms from 10ms). Reducing the
default target report size spreads out the encoding time and mitigates the
impact on latency.  If this is not acceptable for all users, we may have to
investigate reintroducing agent-side stats aggregation to keep report sizes
small.

* 0.0.0-beta.13

* Encode Traces as they come in

This improves p99 times with little effect on p50 times. It also lets us get rid
of the heuristic average trace size estimation.

* 0.0.0-beta.14

* support PQ fields

* npm audit fix

* 0.0.0-beta.15

* ignore coverage

* Make the default signature more aggressive

We'd rather tell people confused by literal removal to tweak the signature than
tell people causing outages to do so.

* 0.0.0-beta.16

* Remove obsolete files from graphql-extensions and apollo-engine-reporting

* Fix dependencies and configs

* Fix apollo-server-cloudflare to import from apollo-server-env

* Fix compilation and test configs

* Get all tests passing again

* Switch to Lerna independent versioning

* Polyfill promisify for Node < 8 and load polyfills in tests

* ES2016 exponentiation operator is only supported in Node > 6

* add dependency cache for circle

* add missing env dependencies in REST datasource
abernix added a commit that referenced this issue Jan 25, 2019
…er-facilities

(op-reg): Switch to a better logging facility.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants