Skip to content

Instantly share code, notes, and snippets.

View wtrocki's full-sized avatar
🚀
Making API Backends an Better Place!

Wojciech Trocki wtrocki

🚀
Making API Backends an Better Place!
View GitHub Profile

Add abstraction for ts/js generation in resolvers

Address all TODO's

Relationship support

Subscription support

Paggination support

swagger: '2.0'
info:
title: CodeGen
description: A brand new API with no content. Go nuts!
version: '1.0'
consumes:
- application/json
produces:
- application/json
paths:
type DamageAssesment {
id: ID!
title: String!
description: String
author: String
date: String
notes: [DamageNote!]!
}
type DamageNote {
subscription subscribeTasks{
subscribeTasks{
id
title
description
version
}
}
subscription SubscribeData{
subscribeTasks{
id
title
description
version
}
}
@wtrocki
wtrocki / client.js
Created April 5, 2019 09:33
Apollo Cache Gists
const cache = new InMemoryCache();
const client = new ApolloClient({
link: new HttpLink(),
cache
});
  1. Do not touch normal request and let them fail
  2. Promise is never resolved for offline requests Offline requests blocking promises. This will mean that code in success will never be called until device becomes online.

OFFLINE LINK Enqueue original operation and send dummy one. XXXX SPLIT HTTP and OFFLINE TERMINATING LINK

@wtrocki
wtrocki / mobile-services.js
Last active March 12, 2019 12:14 — forked from psturc/mobile-services.js
For release 0.1.0 of ionic-showcase
let config = {
"version": 1,
"namespace": "test",
"clientId": "org.aerogear.ionic.showcase",
"services": [
{
"id": "e339e761-3687-11e9-9467-0af08791569c",
"name": "sync-app-test-org.aerogear.ionic.showcase",
"type": "sync-app",
"url": "https://sync-app-showcase-server-demo.comm2.skunkhenry.com/graphql",

Known bugs

  • Ionic icon (migrate showcase one)
  • Can go back from login page and see app (Will be invalidated anyway)
  • Test.doc do not work on openshift as empty volume is created.
  • Push notifications are disabled by default
  • Device security dialog with rating is not showing up
  • Push works only when app is minimized (but not closed)
public getHeaderProvider(tokenUpdateTime: number) {
const headerProvider = () => {
const tokenUpdate = this.extract().updateToken(tokenUpdateTime) as any;
// Keycloak doesn't use a proper promise. Instead it uses success and error.
return new Promise((resolve, reject) => {
tokenUpdate.success(() => {
resolve({ "Authorization": "Bearer " + this.extract().token });
}).error((error: any) => {
// tslint:disable-next-line:no-console
console.info("Cannot update keycloak token", error);