npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

apollo-datasource-qliksense

v0.4.0

Published

Apollo datasource for Qliksense repository

Downloads

8

Readme

Qliksense datasource for GraphQL Apollo server

apollo-datasource-qliksense is a Qliksense datasource for the GraphQL Apollo server. "Apollo is the industry-standard GraphQL implementation, providing the data graph layer that connects modern apps to the cloud."

Installation

npm install apollo-datasource-qliksense

Usage

See sample-qlik-server.js and sample-qlik.json in the source repository

Sample config file qlik.json

{"certificate": "../../certificates/dev/client.pem",
 "certificate_key": "../../certificates/dev/client_key.pem",
 "urls": {
	 "qlik_default":   "https://qlk04ww.example.com:4242",
	 "qlik_node1_rep": "https://qlk01ww.example.com:4242",
	 "qlik_node1_eng": "https://qlk01ww.example.com:4747"
 }
}

const { ApolloServer, gql } = require("apollo-server");
const responseCachePlugin = require('apollo-server-plugin-response-cache');

const {
  QliksenseDataSource,
  resolvers,
  typeDefs
} = require("apollo-datasource-qliksense");

const qliksense_config = require("./qlik.json");

var qliksenseDS = {};

Object.keys(qliksense_config.urls).map(function(key, index) {
  qliksenseDS[key] = new QliksenseDataSource(
	  qliksense_config.urls[key],
	  qliksense_config.certificate,
	  qliksense_config.certificate_key
	  )
  });

const graphqlSchemaObj = {
	typeDefs: typeDefs,
	resolvers: resolvers,
	tracing: true,
	dataSources: () => (qliksenseDS),
	plugins: [responseCachePlugin()],
	cacheControl: {
	defaultMaxAge: 3600, // 3600 seconds
	},
};

const server = new ApolloServer(graphqlSchemaObj);

Sample graphql queries

Generic queries

{
  u: qliksense_get(
	proxy: "qlik_default"
	path: "/qrs/user/full?filter=userId eq matteo"
  ) {
	__typename
	... on QlikUser {
	  name
	}
  },
	d: qliksense_entity(
	proxy: "qlik_default"
	entity: "dataconnection"
	filter: "name sw 'Ama'"
  ) {
	__typename
	... on QlikDataConnection {
	  name
	}
  }
}

"

Specific queries

{
  qliksense_user(proxy: "qlik_default", filter: "userId eq matteo") {
	name
	id
	groups
	accessible_objects(resource_type: "Stream") {
	  name
	}
  }
}
{
  "data": {
	"qliksense_user": [
	  {
		"name": "Redaelli Matteo [matteo]",
		"id": "11111-111-111111",
		"groups": [
		  "Qliksense_Professional_User",
		  "Qliksense_User",
		],
		"accessible_objects": [
		  {
			"name": "Everyone"
		  },
	  ...
{
  qliksense_entity(
	entity: "custompropertydefinition"
	filter: "Name eq 'GroupAccess'"
  ) {
	json
  }
}
{
  qliksense_user(
	entity: "user"
  ) {
	userId
  }
}

Retreive user sessions

query UserSessions(
  $user_directory: String! = "MYDIR"
  $user_id: String! = "matteo"
) {
  node1_azure: qliksense_user_sessions(
	proxy: "qlik_node1_proxy"
	virtualproxy: "azure"
	user_directory: $user_directory
	user_id: $user_id
  ) {
	...user_sessions
  }
  node1_default: qliksense_user_sessions(
	proxy: "qlik_node1_proxy"
	virtualproxy: ""
	user_directory: $user_directory
	user_id: $user_id
  ) {
	...user_sessions
  }
  node1_sf: qliksense_user_sessions(
	proxy: "qlik_node1_proxy"
	virtualproxy: "sf"
	user_directory: $user_directory
	user_id: $user_id
  ) {
	...user_sessions
  }
}
fragment user_sessions on QlikUserSession {
  VirtualProxy
  SessionId
  UserDirectory
  UserId
}

Delete a user session

mutation DeleteUserSession(
  $proxy: String! = "qlik_node1_proxy"
  $virtualproxy: String! = "azuread"
  $sessionid: String! = "1cfb353c-6664-4843-9e1b-74735f983311"
) {
  qliksense_delete_user_session(
	proxy: $proxy
	virtualproxy: $virtualproxy
	sessionid: $sessionid
  )
}