This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import memory from 'feathers-memory' | |
import intersect from '@turf/intersect' | |
// Create a sift filter supporting a geospatial operator | |
const matcher = (query) => sift(query, { | |
expressions: { | |
$geoIntersects: function(query, value) { | |
const polygon1 = _.get(query, '$geometry') | |
const polygon2 = value | |
if (!polygon1 || !polygon2) return false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Our geospatial services store GeoJson objects like this | |
const result = await app.service('service').create({ | |
type: 'Polygon', | |
geometry: { | |
type: 'Polygon', | |
coordinates: [...] | |
}, | |
properties: { ... } | |
}) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const MockedService = require('feathers-memory') | |
// This is default fake data to test your service | |
const store = { | |
0: { | |
id: 0, | |
property: 'xxx' | |
} | |
} | |
// This will be the next available ID when creating new objects | |
const startId = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async main () { | |
// Initialize the sole client we need | |
await this.setupKano() | |
// Now we can transparently access Weacast API whenever required through the main app client | |
const response = await this.api.service('forecasts').find() | |
this.forecastModels = response.data | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import config from 'config' | |
import feathers from '@feathersjs/client' | |
import reactive from 'feathers-reactive' | |
... | |
// Initialize a Feathers client with given options | |
async setupClient (options) { | |
let client = feathers() | |
// Initialize whatever you need based on your client config | |
if (options.websocket) client.configure(feathers.socketio(...)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import path from 'path' | |
import { PrintApp } from './page-model' | |
export const appUrl = process.env.APP_URL || 'http://kargo-www.s3-website.eu-central-1.amazonaws.com/' | |
let app = new PrintApp() | |
fixture`Print`// declare the fixture | |
.page`${appUrl}` | |
.afterEach(async test => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Selector } from 'testcafe' | |
export class PrintApp { | |
constructor () { | |
this.baseLayerMenu = Selector('.basemaps') | |
this.overlayLayerMenu = Selector('.leaflet-control-layers') | |
this.fileInput = Selector('input').withAttribute('type', 'file') | |
this.printMenu = Selector('#leafletEasyPrint') | |
} | |
async checkNoError (test) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import makeDebug from 'debug' | |
import _ from 'lodash' | |
import { Verifier } from 'feathers-authentication-oauth2' | |
const debug = makeDebug('feathers-authentication-oauth2:verify') | |
class OAuth2Verifier extends Verifier { | |
constructor (app, options = {}) { | |
options.emailField = options.emailField || 'email' | |
options.emailFieldInProfile = options.emailFieldInProfile || ['email', 'emails[0].value'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import makeDebug from 'debug' | |
import { getItems } from 'feathers-hooks-common' | |
import { BadRequest } from 'feathers-errors' | |
const debug = makeDebug('debug') | |
export function enforcePasswordPolicy (options = {}) { | |
return async function (hook) { | |
if (hook.type !== 'before') { | |
throw new Error(`The 'enforePasswordPolicy' hook should only be used as a 'before' hook.`) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path') | |
var fs = require('fs') | |
module.exports = { | |
host: process.env.HOSTNAME || 'localhost', | |
port: 8081, | |
authentication: { | |
secret: 'xxx', | |
strategies: [ | |
'jwt', |