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 🙏

© 2026 – Pkg Stats / Ryan Hefner

flowkit-graphql-sdk

v1.0.3

Published

SDK TypeScript para a API GraphQL FlowKit

Readme

FlowKit GraphQL SDK

SDK TypeScript para a API GraphQL FlowKit, gerado automaticamente com type safety completo.

Oferece duas abordagens:

  • 🎯 Stateless: Você gerencia tokens (createFlowKitSDK)
  • 🚀 Com Autenticação: SDK gerencia autenticação (createAuthenticatedFlowKitSDK)

📦 Instalação

npm install flowkit-graphql-sdk graphql-request graphql-tag

🚀 Uso Rápido (Abordagem Stateless)

import { createFlowKitSDK } from 'flowkit-graphql-sdk';

// Criar SDK configurado
const sdk = createFlowKitSDK({
  endpoint: 'https://your-api.com/graphql',
  accessToken: 'your-token',
  tenantId: 'your-tenant-id'
});

// Listar FlowKits
const result = await sdk.ListFlowKits({
  page: 1,
  perPage: 10,
  sortField: 'name',
  sortOrder: 'ASC'
});

console.log('FlowKits:', result.allFlowkits);

🔐 Uso com Autenticação Integrada (NOVO!)

import { createAuthenticatedFlowKitSDK } from 'flowkit-graphql-sdk';

// Criar SDK com autenticação
const sdk = createAuthenticatedFlowKitSDK({
  endpoint: 'https://your-api.com/graphql'
});

// Opção 1: Autenticar com tokens diretos
await sdk.authenticate({
  bearerToken: 'your-token',
  tenantId: 'your-tenant-id'
});

// Opção 2: Autenticar com credenciais (se API suportar)
await sdk.authenticate({
  username: '[email protected]',
  password: 'password'
});

// ✅ Agora só usar - SDK gerencia tokens automaticamente!
const flowkits = await sdk.listFlowKits({
  page: 1,
  perPage: 20
});

// Verificar autenticação
console.log('Autenticado:', sdk.isAuthenticated());

// Logout quando necessário
sdk.logout();

📋 API Disponível

ListFlowKits

Lista FlowKits com suporte a paginação, ordenação e filtros.

const flowkits = await sdk.ListFlowKits({
  filter: {
    // Adicione filtros específicos aqui
  },
  page: 1,
  perPage: 20,
  sortField: 'name',
  sortOrder: 'DESC'
});

Campos retornados:

  • Informações básicas: id, name, title, description, revision
  • Metadados: tenant_id, doc_md, doc_url
  • Auditoria: informações de criação e atualização
  • Relacionamentos: categories, connections, connectors, flows, params

🔧 Configuração Avançada

Uso com cliente personalizado

import { GraphQLClient } from 'graphql-request';
import { getSdk } from 'flowkit-graphql-sdk';

const client = new GraphQLClient('https://your-api.com/graphql', {
  headers: {
    'Authorization': 'Bearer your-token',
    'X-Tenant-Id': 'your-tenant-id',
    'Custom-Header': 'value'
  }
});

const sdk = getSdk(client);

Tipos TypeScript

import type {
  ListFlowKitsQuery,
  FlowKitFilter,
  FlowKit
} from 'flowkit-graphql-sdk';

// Use os tipos para maior type safety
function processFlowKits(flowkits: FlowKit[]) {
  // Sua lógica aqui com tipos seguros
}

📚 Exemplo Completo com Vue/Nuxt

Abordagem Stateless (manual):

// composables/useFlowKitSDK.ts
import { createFlowKitSDK } from 'flowkit-graphql-sdk'

export const useFlowKitSDK = () => {
  const loading = ref(false)
  const error = ref<string | null>(null)
  const flowkits = ref<any[]>([])

  const listFlowKits = async (config: {
    bearerToken: string
    tenantId: string
    endpoint?: string
  }, options = {}) => {
    loading.value = true
    error.value = null

    try {
      const sdk = createFlowKitSDK({
        endpoint: config.endpoint || 'https://your-api.com/graphql',
        accessToken: config.bearerToken,
        tenantId: config.tenantId
      })

      const result = await sdk.ListFlowKits({
        page: 1,
        perPage: 20,
        sortField: 'name',
        sortOrder: 'ASC',
        ...options
      })

      flowkits.value = result.allFlowkits || []
      return result.allFlowkits || []

    } catch (err: any) {
      error.value = err.message
      throw err
    } finally {
      loading.value = false
    }
  }

  return {
    loading: readonly(loading),
    error: readonly(error),
    flowkits: readonly(flowkits),
    listFlowKits
  }
}

Abordagem com Autenticação Integrada (NOVO!):

// composables/useFlowKitAuth.ts
import { createAuthenticatedFlowKitSDK } from 'flowkit-graphql-sdk'

export const useFlowKitAuth = () => {
  const sdk = createAuthenticatedFlowKitSDK({
    endpoint: 'https://your-api.com/graphql'
  })

  const loading = ref(false)
  const error = ref<string | null>(null)
  const flowkits = ref<any[]>([])
  const isAuthenticated = ref(false)

  // ✅ Autenticação com tokens diretos
  const authenticateWithTokens = async (bearerToken: string, tenantId: string) => {
    loading.value = true
    try {
      await sdk.authenticate({ bearerToken, tenantId })
      isAuthenticated.value = true
    } catch (err: any) {
      error.value = err.message
      throw err
    } finally {
      loading.value = false
    }
  }

  // ✅ Listar FlowKits (sem precisar passar tokens!)
  const listFlowKits = async (options = {}) => {
    loading.value = true
    try {
      const result = await sdk.listFlowKits(options)
      flowkits.value = result
      return result
    } catch (err: any) {
      error.value = err.message
      throw err
    } finally {
      loading.value = false
    }
  }

  // ✅ Logout
  const logout = () => {
    sdk.logout()
    isAuthenticated.value = false
    flowkits.value = []
  }

  // ✅ Verificar autenticação
  const checkAuth = () => {
    isAuthenticated.value = sdk.isAuthenticated()
  }

  return {
    loading: readonly(loading),
    error: readonly(error),
    flowkits: readonly(flowkits),
    isAuthenticated: readonly(isAuthenticated),
    authenticateWithTokens,
    listFlowKits,
    logout,
    checkAuth
  }
}

🔄 Desenvolvimento

Este SDK é gerado automaticamente usando GraphQL Code Generator. Para regenerar:

npm run codegen
npm run build

📄 Licença

ISC