How to use keen-analysis - 10 common examples

To help you get started, we’ve selected a few keen-analysis 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 keen / explorer / test / unit / actions / ExplorerActionsSpec.js View on Github external
beforeEach(() => {
    client = new KeenAnalysis(TestHelpers.createClient());
    // spyDispatch.mockClear();
  });
github keen / explorer / test / unit / actions / ExplorerActionsSpec.js View on Github external
describe('actions/ExplorerActions', () => {
  const analysisClient = new KeenAnalysis(TestHelpers.createClient());
  const mockDispatch = jest.fn();
  let spyGet;
  let client;
  let spyRunQuery;

  beforeAll(() => {
    XHRmock.setup();
  });

  afterAll(() => {
    spyDispatch.mockRestore();
    XHRmock.teardown();
  });

  beforeEach(() => {
    client = new KeenAnalysis(TestHelpers.createClient());
github keen / explorer / test / unit / modules / persistence / KeenSavedQueriesSpec.js View on Github external
beforeEach(() => {
    config = {
      masterKey: 'fakeKey',
      baseUrl: 'https://test-bookmarks-keen.io/projects/123/queries/saved',
      client: new KeenAnalysis(KeenHelpers.createClient())
    };
    KeenSavedQueriesObj = new KeenSavedQueries(config);
    bookmarkObj = {
      id: 'some-name-original',
      query_name: 'some-name',
      query: {
        analysis_type: 'count',
        event_collection: 'activities',
      },
      metadata: {
        visualization: { chart_type: 'metric' },
        display_name: 'some name',
      }
    };
  });
github keen / explorer / test / unit / utils / ExplorerUtilsSpec.js View on Github external
beforeEach(() => {
      explorer = TestHelpers.createExplorerModel();
      client = new KeenAnalysis(TestHelpers.createClient());
    });
github keen / explorer / test / unit / components / explorer / index_spec.js View on Github external
beforeEach(() => {
    ExplorerStore.clearAll();
    ExplorerActions.create({ id: '1', query_name: 'A persisted query', metadata: { display_name: 'some name' } });
    ExplorerActions.setActive('1');

    project = TestHelpers.createProject();
    project.client = client = new KeenAnalysis(TestHelpers.createClient());
    project.client.resources({
      'events': '{protocol}://{host}/3.0/projects/{projectId}/events'
    });

    config = { persistence: null };
    explorer = ExplorerStore.get('1');
    component = TestUtils.renderIntoDocument();
  });
github keen / explorer / test / unit / components / explorer / visualization / index_spec.js View on Github external
beforeEach(() => {
    client = new KeenAnalysis(TestHelpers.createClient());
    model = TestHelpers.createExplorerModel();
    model.id = 10;
    project = TestHelpers.createProject();

    chartOptionsStub = jest.spyOn(ChartTypeUtils, 'getChartTypeOptions').mockImplementation(()=>{}).mockReturnValue([]);
    exportToCsvStub = jest.spyOn(DataUtils, 'exportToCsv').mockImplementation(()=>{}).mockReturnValue([]);

    renderComponent = function(props) {
      const defaults = {
        client,
        model,
        project,
        persistence: null,
        appState: AppStateStore.getState()
      };
      const propsExt = _.assign({}, defaults, props);
github keen / explorer / test / support / TestHelpers.js View on Github external
createProject: () => {
    const schema = buildProjectSchema();
    return {
      client: new KeenAnalysis({
        projectId: 'projectId',
        protocol: 'https',
        host: 'api.keen.io',
        masterKey: 'masterKey',
        apiVersion: '3.0'
      }),
      loading: false,
      eventCollections: FormatUtils.sortItems(_.map(schema, 'name')),
      schema: schema
    };
  },
github chronologic / eth-alarm-clock-dapp / app / stores / KeenStore.js View on Github external
async initialize() {
    await this._web3Service.init();

    this.networkId = this._web3Service.network.id;

    this.analysisClient = new KeenAnalysis({
      projectId: this.projectId,
      readKey: this.readKey
    });

    this.trackingClient = new KeenTracking({
      projectId: this.projectId,
      writeKey: this.writeKey
    });

    this.sendPageView();

    this._pollActiveTimeNodesCount();
  }
github keen / explorer / lib / js / app / index.js View on Github external
constructor(props) {
    const { keenAnalysis, keenTracking } = props;

    client = keenAnalysis.instance || new KeenAnalysis(keenAnalysis.config);

    if (keenTracking) {
      keenTrackingClient = keenTracking.instance || new KeenTracking(keenTracking.config);
    }

    ReactDOM.render(
      
        
      ,
      document.querySelector(props.container),
    );
github chronologic / eth-alarm-clock-dapp / app / stores / KeenStore.js View on Github external
async _getActiveTimeNodesHistory() {
    await this.initialized;

    if (!this.isBlacklisted) {
      const count = new KeenAnalysis.Query('count_unique', {
        event_collection: COLLECTIONS.TIMENODES,
        target_property: 'nodeAddress',
        timeframe: {
          start: moment()
            .subtract(24, 'hours')
            .toISOString(),
          end: moment().toISOString()
        },
        interval: 'hourly',
        group_by: 'nodeAddress',
        filters: [
          {
            property_name: 'networkId',
            operator: 'eq',
            property_value: this.timeNodeSpecificProviderNetId
          },

keen-analysis

A JavaScript client for Keen.IO

MIT
Latest version published 4 years ago

Package Health Score

51 / 100
Full package analysis