How to use appbase-js - 10 common examples

To help you get started, we’ve selected a few appbase-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github appbaseio / dejavu / appbase-feed.js View on Github external
var elasticsearch = require('elasticsearch')
var esTypes = [];

// app and authentication configurations
const HOSTNAME = "scalr.api.appbase.io"
const APPNAME = "createnewtestapp01"
const USERNAME = "RIvfxo1u1"
const PASSWORD = "dee8ee52-8b75-4b5b-be4f-9df3c364f59f"

// elasticsearch client. we use it for indexing, mappings, search settings, etc.
var client = new elasticsearch.Client({
 host: 'https://'+USERNAME+":"+PASSWORD+"@"+HOSTNAME,
});


var streamingClient = appbase.newClient({
    url: 'https://'+HOSTNAME,
    appname: APPNAME,
    username: USERNAME,
    password: PASSWORD
});

streamingData = [];

function init(){
    var client = new elasticsearch.Client({
            host: 'https://'+USERNAME+":"+PASSWORD+"@"+HOSTNAME,
            apiVersion: '1.6'
        });
    client.index({
        index: APPNAME,
        type: "tweet",
github appbaseio / reactivesearch / packages / vue / src / components / ReactiveBase / index.jsx View on Github external
selectedValue.value = parsedParams.value;
					} else {
						selectedValue.value = parsedParams;
					}
					if (parsedParams.category) selectedValue.category = parsedParams.category;
					selectedValues = {
						...selectedValues,
						[key]: selectedValue,
					};
				} catch (e) {
					// Do not add to selectedValues if JSON parsing fails.
				}
			});

			const { headers = {}, themePreset } = props;
			const appbaseRef = Appbase(config);

			if (this.$props.transformRequest) {
				appbaseRef.transformRequest = this.$props.transformRequest;
			}

			if (this.$props.transformResponse) {
				appbaseRef.transformResponse = this.$props.transformResponse;
			}

			const initialState = {
				config: {
					...config,
					mapKey: props.mapKey,
					themePreset,
				},
				appbaseRef,
github appbaseio / reactivesearch / packages / web / src / components / basic / ReactiveBase.js View on Github external
selectedValue.value = parsedParams.value;
				} else {
					selectedValue.value = parsedParams;
				}
				if (parsedParams.category) selectedValue.category = parsedParams.category;
				selectedValues = {
					...selectedValues,
					[key]: selectedValue,
				};
			} catch (e) {
				// Do not add to selectedValues if JSON parsing fails.
			}
		});

		const { headers = {}, themePreset } = props;
		const appbaseRef = Appbase(config);
		if (this.props.transformRequest) {
			appbaseRef.transformRequest = this.props.transformRequest;
		}

		const initialState = {
			config: { ...config, mapKey: props.mapKey, themePreset },
			appbaseRef,
			selectedValues,
			headers,
			...this.props.initialState,
		};
		this.store = configureStore(initialState);
	};
github appbaseio / dashboard / src / pages / OnboardingPage / utils / appbaseHelpers.js View on Github external
indexData = () => {
		const finalData = [];
		const indexObj = {
			index: {},
		};
		moviesData.forEach(record => {
			finalData.push(indexObj);
			finalData.push(record);
		});
		this.appbaseRef = Appbase({
			url: this.address,
			app: this.app.appName,
			username: this.app.username,
			password: this.app.password,
		});
		return new Promise((resolve, reject) => {
			this.appbaseRef
				.bulk({
					type: this.app.type,
					body: finalData,
				})
				.then(() => {
					resolve();
				})
				.catch(e => {
					reject(e);
github appbaseio / dashboard / src / views / onboarding / utils / appbaseHelpers.js View on Github external
indexData = () => {
		const finalData = [];
		const indexObj = {
			index: {},
		};
		moviesData.forEach((record) => {
			finalData.push(indexObj);
			finalData.push(record);
		});
		this.appbaseRef = Appbase({
			url: this.address,
			app: this.app.appName,
			username: this.app.username,
			password: this.app.password,
		});
		return new Promise((resolve, reject) => {
			this.appbaseRef
				.bulk({
					type: this.app.type,
					body: finalData,
				})
				.then(() => {
					resolve();
				})
				.catch((e) => {
					reject(e);
github appbaseio / reactivesearch / packages / web / lib / components / basic / ReactiveBase.js View on Github external
_ref = _iterator[_i++];
				} else {
					_i = _iterator.next();
					if (_i.done) break;
					_ref = _i.value;
				}

				var key = _ref;

				selectedValues = _extends({}, selectedValues, (_extends2 = {}, _extends2[key] = { value: JSON.parse(_this.params.get(key)) }, _extends2));
			}
		} catch (e) {
			selectedValues = {};
		};

		var appbaseRef = new Appbase(config);
		_this.store = configureStore({ config: config, appbaseRef: appbaseRef, selectedValues: selectedValues });
		return _this;
	}
github appbaseio-apps / todos-native / api / todos.js View on Github external
constructor(key) {
    this.key = key;
    this.todos = [];
    this.onChanges = [];
    this.appbaseRef = new Appbase({
      url: CONFIG.url,
      app: CONFIG.app,
      credentials: CONFIG.credentials,
      type: CONFIG.type,
    });
  }
github appbaseio / reactivesearch / packages / native / src / components / basic / ReactiveBase.js View on Github external
super(props);

		this.type = props.type ? props.type : '*';

		const credentials
			= props.url && props.url.trim() !== '' && !props.credentials ? null : props.credentials;

		const config = {
			url: props.url && props.url.trim() !== '' ? props.url : 'https://scalr.api.appbase.io',
			app: props.app,
			credentials,
			type: this.type,
		};

		const { headers = {} } = props;
		const appbaseRef = Appbase(config);
		this.store = configureStore({ config, appbaseRef, headers });
	}
github appbaseio / reactivesearch / packages / web / examples / withStreaming / src / index.js View on Github external
ResultList,
	ReactiveList,
} from '@appbaseio/reactivesearch';

const streamingData = {
	genres: 'Action',
	original_language: 'English',
	original_title: 'Star Wars: The Last Jedi',
	overview:
		'Rey develops her newly discovered abilities with the guidance of Luke Skywalker, who is unsettled by the strength of her powers. Meanwhile, the Resistance prepares to do battle with the First Order.',
	poster_path: '/kOVEVeg59E0wsnXmF9nrh6OmWII.jpg',
	release_year: 2017,
	tagline: 'Episode VIII - The Last Jedi',
};

const appbaseRef = Appbase({
	url: 'https://scalr.api.appbase.io',
	app: 'streaming-demo',
	credentials: 'MpdmF7Z7C:f61f9b71-a3d0-4c8d-97a8-88b8106b553a',
});

const indexNewData = () =>
	new Promise((resolve, reject) => {
		appbaseRef
			.index({
				type: 'movies',
				body: streamingData,
			})
			.then(() => {
				resolve();
			})
			.catch((e) => {
github appbaseio / reactivesearch / packages / web / src / server / index.js View on Github external
? null
				: settings.credentials;
		const config = {
			url:
				settings.url && settings.url.trim() !== ''
					? settings.url
					: 'https://scalr.api.appbase.io',
			app: settings.app,
			credentials,
			transformRequest: settings.transformRequest || null,
			type: settings.type ? settings.type : '*',
			transformResponse: settings.transformResponse || null,
			graphQLUrl: settings.graphQLUrl || '',
			headers: settings.headers || {},
		};
		const appbaseRef = Appbase(config);

		let components = [];
		let selectedValues = {};
		let queryList = {};
		let queryLog = {};
		let queryOptions = {};
		let dependencyTree = {};
		let finalQuery = [];
		let orderOfQueries = [];
		let hits = {};
		let aggregations = {};
		let state = {};

		componentCollection.forEach((component) => {
			const componentType = component.source.name;
			components = [...components, component.componentId];

appbase-js

Appbase.io streaming client lib for Javascript

MIT
Latest version published 10 months ago

Package Health Score

59 / 100
Full package analysis

Popular appbase-js functions