├── src ├── assets │ ├── .gitkeep │ └── icons │ │ ├── link-share-32.png │ │ └── link-share-48.png ├── app │ ├── options │ │ ├── options.component.css │ │ ├── options.component.html │ │ ├── options.component.ts │ │ └── options.component.spec.ts │ ├── website-manager │ │ ├── website-manager.component.css │ │ ├── website-manager.component.html │ │ ├── website-manager.component.ts │ │ └── website-manager.component.spec.ts │ ├── app.component.ts │ ├── graphql │ │ ├── schema.graphql │ │ ├── graphql.module.ts │ │ └── generated │ │ │ └── graphql.ts │ ├── background │ │ ├── background.component.spec.ts │ │ └── background.component.ts │ ├── login.guard.ts │ ├── app.component.spec.ts │ └── app.module.ts ├── favicon.ico ├── styles.css ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── tsconfig.app.json ├── index.html ├── tsconfig.spec.json ├── tslint.json ├── main.ts ├── browserslist ├── manifest.json ├── test.ts ├── karma.conf.js └── polyfills.ts ├── e2e ├── src │ ├── app.po.ts │ └── app.e2e-spec.ts ├── tsconfig.e2e.json └── protractor.conf.js ├── .editorconfig ├── tsconfig.json ├── .gitignore ├── README.md ├── LICENSE ├── package.json ├── tslint.json └── angular.json /src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/options/options.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/website-manager/website-manager.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/options/options.component.html: -------------------------------------------------------------------------------- 1 |

2 | options works! 3 |

4 | -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SilvanCodes/link-share-web-ext/master/src/favicon.ico -------------------------------------------------------------------------------- /src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /src/assets/icons/link-share-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SilvanCodes/link-share-web-ext/master/src/assets/icons/link-share-32.png -------------------------------------------------------------------------------- /src/assets/icons/link-share-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SilvanCodes/link-share-web-ext/master/src/assets/icons/link-share-48.png -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true, 3 | graphQLHttp: 'http://localhost:4000', 4 | graphQLWebSocket: 'ws://localhost:4000/' 5 | }; 6 | -------------------------------------------------------------------------------- /src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app" 5 | }, 6 | "exclude": [ 7 | "test.ts", 8 | "**/*.spec.ts" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import {Component} from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'ls-root', 5 | template: '' 6 | }) 7 | export class AppComponent { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/app/graphql/schema.graphql: -------------------------------------------------------------------------------- 1 | query MyWebsites { 2 | websites { 3 | id 4 | url 5 | } 6 | } 7 | 8 | subscription NewWebsite { 9 | newWebsite { 10 | node { 11 | url 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('ls-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/app/website-manager/website-manager.component.html: -------------------------------------------------------------------------------- 1 |
2 |

3 | Welcome to {{ title }}! 4 |

5 |
6 | 11 | -------------------------------------------------------------------------------- /e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | LinkShare 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "test.ts", 12 | "polyfills.ts" 13 | ], 14 | "include": [ 15 | "**/*.spec.ts", 16 | "**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /src/app/options/options.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'ls-options', 5 | templateUrl: './options.component.html', 6 | styleUrls: ['./options.component.css'] 7 | }) 8 | export class OptionsComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit() { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('workspace-project App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Welcome to link-share!'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /src/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tslint.json", 3 | "rules": { 4 | "directive-selector": [ 5 | true, 6 | "attribute", 7 | "ls", 8 | "camelCase" 9 | ], 10 | "component-selector": [ 11 | true, 12 | "element", 13 | "ls", 14 | "kebab-case" 15 | ] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /src/browserslist: -------------------------------------------------------------------------------- 1 | # This file is currently used by autoprefixer to adjust CSS to support the below specified browsers 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | # 5 | # For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed 6 | 7 | > 0.5% 8 | last 2 versions 9 | Firefox ESR 10 | not dead 11 | not IE 9-11 -------------------------------------------------------------------------------- /src/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name": "LinkShare", 4 | "version": "0.1", 5 | 6 | "description": "Open links shared from mobile app!", 7 | 8 | "icons": { 9 | "48": "assets/icons/link-share-48.png" 10 | }, 11 | 12 | "browser_action": { 13 | "default_icon": "assets/icons/link-share-32.png", 14 | "default_title": "LinkShare", 15 | "default_popup": "/index.html" 16 | }, 17 | 18 | "options_ui": { 19 | "page": "/index.html?page=options" 20 | }, 21 | 22 | "background": { 23 | "page": "/index.html?page=background" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "module": "es2015", 9 | "moduleResolution": "node", 10 | "emitDecoratorMetadata": true, 11 | "experimentalDecorators": true, 12 | "target": "es2017", 13 | "typeRoots": [ 14 | "node_modules/@types" 15 | ], 16 | "lib": [ 17 | "es2017", 18 | "dom", 19 | "esnext.asynciterable" 20 | ] 21 | }, 22 | "angularCompilerOptions": { 23 | "preserveWhitespaces": false 24 | } 25 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | 8 | # dependencies 9 | /node_modules 10 | 11 | # IDEs and editors 12 | /.idea 13 | .project 14 | .classpath 15 | .c9/ 16 | *.launch 17 | .settings/ 18 | *.sublime-workspace 19 | 20 | # IDE - VSCode 21 | .vscode/* 22 | !.vscode/settings.json 23 | !.vscode/tasks.json 24 | !.vscode/launch.json 25 | !.vscode/extensions.json 26 | 27 | # misc 28 | /.sass-cache 29 | /connect.lock 30 | /coverage 31 | /libpeerconnection.log 32 | npm-debug.log 33 | yarn-error.log 34 | testem.log 35 | /typings 36 | 37 | # System Files 38 | .DS_Store 39 | Thumbs.db 40 | -------------------------------------------------------------------------------- /src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: any; 11 | 12 | // First, initialize the Angular testing environment. 13 | getTestBed().initTestEnvironment( 14 | BrowserDynamicTestingModule, 15 | platformBrowserDynamicTesting() 16 | ); 17 | // Then we find all the tests. 18 | const context = require.context('./', true, /\.spec\.ts$/); 19 | // And load the modules. 20 | context.keys().map(context); 21 | -------------------------------------------------------------------------------- /src/app/website-manager/website-manager.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {Observable} from 'rxjs'; 3 | import {MyWebsitesGQL} from '../graphql/generated/graphql'; 4 | import {map} from 'rxjs/operators'; 5 | 6 | @Component({ 7 | selector: 'ls-website-manager', 8 | templateUrl: './website-manager.component.html', 9 | styleUrls: ['./website-manager.component.css'] 10 | }) 11 | export class WebsiteManagerComponent implements OnInit { 12 | title = 'link-share'; 13 | websites: Observable; 14 | 15 | constructor(websites: MyWebsitesGQL) { 16 | this.websites = websites.watch().valueChanges.pipe(map(result => result.data.websites)); 17 | } 18 | 19 | ngOnInit() { 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/app/options/options.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { OptionsComponent } from './options.component'; 4 | 5 | describe('OptionsComponent', () => { 6 | let component: OptionsComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ OptionsComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(OptionsComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/background/background.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BackgroundComponent } from './background.component'; 4 | 5 | describe('BackgroundComponent', () => { 6 | let component: BackgroundComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ BackgroundComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BackgroundComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false, 7 | graphQLHttp: 'http://localhost:4000', 8 | graphQLWebSocket: 'ws://localhost:4000/' 9 | }; 10 | 11 | /* 12 | * In development mode, for easier debugging, you can ignore zone related error 13 | * stack frames such as `zone.run`/`zoneDelegate.invokeTask` by importing the 14 | * below file. Don't forget to comment it out in production mode 15 | * because it will have a performance impact when errors are thrown 16 | */ 17 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 18 | -------------------------------------------------------------------------------- /src/app/login.guard.ts: -------------------------------------------------------------------------------- 1 | import {Injectable} from '@angular/core'; 2 | import { 3 | Router, 4 | ActivatedRouteSnapshot, 5 | RouterStateSnapshot, 6 | CanActivate 7 | } from '@angular/router'; 8 | 9 | import {Observable} from 'rxjs'; 10 | 11 | // Guard for the index route of this extension 12 | @Injectable() 13 | export class LoginGuard implements CanActivate { 14 | 15 | constructor(private router: Router) {} 16 | 17 | canActivate(route: ActivatedRouteSnapshot, 18 | state: RouterStateSnapshot): Observable|boolean { 19 | 20 | const page = route.queryParams['page']; 21 | 22 | if (!page || page === 'popup') { 23 | // implement authorization to add 24 | return true; 25 | } 26 | 27 | this.router.navigate(['/' + page]); 28 | return false; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/app/website-manager/website-manager.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { WebsiteManagerComponent } from './website-manager.component'; 4 | 5 | describe('WebsiteManagerComponent', () => { 6 | let component: WebsiteManagerComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ WebsiteManagerComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(WebsiteManagerComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './src/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: require('path').join(__dirname, './tsconfig.e2e.json') 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LinkShare 2 | 3 | This project is meant to make it easy to share links from mobile to desktop browser (firefox). 4 | 5 | WARNING: This project is in development right now and not stable nor finished in any way. 6 | 7 | ## Server 8 | 9 | The web-ext will expect a GraphQL-Server from my `link-share-server`-repository to run on `localhost:4000`. 10 | 11 | ## Build and test 12 | 13 | Use`npm run-script build` to compile and `npm run-script test` to start the web-ext. 14 | The script is configured for linux with defaulft firefox installation. 15 | Adapt to your firefox installation in package.json. 16 | 17 | Run `npm run-script build:zip` to build the project for production. 18 | The build artifacts will be stored in the `dist/` directory. 19 | 20 | ## Ressources 21 | 22 | This project is heavily inspired by [this blog article](https://cito.github.io/blog/web-ext-with-angular/). 23 | -------------------------------------------------------------------------------- /src/app/background/background.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, OnDestroy, OnInit} from '@angular/core'; 2 | import {NewWebsiteGQL} from '../graphql/generated/graphql'; 3 | import {Observable} from 'rxjs'; 4 | import {map} from 'rxjs/operators'; 5 | 6 | @Component({ 7 | selector: 'ls-background', 8 | template: '

Background page for Pinboard

' 9 | }) 10 | export class BackgroundComponent implements OnInit, OnDestroy { 11 | private website: Observable; 12 | 13 | constructor(newWebsite: NewWebsiteGQL) { 14 | this.website = newWebsite.subscribe(); 15 | } 16 | 17 | ngOnInit() { 18 | console.log('background alive!'); 19 | // initialize connection to server 20 | this.website.pipe( 21 | map(val => { 22 | console.log(val); 23 | console.log(val.data.newWebsite.node.url); 24 | browser.tabs.create({ url: 'http://' + val.data.newWebsite.node.url, active: false }); 25 | } 26 | ) 27 | ).subscribe(); 28 | } 29 | 30 | ngOnDestroy() { 31 | console.log('background dead!'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, '../coverage'), 20 | reports: ['html', 'lcovonly'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false 30 | }); 31 | }; -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 SilvanCodes 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | import { RouterTestingModule } from '@angular/router/testing'; 3 | import { AppComponent } from './app.component'; 4 | describe('AppComponent', () => { 5 | beforeEach(async(() => { 6 | TestBed.configureTestingModule({ 7 | imports: [ 8 | RouterTestingModule 9 | ], 10 | declarations: [ 11 | AppComponent 12 | ], 13 | }).compileComponents(); 14 | })); 15 | it('should create the app', async(() => { 16 | const fixture = TestBed.createComponent(AppComponent); 17 | const app = fixture.debugElement.componentInstance; 18 | expect(app).toBeTruthy(); 19 | })); 20 | it(`should have as title 'link-share'`, async(() => { 21 | const fixture = TestBed.createComponent(AppComponent); 22 | const app = fixture.debugElement.componentInstance; 23 | expect(app.title).toEqual('link-share'); 24 | })); 25 | it('should render title in a h1 tag', async(() => { 26 | const fixture = TestBed.createComponent(AppComponent); 27 | fixture.detectChanges(); 28 | const compiled = fixture.debugElement.nativeElement; 29 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to link-share!'); 30 | })); 31 | }); 32 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import {BrowserModule} from '@angular/platform-browser'; 2 | import {NgModule} from '@angular/core'; 3 | import {HttpClientModule} from '@angular/common/http'; 4 | 5 | import {AppComponent} from './app.component'; 6 | import {BackgroundComponent} from './background/background.component'; 7 | import {GraphQLModule} from './graphql/graphql.module'; 8 | import {WebsiteManagerComponent} from './website-manager/website-manager.component'; 9 | import {OptionsComponent} from './options/options.component'; 10 | import {LoginGuard} from './login.guard'; 11 | import {RouterModule, Routes} from '@angular/router'; 12 | 13 | const appRoutes: Routes = [ 14 | { path: 'options', component: OptionsComponent }, 15 | { path: 'background', component: BackgroundComponent }, 16 | { path: '**', component: WebsiteManagerComponent, canActivate: [LoginGuard] }, 17 | ]; 18 | 19 | @NgModule({ 20 | declarations: [ 21 | AppComponent, 22 | BackgroundComponent, 23 | OptionsComponent, 24 | WebsiteManagerComponent, 25 | ], 26 | imports: [ 27 | BrowserModule, 28 | HttpClientModule, 29 | GraphQLModule, 30 | RouterModule.forRoot(appRoutes), 31 | ], 32 | providers: [LoginGuard], 33 | bootstrap: [AppComponent] 34 | }) 35 | export class AppModule { } 36 | -------------------------------------------------------------------------------- /src/app/graphql/graphql.module.ts: -------------------------------------------------------------------------------- 1 | import {NgModule} from '@angular/core'; 2 | import {ApolloModule, APOLLO_OPTIONS} from 'apollo-angular'; 3 | import {HttpLinkModule, HttpLink} from 'apollo-angular-link-http'; 4 | import {split} from 'apollo-link'; 5 | import {WebSocketLink} from 'apollo-link-ws'; 6 | import {getMainDefinition} from 'apollo-utilities'; 7 | import {InMemoryCache} from 'apollo-cache-inmemory'; 8 | import {environment} from '../../environments/environment'; 9 | 10 | const uriHttp = environment.graphQLHttp; 11 | const uriWebSocket = environment.graphQLWebSocket; 12 | 13 | interface Definintion { 14 | kind: string; 15 | operation?: string; 16 | } 17 | 18 | export function createApollo(httpLink: HttpLink) { 19 | return { 20 | link: split( 21 | // split based on operation type 22 | ({ query }) => { 23 | const { kind, operation }: Definintion = getMainDefinition(query); 24 | return kind === 'OperationDefinition' && operation === 'subscription'; 25 | }, 26 | new WebSocketLink({ 27 | uri: uriWebSocket, 28 | options: { 29 | reconnect: true 30 | }, 31 | }), 32 | httpLink.create({uri: uriHttp}), 33 | ), 34 | cache: new InMemoryCache(), 35 | }; 36 | } 37 | 38 | @NgModule({ 39 | exports: [ApolloModule, HttpLinkModule], 40 | providers: [ 41 | { 42 | provide: APOLLO_OPTIONS, 43 | useFactory: createApollo, 44 | deps: [HttpLink], 45 | }, 46 | ], 47 | }) 48 | export class GraphQLModule {} 49 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "link-share", 3 | "version": "0.1.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "gqlgen": "gql-gen --schema http://localhost:4000 --template graphql-codegen-apollo-angular-template --out ./src/app/graphql/generated/graphql.ts \"./src/**/*.graphql\"", 8 | "build": "ng build --aot", 9 | "build:prod": "ng build --aot --prod --source-map=false --output-hashing=none", 10 | "build:ext": "web-ext build --source-dir=dist/link-share --artifacts-dir=dist --overwrite-dest", 11 | "build:zip": "npm run build:prod && npm run build:ext", 12 | "test": "web-ext run --source-dir=dist/link-share --firefox=\"/usr/bin/firefox\"", 13 | "lint": "ng lint", 14 | "e2e": "ng e2e", 15 | "run": "ng build --aot && cd dist/link-share/ && web-ext run" 16 | }, 17 | "private": true, 18 | "dependencies": { 19 | "@angular/animations": "^6.1.0", 20 | "@angular/common": "^6.1.0", 21 | "@angular/compiler": "^6.1.0", 22 | "@angular/core": "^6.1.0", 23 | "@angular/forms": "^6.1.0", 24 | "@angular/http": "^6.1.0", 25 | "@angular/platform-browser": "^6.1.0", 26 | "@angular/platform-browser-dynamic": "^6.1.0", 27 | "@angular/router": "^6.1.0", 28 | "apollo-angular": "^1.3.0", 29 | "apollo-angular-link-http": "^1.2.0", 30 | "apollo-cache-inmemory": "^1.2.0", 31 | "apollo-client": "^2.4.0", 32 | "apollo-link": "^1.2.0", 33 | "apollo-link-ws": "^1.0.8", 34 | "core-js": "^2.5.4", 35 | "graphql": "^0.13.2", 36 | "graphql-tag": "^2.9.2", 37 | "rxjs": "^6.0.0", 38 | "subscriptions-transport-ws": "^0.9.14", 39 | "zone.js": "~0.8.26" 40 | }, 41 | "devDependencies": { 42 | "@angular-devkit/build-angular": "~0.7.0", 43 | "@angular/cli": "~6.1.5", 44 | "@angular/compiler-cli": "^6.1.0", 45 | "@angular/language-service": "^6.1.0", 46 | "@types/firefox-webext-browser": "^58.0.3", 47 | "@types/jasmine": "~2.8.6", 48 | "@types/jasminewd2": "~2.0.3", 49 | "@types/node": "~8.9.4", 50 | "codelyzer": "~4.2.1", 51 | "graphql-code-generator": "^0.11.0", 52 | "graphql-codegen-apollo-angular-template": "^0.11.0", 53 | "jasmine-core": "~2.99.1", 54 | "jasmine-spec-reporter": "~4.2.1", 55 | "karma": "~1.7.1", 56 | "karma-chrome-launcher": "~2.2.0", 57 | "karma-coverage-istanbul-reporter": "~2.0.0", 58 | "karma-jasmine": "~1.1.1", 59 | "karma-jasmine-html-reporter": "^0.2.2", 60 | "protractor": "~5.4.0", 61 | "ts-node": "~5.0.1", 62 | "tslint": "~5.9.1", 63 | "typescript": "~2.9.0" 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rulesDirectory": [ 3 | "node_modules/codelyzer" 4 | ], 5 | "rules": { 6 | "arrow-return-shorthand": true, 7 | "callable-types": true, 8 | "class-name": true, 9 | "comment-format": [ 10 | true, 11 | "check-space" 12 | ], 13 | "curly": true, 14 | "deprecation": { 15 | "severity": "warn" 16 | }, 17 | "eofline": true, 18 | "forin": true, 19 | "import-blacklist": [ 20 | true, 21 | "rxjs/Rx" 22 | ], 23 | "import-spacing": true, 24 | "indent": [ 25 | true, 26 | "spaces" 27 | ], 28 | "interface-over-type-literal": true, 29 | "label-position": true, 30 | "max-line-length": [ 31 | true, 32 | 140 33 | ], 34 | "member-access": false, 35 | "member-ordering": [ 36 | true, 37 | { 38 | "order": [ 39 | "static-field", 40 | "instance-field", 41 | "static-method", 42 | "instance-method" 43 | ] 44 | } 45 | ], 46 | "no-arg": true, 47 | "no-bitwise": true, 48 | "no-console": [ 49 | true, 50 | "debug", 51 | "info", 52 | "time", 53 | "timeEnd", 54 | "trace" 55 | ], 56 | "no-construct": true, 57 | "no-debugger": true, 58 | "no-duplicate-super": true, 59 | "no-empty": false, 60 | "no-empty-interface": true, 61 | "no-eval": true, 62 | "no-inferrable-types": [ 63 | true, 64 | "ignore-params" 65 | ], 66 | "no-misused-new": true, 67 | "no-non-null-assertion": true, 68 | "no-shadowed-variable": true, 69 | "no-string-literal": false, 70 | "no-string-throw": true, 71 | "no-switch-case-fall-through": true, 72 | "no-trailing-whitespace": true, 73 | "no-unnecessary-initializer": true, 74 | "no-unused-expression": true, 75 | "no-use-before-declare": true, 76 | "no-var-keyword": true, 77 | "object-literal-sort-keys": false, 78 | "one-line": [ 79 | true, 80 | "check-open-brace", 81 | "check-catch", 82 | "check-else", 83 | "check-whitespace" 84 | ], 85 | "prefer-const": true, 86 | "quotemark": [ 87 | true, 88 | "single" 89 | ], 90 | "radix": true, 91 | "semicolon": [ 92 | true, 93 | "always" 94 | ], 95 | "triple-equals": [ 96 | true, 97 | "allow-null-check" 98 | ], 99 | "typedef-whitespace": [ 100 | true, 101 | { 102 | "call-signature": "nospace", 103 | "index-signature": "nospace", 104 | "parameter": "nospace", 105 | "property-declaration": "nospace", 106 | "variable-declaration": "nospace" 107 | } 108 | ], 109 | "unified-signatures": true, 110 | "variable-name": false, 111 | "whitespace": [ 112 | true, 113 | "check-branch", 114 | "check-decl", 115 | "check-operator", 116 | "check-separator", 117 | "check-type" 118 | ], 119 | "no-output-on-prefix": true, 120 | "use-input-property-decorator": true, 121 | "use-output-property-decorator": true, 122 | "use-host-property-decorator": true, 123 | "no-input-rename": true, 124 | "no-output-rename": true, 125 | "use-life-cycle-interface": true, 126 | "use-pipe-transform-interface": true, 127 | "component-class-suffix": true, 128 | "directive-class-suffix": true 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/ 22 | // import 'core-js/es6/symbol'; 23 | // import 'core-js/es6/object'; 24 | // import 'core-js/es6/function'; 25 | // import 'core-js/es6/parse-int'; 26 | // import 'core-js/es6/parse-float'; 27 | // import 'core-js/es6/number'; 28 | // import 'core-js/es6/math'; 29 | // import 'core-js/es6/string'; 30 | // import 'core-js/es6/date'; 31 | // import 'core-js/es6/array'; 32 | // import 'core-js/es6/regexp'; 33 | // import 'core-js/es6/map'; 34 | // import 'core-js/es6/weak-map'; 35 | // import 'core-js/es6/set'; 36 | 37 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 38 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 39 | 40 | /** IE10 and IE11 requires the following for the Reflect API. */ 41 | // import 'core-js/es6/reflect'; 42 | 43 | 44 | /** Evergreen browsers require these. **/ 45 | // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. 46 | import 'core-js/es7/reflect'; 47 | 48 | 49 | /** 50 | * Web Animations `@angular/platform-browser/animations` 51 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 52 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 53 | **/ 54 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 55 | 56 | /** 57 | * By default, zone.js will patch all possible macroTask and DomEvents 58 | * user can disable parts of macroTask/DomEvents patch by setting following flags 59 | */ 60 | 61 | // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 62 | // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 63 | // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 64 | 65 | /* 66 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 67 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 68 | */ 69 | // (window as any).__Zone_enable_cross_context_check = true; 70 | 71 | /*************************************************************************************************** 72 | * Zone JS is required by default for Angular itself. 73 | */ 74 | import 'zone.js/dist/zone'; // Included with Angular CLI. 75 | 76 | 77 | 78 | /*************************************************************************************************** 79 | * APPLICATION IMPORTS 80 | */ 81 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "link-share": { 7 | "root": "", 8 | "sourceRoot": "src", 9 | "projectType": "application", 10 | "prefix": "ls", 11 | "schematics": {}, 12 | "architect": { 13 | "build": { 14 | "builder": "@angular-devkit/build-angular:browser", 15 | "options": { 16 | "outputPath": "dist/link-share", 17 | "index": "src/index.html", 18 | "main": "src/main.ts", 19 | "polyfills": "src/polyfills.ts", 20 | "tsConfig": "src/tsconfig.app.json", 21 | "assets": [ 22 | "src/favicon.ico", 23 | "src/assets", 24 | "src/manifest.json" 25 | ], 26 | "styles": [ 27 | "src/styles.css" 28 | ], 29 | "scripts": [] 30 | }, 31 | "configurations": { 32 | "production": { 33 | "fileReplacements": [ 34 | { 35 | "replace": "src/environments/environment.ts", 36 | "with": "src/environments/environment.prod.ts" 37 | } 38 | ], 39 | "optimization": true, 40 | "outputHashing": "all", 41 | "sourceMap": false, 42 | "extractCss": true, 43 | "namedChunks": false, 44 | "aot": true, 45 | "extractLicenses": true, 46 | "vendorChunk": false, 47 | "buildOptimizer": true 48 | } 49 | } 50 | }, 51 | "serve": { 52 | "builder": "@angular-devkit/build-angular:dev-server", 53 | "options": { 54 | "browserTarget": "link-share:build" 55 | }, 56 | "configurations": { 57 | "production": { 58 | "browserTarget": "link-share:build:production" 59 | } 60 | } 61 | }, 62 | "extract-i18n": { 63 | "builder": "@angular-devkit/build-angular:extract-i18n", 64 | "options": { 65 | "browserTarget": "link-share:build" 66 | } 67 | }, 68 | "test": { 69 | "builder": "@angular-devkit/build-angular:karma", 70 | "options": { 71 | "main": "src/test.ts", 72 | "polyfills": "src/polyfills.ts", 73 | "tsConfig": "src/tsconfig.spec.json", 74 | "karmaConfig": "src/karma.conf.js", 75 | "styles": [ 76 | "src/styles.css" 77 | ], 78 | "scripts": [], 79 | "assets": [ 80 | "src/favicon.ico", 81 | "src/assets" 82 | ] 83 | } 84 | }, 85 | "lint": { 86 | "builder": "@angular-devkit/build-angular:tslint", 87 | "options": { 88 | "tsConfig": [ 89 | "src/tsconfig.app.json", 90 | "src/tsconfig.spec.json" 91 | ], 92 | "exclude": [ 93 | "**/node_modules/**" 94 | ] 95 | } 96 | } 97 | } 98 | }, 99 | "link-share-e2e": { 100 | "root": "e2e/", 101 | "projectType": "application", 102 | "architect": { 103 | "e2e": { 104 | "builder": "@angular-devkit/build-angular:protractor", 105 | "options": { 106 | "protractorConfig": "e2e/protractor.conf.js", 107 | "devServerTarget": "link-share:serve" 108 | }, 109 | "configurations": { 110 | "production": { 111 | "devServerTarget": "link-share:serve:production" 112 | } 113 | } 114 | }, 115 | "lint": { 116 | "builder": "@angular-devkit/build-angular:tslint", 117 | "options": { 118 | "tsConfig": "e2e/tsconfig.e2e.json", 119 | "exclude": [ 120 | "**/node_modules/**" 121 | ] 122 | } 123 | } 124 | } 125 | } 126 | }, 127 | "defaultProject": "link-share" 128 | } 129 | -------------------------------------------------------------------------------- /src/app/graphql/generated/graphql.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | import { GraphQLResolveInfo } from "graphql"; 3 | 4 | export type Resolver = ( 5 | parent: Parent, 6 | args: Args, 7 | context: Context, 8 | info: GraphQLResolveInfo 9 | ) => Promise | Result; 10 | 11 | export type SubscriptionResolver< 12 | Result, 13 | Parent = any, 14 | Context = any, 15 | Args = any 16 | > = { 17 | subscribe( 18 | parent: P, 19 | args: Args, 20 | context: Context, 21 | info: GraphQLResolveInfo 22 | ): AsyncIterator; 23 | resolve?( 24 | parent: P, 25 | args: Args, 26 | context: Context, 27 | info: GraphQLResolveInfo 28 | ): R | Result | Promise; 29 | }; 30 | 31 | export type DateTime = any; 32 | /** An object with an ID */ 33 | export interface Node { 34 | id: string /** The id of the object. */; 35 | } 36 | 37 | export interface Query { 38 | info: string; 39 | websites: Website[]; 40 | website?: Website | null; 41 | } 42 | 43 | export interface Website extends Node { 44 | id: string; 45 | createdAt: DateTime; 46 | url: string; 47 | belongsTo?: User | null; 48 | } 49 | 50 | export interface User { 51 | id: string; 52 | name: string; 53 | email: string; 54 | websites: Website[]; 55 | } 56 | 57 | export interface Mutation { 58 | addWebsite: Website; 59 | signup?: AuthPayload | null; 60 | login?: AuthPayload | null; 61 | } 62 | 63 | export interface AuthPayload { 64 | token?: string | null; 65 | user?: User | null; 66 | } 67 | 68 | export interface Subscription { 69 | newWebsite?: WebsiteSubscriptionPayload | null; 70 | } 71 | 72 | export interface WebsiteSubscriptionPayload { 73 | mutation: MutationType; 74 | node?: Website | null; 75 | updatedFields?: string[] | null; 76 | previousValues?: WebsitePreviousValues | null; 77 | } 78 | 79 | export interface WebsitePreviousValues { 80 | id: string; 81 | createdAt: DateTime; 82 | url: string; 83 | } 84 | 85 | export interface UserWhereInput { 86 | AND?: UserWhereInput[] | null /** Logical AND on all given filters. */; 87 | OR?: UserWhereInput[] | null /** Logical OR on all given filters. */; 88 | NOT?: 89 | | UserWhereInput[] 90 | | null /** Logical NOT on all given filters combined by AND. */; 91 | id?: string | null; 92 | id_not?: string | null /** All values that are not equal to given value. */; 93 | id_in?: string[] | null /** All values that are contained in given list. */; 94 | id_not_in?: 95 | | string[] 96 | | null /** All values that are not contained in given list. */; 97 | id_lt?: string | null /** All values less than the given value. */; 98 | id_lte?: string | null /** All values less than or equal the given value. */; 99 | id_gt?: string | null /** All values greater than the given value. */; 100 | id_gte?: 101 | | string 102 | | null /** All values greater than or equal the given value. */; 103 | id_contains?: string | null /** All values containing the given string. */; 104 | id_not_contains?: 105 | | string 106 | | null /** All values not containing the given string. */; 107 | id_starts_with?: 108 | | string 109 | | null /** All values starting with the given string. */; 110 | id_not_starts_with?: 111 | | string 112 | | null /** All values not starting with the given string. */; 113 | id_ends_with?: string | null /** All values ending with the given string. */; 114 | id_not_ends_with?: 115 | | string 116 | | null /** All values not ending with the given string. */; 117 | name?: string | null; 118 | name_not?: string | null /** All values that are not equal to given value. */; 119 | name_in?: string[] | null /** All values that are contained in given list. */; 120 | name_not_in?: 121 | | string[] 122 | | null /** All values that are not contained in given list. */; 123 | name_lt?: string | null /** All values less than the given value. */; 124 | name_lte?: 125 | | string 126 | | null /** All values less than or equal the given value. */; 127 | name_gt?: string | null /** All values greater than the given value. */; 128 | name_gte?: 129 | | string 130 | | null /** All values greater than or equal the given value. */; 131 | name_contains?: string | null /** All values containing the given string. */; 132 | name_not_contains?: 133 | | string 134 | | null /** All values not containing the given string. */; 135 | name_starts_with?: 136 | | string 137 | | null /** All values starting with the given string. */; 138 | name_not_starts_with?: 139 | | string 140 | | null /** All values not starting with the given string. */; 141 | name_ends_with?: 142 | | string 143 | | null /** All values ending with the given string. */; 144 | name_not_ends_with?: 145 | | string 146 | | null /** All values not ending with the given string. */; 147 | email?: string | null; 148 | email_not?: 149 | | string 150 | | null /** All values that are not equal to given value. */; 151 | email_in?: 152 | | string[] 153 | | null /** All values that are contained in given list. */; 154 | email_not_in?: 155 | | string[] 156 | | null /** All values that are not contained in given list. */; 157 | email_lt?: string | null /** All values less than the given value. */; 158 | email_lte?: 159 | | string 160 | | null /** All values less than or equal the given value. */; 161 | email_gt?: string | null /** All values greater than the given value. */; 162 | email_gte?: 163 | | string 164 | | null /** All values greater than or equal the given value. */; 165 | email_contains?: string | null /** All values containing the given string. */; 166 | email_not_contains?: 167 | | string 168 | | null /** All values not containing the given string. */; 169 | email_starts_with?: 170 | | string 171 | | null /** All values starting with the given string. */; 172 | email_not_starts_with?: 173 | | string 174 | | null /** All values not starting with the given string. */; 175 | email_ends_with?: 176 | | string 177 | | null /** All values ending with the given string. */; 178 | email_not_ends_with?: 179 | | string 180 | | null /** All values not ending with the given string. */; 181 | password?: string | null; 182 | password_not?: 183 | | string 184 | | null /** All values that are not equal to given value. */; 185 | password_in?: 186 | | string[] 187 | | null /** All values that are contained in given list. */; 188 | password_not_in?: 189 | | string[] 190 | | null /** All values that are not contained in given list. */; 191 | password_lt?: string | null /** All values less than the given value. */; 192 | password_lte?: 193 | | string 194 | | null /** All values less than or equal the given value. */; 195 | password_gt?: string | null /** All values greater than the given value. */; 196 | password_gte?: 197 | | string 198 | | null /** All values greater than or equal the given value. */; 199 | password_contains?: 200 | | string 201 | | null /** All values containing the given string. */; 202 | password_not_contains?: 203 | | string 204 | | null /** All values not containing the given string. */; 205 | password_starts_with?: 206 | | string 207 | | null /** All values starting with the given string. */; 208 | password_not_starts_with?: 209 | | string 210 | | null /** All values not starting with the given string. */; 211 | password_ends_with?: 212 | | string 213 | | null /** All values ending with the given string. */; 214 | password_not_ends_with?: 215 | | string 216 | | null /** All values not ending with the given string. */; 217 | websites_every?: WebsiteWhereInput | null; 218 | websites_some?: WebsiteWhereInput | null; 219 | websites_none?: WebsiteWhereInput | null; 220 | } 221 | 222 | export interface WebsiteWhereInput { 223 | AND?: WebsiteWhereInput[] | null /** Logical AND on all given filters. */; 224 | OR?: WebsiteWhereInput[] | null /** Logical OR on all given filters. */; 225 | NOT?: 226 | | WebsiteWhereInput[] 227 | | null /** Logical NOT on all given filters combined by AND. */; 228 | id?: string | null; 229 | id_not?: string | null /** All values that are not equal to given value. */; 230 | id_in?: string[] | null /** All values that are contained in given list. */; 231 | id_not_in?: 232 | | string[] 233 | | null /** All values that are not contained in given list. */; 234 | id_lt?: string | null /** All values less than the given value. */; 235 | id_lte?: string | null /** All values less than or equal the given value. */; 236 | id_gt?: string | null /** All values greater than the given value. */; 237 | id_gte?: 238 | | string 239 | | null /** All values greater than or equal the given value. */; 240 | id_contains?: string | null /** All values containing the given string. */; 241 | id_not_contains?: 242 | | string 243 | | null /** All values not containing the given string. */; 244 | id_starts_with?: 245 | | string 246 | | null /** All values starting with the given string. */; 247 | id_not_starts_with?: 248 | | string 249 | | null /** All values not starting with the given string. */; 250 | id_ends_with?: string | null /** All values ending with the given string. */; 251 | id_not_ends_with?: 252 | | string 253 | | null /** All values not ending with the given string. */; 254 | createdAt?: DateTime | null; 255 | createdAt_not?: DateTime | null /** All values that are not equal to given value. */; 256 | createdAt_in?: 257 | | DateTime[] 258 | | null /** All values that are contained in given list. */; 259 | createdAt_not_in?: 260 | | DateTime[] 261 | | null /** All values that are not contained in given list. */; 262 | createdAt_lt?: DateTime | null /** All values less than the given value. */; 263 | createdAt_lte?: DateTime | null /** All values less than or equal the given value. */; 264 | createdAt_gt?: DateTime | null /** All values greater than the given value. */; 265 | createdAt_gte?: DateTime | null /** All values greater than or equal the given value. */; 266 | url?: string | null; 267 | url_not?: string | null /** All values that are not equal to given value. */; 268 | url_in?: string[] | null /** All values that are contained in given list. */; 269 | url_not_in?: 270 | | string[] 271 | | null /** All values that are not contained in given list. */; 272 | url_lt?: string | null /** All values less than the given value. */; 273 | url_lte?: string | null /** All values less than or equal the given value. */; 274 | url_gt?: string | null /** All values greater than the given value. */; 275 | url_gte?: 276 | | string 277 | | null /** All values greater than or equal the given value. */; 278 | url_contains?: string | null /** All values containing the given string. */; 279 | url_not_contains?: 280 | | string 281 | | null /** All values not containing the given string. */; 282 | url_starts_with?: 283 | | string 284 | | null /** All values starting with the given string. */; 285 | url_not_starts_with?: 286 | | string 287 | | null /** All values not starting with the given string. */; 288 | url_ends_with?: string | null /** All values ending with the given string. */; 289 | url_not_ends_with?: 290 | | string 291 | | null /** All values not ending with the given string. */; 292 | belongsTo?: UserWhereInput | null; 293 | } 294 | export interface WebsiteQueryArgs { 295 | id: string; 296 | } 297 | export interface BelongsToWebsiteArgs { 298 | where?: UserWhereInput | null; 299 | } 300 | export interface AddWebsiteMutationArgs { 301 | url: string; 302 | } 303 | export interface SignupMutationArgs { 304 | email: string; 305 | password: string; 306 | name: string; 307 | } 308 | export interface LoginMutationArgs { 309 | email: string; 310 | password: string; 311 | } 312 | 313 | export enum MutationType { 314 | CREATED = "CREATED", 315 | UPDATED = "UPDATED", 316 | DELETED = "DELETED" 317 | } 318 | 319 | export namespace QueryResolvers { 320 | export interface Resolvers { 321 | info?: InfoResolver; 322 | websites?: WebsitesResolver; 323 | website?: WebsiteResolver; 324 | } 325 | 326 | export type InfoResolver = Resolver< 327 | R, 328 | Parent, 329 | Context 330 | >; 331 | export type WebsitesResolver< 332 | R = Website[], 333 | Parent = any, 334 | Context = any 335 | > = Resolver; 336 | export type WebsiteResolver< 337 | R = Website | null, 338 | Parent = any, 339 | Context = any 340 | > = Resolver; 341 | export interface WebsiteArgs { 342 | id: string; 343 | } 344 | } 345 | 346 | export namespace WebsiteResolvers { 347 | export interface Resolvers { 348 | id?: IdResolver; 349 | createdAt?: CreatedAtResolver; 350 | url?: UrlResolver; 351 | belongsTo?: BelongsToResolver; 352 | } 353 | 354 | export type IdResolver = Resolver< 355 | R, 356 | Parent, 357 | Context 358 | >; 359 | export type CreatedAtResolver< 360 | R = DateTime, 361 | Parent = any, 362 | Context = any 363 | > = Resolver; 364 | export type UrlResolver = Resolver< 365 | R, 366 | Parent, 367 | Context 368 | >; 369 | export type BelongsToResolver< 370 | R = User | null, 371 | Parent = any, 372 | Context = any 373 | > = Resolver; 374 | export interface BelongsToArgs { 375 | where?: UserWhereInput | null; 376 | } 377 | } 378 | 379 | export namespace UserResolvers { 380 | export interface Resolvers { 381 | id?: IdResolver; 382 | name?: NameResolver; 383 | email?: EmailResolver; 384 | websites?: WebsitesResolver; 385 | } 386 | 387 | export type IdResolver = Resolver< 388 | R, 389 | Parent, 390 | Context 391 | >; 392 | export type NameResolver = Resolver< 393 | R, 394 | Parent, 395 | Context 396 | >; 397 | export type EmailResolver = Resolver< 398 | R, 399 | Parent, 400 | Context 401 | >; 402 | export type WebsitesResolver< 403 | R = Website[], 404 | Parent = any, 405 | Context = any 406 | > = Resolver; 407 | } 408 | 409 | export namespace MutationResolvers { 410 | export interface Resolvers { 411 | addWebsite?: AddWebsiteResolver; 412 | signup?: SignupResolver; 413 | login?: LoginResolver; 414 | } 415 | 416 | export type AddWebsiteResolver< 417 | R = Website, 418 | Parent = any, 419 | Context = any 420 | > = Resolver; 421 | export interface AddWebsiteArgs { 422 | url: string; 423 | } 424 | 425 | export type SignupResolver< 426 | R = AuthPayload | null, 427 | Parent = any, 428 | Context = any 429 | > = Resolver; 430 | export interface SignupArgs { 431 | email: string; 432 | password: string; 433 | name: string; 434 | } 435 | 436 | export type LoginResolver< 437 | R = AuthPayload | null, 438 | Parent = any, 439 | Context = any 440 | > = Resolver; 441 | export interface LoginArgs { 442 | email: string; 443 | password: string; 444 | } 445 | } 446 | 447 | export namespace AuthPayloadResolvers { 448 | export interface Resolvers { 449 | token?: TokenResolver; 450 | user?: UserResolver; 451 | } 452 | 453 | export type TokenResolver< 454 | R = string | null, 455 | Parent = any, 456 | Context = any 457 | > = Resolver; 458 | export type UserResolver< 459 | R = User | null, 460 | Parent = any, 461 | Context = any 462 | > = Resolver; 463 | } 464 | 465 | export namespace SubscriptionResolvers { 466 | export interface Resolvers { 467 | newWebsite?: NewWebsiteResolver< 468 | WebsiteSubscriptionPayload | null, 469 | any, 470 | Context 471 | >; 472 | } 473 | 474 | export type NewWebsiteResolver< 475 | R = WebsiteSubscriptionPayload | null, 476 | Parent = any, 477 | Context = any 478 | > = Resolver; 479 | } 480 | 481 | export namespace WebsiteSubscriptionPayloadResolvers { 482 | export interface Resolvers { 483 | mutation?: MutationResolver; 484 | node?: NodeResolver; 485 | updatedFields?: UpdatedFieldsResolver; 486 | previousValues?: PreviousValuesResolver< 487 | WebsitePreviousValues | null, 488 | any, 489 | Context 490 | >; 491 | } 492 | 493 | export type MutationResolver< 494 | R = MutationType, 495 | Parent = any, 496 | Context = any 497 | > = Resolver; 498 | export type NodeResolver< 499 | R = Website | null, 500 | Parent = any, 501 | Context = any 502 | > = Resolver; 503 | export type UpdatedFieldsResolver< 504 | R = string[] | null, 505 | Parent = any, 506 | Context = any 507 | > = Resolver; 508 | export type PreviousValuesResolver< 509 | R = WebsitePreviousValues | null, 510 | Parent = any, 511 | Context = any 512 | > = Resolver; 513 | } 514 | 515 | export namespace WebsitePreviousValuesResolvers { 516 | export interface Resolvers { 517 | id?: IdResolver; 518 | createdAt?: CreatedAtResolver; 519 | url?: UrlResolver; 520 | } 521 | 522 | export type IdResolver = Resolver< 523 | R, 524 | Parent, 525 | Context 526 | >; 527 | export type CreatedAtResolver< 528 | R = DateTime, 529 | Parent = any, 530 | Context = any 531 | > = Resolver; 532 | export type UrlResolver = Resolver< 533 | R, 534 | Parent, 535 | Context 536 | >; 537 | } 538 | 539 | export namespace MyWebsites { 540 | export type Variables = {}; 541 | 542 | export type Query = { 543 | __typename?: "Query"; 544 | websites: Websites[]; 545 | }; 546 | 547 | export type Websites = { 548 | __typename?: "Website"; 549 | id: string; 550 | url: string; 551 | }; 552 | } 553 | 554 | export namespace NewWebsite { 555 | export type Variables = {}; 556 | 557 | export type Subscription = { 558 | __typename?: "Subscription"; 559 | newWebsite?: NewWebsite | null; 560 | }; 561 | 562 | export type NewWebsite = { 563 | __typename?: "WebsiteSubscriptionPayload"; 564 | node?: Node | null; 565 | }; 566 | 567 | export type Node = { 568 | __typename?: "Website"; 569 | url: string; 570 | }; 571 | } 572 | 573 | import { Injectable } from "@angular/core"; 574 | 575 | import * as Apollo from "apollo-angular"; 576 | 577 | import gql from "graphql-tag"; 578 | 579 | @Injectable({ 580 | providedIn: "root" 581 | }) 582 | export class MyWebsitesGQL extends Apollo.Query< 583 | MyWebsites.Query, 584 | MyWebsites.Variables 585 | > { 586 | document: any = gql` 587 | query MyWebsites { 588 | websites { 589 | id 590 | url 591 | } 592 | } 593 | `; 594 | } 595 | @Injectable({ 596 | providedIn: "root" 597 | }) 598 | export class NewWebsiteGQL extends Apollo.Subscription< 599 | NewWebsite.Subscription, 600 | NewWebsite.Variables 601 | > { 602 | document: any = gql` 603 | subscription NewWebsite { 604 | newWebsite { 605 | node { 606 | url 607 | } 608 | } 609 | } 610 | `; 611 | } 612 | --------------------------------------------------------------------------------