@atlassianlabs/jql-editor-autocomplete-rest
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

JQL Editor Autocomplete REST

Atlassian license

This package wraps the callbacks needed to fetch autocomplete data for the JQL editor, and provides simple hooks to delegate to Jira Cloud REST API's.

We require these configurable hooks to allow consumers to define their own fetch library given their app environment, e.g. Jira, Connect, Forge etc.

Usage

A minimal configuration of the autocomplete provider is as follows:

import { useAutocompleteProvider } from '@atlassianlabs/jql-editor-autocomplete-rest';

const getInitialData = async (url: string) => {
  const response = await fetch(url, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ includeCollapsedFields: true })
  });
  const data = response.json();
  
  return {
    jqlFields: data.visibleFieldNames,
    jqlFunctions: data.visibleFunctionNames,
  };
};

const getSuggestions = async (url: string) => {
  const response = await fetch(url);
  return response.json();
};

const useMyAutocompleteProvider = () => {
  return useAutocompleteProvider('my-app', getInitialData, getSuggestions);
};

Installation

yarn add @atlassianlabs/jql-editor-autocomplete-rest

Support

For developers outside of Atlassian looking for help, or to report issues, please make a post on the community forum. We will monitor the forums and redirect topics to the appropriate maintainers.

License

Copyright (c) 2021 - 2022 Atlassian and others. Apache 2.0 licensed, see LICENSE file.

/@atlassianlabs/jql-editor-autocomplete-rest/

    Package Sidebar

    Install

    npm i @atlassianlabs/jql-editor-autocomplete-rest

    Weekly Downloads

    789

    Version

    1.1.2

    License

    none

    Unpacked Size

    469 kB

    Total Files

    98

    Last publish

    Collaborators

    • doklovic
    • prkb
    • crumley
    • nrundquist
    • dkolbly-atlassian
    • kpainter-atl
    • soneymathew