Commit Graph

167 Commits

Author SHA1 Message Date
izzy lyseggen dc4d8de77e Merge branch 'izzy/gql-subscriptions' of https://github.com/Speckle-Next/Server into izzy/gql-subscriptions 2020-08-20 15:26:30 +01:00
izzy lyseggen 22248bf538 test(subs): basic tests for all subscriptions
did somebody say TESTS 🥳
2020-08-20 15:26:17 +01:00
Dimitrie Stefanescu d40258cfe6 test(circleci): added test server runner separately 2020-08-20 15:39:02 +03:00
izzy lyseggen ac58d4f53a Revert "test(subs): bump to timeout 7k"
Didn't work.

This reverts commit 41153f1aeb.
2020-08-20 10:42:48 +01:00
izzy lyseggen 41153f1aeb test(subs): bump to timeout 7k to pacify circle ci 2020-08-20 10:36:05 +01:00
izzy lyseggen 762f369c56 test(subs): bump timeout to 5k bc steve jobs's 👻 2020-08-20 10:08:43 +01:00
izzy lyseggen 99f473873a fix(subs): remove redundant stream sub defs 2020-08-20 10:00:26 +01:00
izzy lyseggen c6db01420a test(subs): merge branch 'dim/gql-subscriptions' 2020-08-20 09:50:15 +01:00
Dimitrie Stefanescu 7a03c884ea fix(tests/subscriptions): fixes port conflict in subscription tests when ran from all tests command 2020-08-20 11:31:25 +03:00
Dimitrie Stefanescu 29dfa57d82 test(subscriptions): subscription tests now run independently 🙌 2020-08-20 11:26:51 +03:00
Dimitrie Stefanescu e4f213d4f6 test(subscriptions): works with separate run test server, figuring out starting it from test file
doing `npm run dev:server:test` and running the test with that server over port 3000 works. seems
like ws upgrade requests are not honoured when the server is started from the test file (on 3001).
2020-08-20 10:27:48 +03:00
Dimitrie Stefanescu 45d73e3a47 test(subscriptions): first working scaffold of subscriptions test! 2020-08-19 21:47:48 +03:00
izzy lyseggen c406abe5ec feat(subs): subs for branch & commit mutations 🥳
also applied @hasRole and @hasScope directives to mutations in this schema
2020-08-19 15:46:40 +01:00
izzy lyseggen 6c3e8b138d feat(subs): rename stream subs & apply directives
- `streamCreated` -> `userStreamCreated
- `streamDeleted` -> `userStreamDeleted`

this is to better show that this is user bound (takes owner id)
rather than stream bound

- @hasRole and @hasScope have been reapplied to each field
2020-08-19 15:45:21 +01:00
izzy lyseggen 222f932547 feat(auth-dirs): revert @hasScope and @hasRole
make these field definition only again so it works for now.
the obj directives problem is more messy than i thought 🙃
2020-08-19 15:41:42 +01:00
izzy lyseggen eabfa99651 feat(auth-dirs): remove @isAuthorized directives
was decided that these were a bit too much.
auth will be reverted to `authorizeResolver` within the resolvers
2020-08-19 15:39:52 +01:00
Dimitrie Stefanescu b3cf8e863a refactor(test/subscriptions): split out the subs test file & added npm test script for it 2020-08-19 17:27:17 +03:00
Dimitrie Stefanescu 1f25b8c5fe refactor(subscriptions): fiddles and riddles 2020-08-19 16:49:39 +03:00
izzy lyseggen 7c13ab02f2 feat(auth-dirs): do a check for context.auth 2020-08-18 16:00:49 +01:00
izzy lyseggen 78657bbe7d feat(subs): finish up streams subscriptions 2020-08-18 10:31:45 +01:00
izzy lyseggen 9bb7b6fe05 feat(auth-dirs): allow hasScope and hasRole on obj
implement `visitObject()` so the directives can be applied to objects.
I have applied them to all mutations and tests all still pass.

NOTE: i feel like there must be a way to abstract and reuse directive
definitions as it's very repetitive, but I'm a bit too brain dead today
to think of an elegant solution
2020-08-17 17:12:52 +01:00
izzy lyseggen 3463b998e5 fix(auth-dir): fix silly typo 2020-08-14 16:38:28 +01:00
izzy lyseggen a4abbe0eaf test(subs): breaking your tests dim sorry 🙃
added three subscription tests that fail b/c i'm dumb and don't know
how the mystical websocket woo woo witchcraft works
2020-08-14 15:36:27 +01:00
izzy lyseggen ee532b2b96 refactor(streams): use directives for auth
comment out any auth logic within the streams resolvers and add auth
directives to the graphql schema instead

test:server all pass for me with this, so hoping everything is ok here!!
2020-08-14 15:32:06 +01:00
izzy lyseggen 405964b653 feat(auth-dir): break auth into three directives
@isAuthorized directive for Stream, Branch, and Commit

this is a light wrapper around `authorizeResolver` which finds the
`resourceId` depending on where the request is coming from.
it's still not super cleand and I will continue thinking about how to
improve this despite inconsistencies with the id location
2020-08-14 15:23:41 +01:00
izzy lyseggen 11c357a79f fix(directives): find correct resolver
handle case when default field resolver is not the right one to use
2020-08-14 10:39:45 +01:00
izzy lyseggen ec09927f94 feat(directives): add @hasRole directive 2020-08-12 16:03:13 +01:00
izzy lyseggen e3f2d73444 feat(subs): add stream updated and deleted subs 2020-08-12 16:01:19 +01:00
izzy lyseggen 0f1dc6078e fix(directives): typo in hasScope 2020-08-12 10:36:17 +01:00
izzy lyseggen 768ff42a50 refactor(directives): load these nicely 2020-08-12 09:59:07 +01:00
izzy lyseggen 9d34ac0e95 feat(subs): return stream input from streamCreated 2020-08-11 17:47:47 +01:00
izzy lyseggen fa209157bc feat(subs): add @hasScope dir to streamCreated 2020-08-11 14:39:48 +01:00
izzy lyseggen 199e576b9f feat(directives): create HasScopeDirective 2020-08-11 14:36:53 +01:00
izzy lyseggen fee7ffb257 feat(sub): filter stream created sub by owner id 2020-08-07 15:02:57 +01:00
Dimitrie Stefanescu 7b32d39cac feat(subs): added redis pubsubber (shared resource), imported it into stream resolvers 2020-08-06 10:42:36 +01:00
Dimitrie Stefanescu 8f25a6f2fb fix(subs): subscriptions now properly initialising 2020-08-06 10:16:45 +01:00
izzy lyseggen d7b75f9bfb feat(subscriptions): trying to figure out subs
I added a streamCreated sub to try it out,
but I can't get it to connect 😅
2020-08-05 17:17:18 +01:00
Matteo Cominetti 80b293c592 feat(gql): adds tests for stream search and user search 2020-07-29 18:56:58 +01:00
Matteo Cominetti 64279a867d feat(gql): limits set to max=100 and default=25 for streams, users, branches & commits. Additional changes as per PR #14. 2020-07-29 13:10:24 +01:00
Matteo Cominetti e51345cb9e feat(gql): adds streamSearch, adds pagination to userSearch 2020-07-28 16:20:45 +01:00
Matteo Cominetti d2db31381b refractor: fixes indentation 2020-07-28 14:43:01 +01:00
Matteo Cominetti 5f176421ca feat(gql): returns error if limit > 100 2020-07-28 14:38:33 +01:00
Matteo Cominetti 304397e1ee Merge commit '49f05eac5f6a8af2ae71d9ef650bab2e5c995b9d' into matteo/gql
# Conflicts:
#	readme.md
2020-07-27 23:14:51 +01:00
Matteo Cominetti c6e08b2c5d feat(gql): adds UserSearchResults and improves user search 2020-07-27 23:13:20 +01:00
Dimitrie Stefanescu 49f05eac5f Merge pull request #12 from Speckle-Next/matteo/dev
Matteo/dev
2020-07-26 20:07:32 +01:00
Dimitrie Stefanescu 46e6572ab9 chore(typo & linting): fixed minor typos in readme & linting errors 2020-07-26 20:06:20 +01:00
Matteo Cominetti 8df402e4cb fix(gql): query users, improves validations 2020-07-25 21:21:59 +01:00
Matteo Cominetti 9733cc602d feat(gql): search users wip 2020-07-25 21:04:29 +01:00
Matteo Cominetti f4d236cd63 fix(gql): commitUpdate return type 2020-07-25 14:29:31 +01:00
Dimitrie Stefanescu e199e881f2 fix(upload): upload response status changed from 303 (redirect) to 201 (created)
this was confusing clients, which were actually following the redirect 😬
2020-07-25 10:52:55 +01:00