atlassian_connect_shelf 0.11.9

  • Readme
  • Changelog
  • Installing
  • 0

Atlassian Connect Shelf Server #

Introduction #

Provides a server based on the Shelf library.

It includes the following Shelf Middleware components:

  • productHostAuthenticator. A Shelf Middleware component for authenticating requests from product hosts
  • sessionTokenAuthenticator. A Shelf Middleware component for authenticating requests from the addon client code using the Atlassian Connect session token mechanism

In addition it includes:

  • AcDartRouter. An extension of a Shelf Route router adding:

    • helpers for easily defining core routes such as for handling installation requests and serving atlassian-connect.json
    • Additional Shelf Bind custom objects to support injection of the following into handlers
      • AcSessionContext containing the session information relating to the current request
      • AcHostService for all host related services for the Atlassian product host that is associated with the current request.
      • AcHostHttpClient to communicate with the Atlassian product host that is associated with the current request.
      • AcHostRegistration the registration details for the Atlassian product host that is associated with the current request.
      • AcDartRequestContext a wrapper object that contains access to the other context objects aiding discoverability
  • AcDartApp. Provides a convenient entry point into the app

The Shelf Server uses all the other Atlassian Connect Dart libraries. It's the easiest way to get started and we believe provides a good solution. However, if you prefer another web framework then you can still use all the other Atlassian Connect Dart libraries, greatly reducing the effort to get up and running.

Using #

Basic Usage #

Note there is an example project that is in the example folder of the library that illustrates basic usage.

Create your Configuration

See the documentation for the Atlassian Connect Configuration library for details.

Define your Routes

Create your app and set up the routes by using the acdart function as the entry point. Call start when ready to bring up the server.

void main() {
  final app = acdart(config);
  // add standard handlers for installation and descriptor
  // define a child route for all routes that will be authenticated via addon session token
      middleware: app.addonSessionAuthenticator)
      ..get('/issue/{issueKey}', _fetchJiraIssue)
      ..put('/issue/{issueKey}', _updateJiraIssue);
  // define a child route for all routes that will be authenticated via Atlassian Host token
      middleware: app.atlassianHostAuthenticator)
          app.moustacheFile('ui/exampleUI.html', includeExtraParams: true));
  // start your engines

Request handlers (thanks to Shelf Bind) are just ordinary Dart functions and have access to the additional objects injected via AcDartApp.

In this case the issueKey was defined on the route (/issue/{issueKey}) so can simply be accessed as a function parameter and AcHostHttpClient is one of the objects AcDart can inject for you.

As the route is a child of /service it is authenticated via the Addon Session token so the AcHostHttpClient object will be initialised for communication with the correct host.

Future<Map> _fetchJiraIssue(String issueKey, AcHostHttpClient httpClient) {
  _log.fine('fetching jira issue $issueKey');

  final jiraResponse =
      httpClient.get('rest/api/2/issue/$issueKey', signRequest: true)
        .then((req) => req.close());

  return jiraResponse
      .then((body) => body.body);

0.11.8 #

  • ngrok 2

0.10.0 #

  • upgraded mojito

0.8.0 #

  • Now built on top of mojito framework \o/

0.7.0 #

0.6.2 #

  • Added support for jwt in header
  • Added heroku setup helper

0.6.1 #

  • Added more injectable objects

0.6.0 #

  • Reworked around new capabilities of Shelf Route and Shelf Bind

0.5.3 #

  • AcDart Config upgraded to 0.3.2

0.5.2 #

  • minor bits and bobs

0.5.1 #

  • AcDart Config upgraded to 0.3.1

0.5.0 #

  • AcDart Config upgraded to 0.3.0

0.4.0 #

  • AcDart Config upgraded to 0.2.0

0.3.1 #

  • upgraded host services (via config) to pick up hijacking fix

0.3.0+4 #

  • upgraded min sdk version

0.3.0+3 #

  • Bug fix. Resolve file paths correctly

0.3.0+2 #

  • Bug fix. Using correct serverPort

0.3.0+1 #

  • Upgraded to atlassian_connect_config 0.1.0+1

0.3.0 #

  • Upgraded to shelf route 0.3.1. Note path variables have now changed to {}

0.2.0 #

  • Upgraded to shelf 0.4.0 and shelf route 0.2.0

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  atlassian_connect_shelf: ^0.11.9

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:atlassian_connect_shelf/atlassian_connect_shelf.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.9.0 <2.0.0