atlassian_connect_shelf 0.11.9

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 3

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
  app.router..addInstallationRoute()
            ..addDescriptorTemplateRoute();
  
  // define a child route for all routes that will be authenticated via addon session token
  app.router.child('/service',
      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
  app.router.child('/ui',
      middleware: app.atlassianHostAuthenticator)
      ..get('/exampleUI.html',
          app.moustacheFile('ui/exampleUI.html', includeExtraParams: true));
  
  // start your engines
  app.start();
}

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(HttpBodyHandler.processResponse)
      .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:


dependencies:
  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';
  
Version Uploaded Documentation Archive
0.11.9 May 11, 2016 Go to the documentation of atlassian_connect_shelf 0.11.9 Download atlassian_connect_shelf 0.11.9 archive
0.11.8 May 11, 2016 Go to the documentation of atlassian_connect_shelf 0.11.8 Download atlassian_connect_shelf 0.11.8 archive
0.11.7 Apr 10, 2016 Go to the documentation of atlassian_connect_shelf 0.11.7 Download atlassian_connect_shelf 0.11.7 archive
0.11.6 Mar 11, 2016 Go to the documentation of atlassian_connect_shelf 0.11.6 Download atlassian_connect_shelf 0.11.6 archive
0.11.5 Mar 11, 2016 Go to the documentation of atlassian_connect_shelf 0.11.5 Download atlassian_connect_shelf 0.11.5 archive
0.11.4 Oct 28, 2015 Go to the documentation of atlassian_connect_shelf 0.11.4 Download atlassian_connect_shelf 0.11.4 archive
0.11.3 Aug 20, 2015 Go to the documentation of atlassian_connect_shelf 0.11.3 Download atlassian_connect_shelf 0.11.3 archive
0.11.2 Aug 12, 2015 Go to the documentation of atlassian_connect_shelf 0.11.2 Download atlassian_connect_shelf 0.11.2 archive
0.11.1 Jul 14, 2015 Go to the documentation of atlassian_connect_shelf 0.11.1 Download atlassian_connect_shelf 0.11.1 archive
0.11.0 Jul 14, 2015 Go to the documentation of atlassian_connect_shelf 0.11.0 Download atlassian_connect_shelf 0.11.0 archive

All 32 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
5
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
3
Learn more about scoring.

We analyzed this package on Jul 22, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.69.0
  • pana: 0.11.7

Platforms

Detected platforms: other

Primary library: package:atlassian_connect_shelf/atlassian_connect_shelf.dart with components: io, isolate, mirrors.

Issues and suggestions

Fix lib/src/descriptor_builders/standard_impl.dart.

Analysis of lib/src/descriptor_builders/standard_impl.dart failed with 9 errors, 1 hint, including:

line 48 col 22: The method 'change' isn't defined for the class 'Module'.

line 49 col 38: The getter 'name' isn't defined for the class 'Module'.

line 63 col 14: The argument type '(Uri) → Lifecycle' can't be assigned to the parameter type '(dynamic) → dynamic'.

line 76 col 49: The argument type '(DefaultRoutePath) → UriTemplate' can't be assigned to the parameter type '(dynamic) → dynamic'.

line 87 col 49: The argument type '(DefaultRoutePath) → Uri' can't be assigned to the parameter type '(dynamic) → dynamic'.

Fix lib/src/descriptor_builders/hipchat.dart.

Analysis of lib/src/descriptor_builders/hipchat.dart failed with 6 errors, including:

line 50 col 13: The argument type 'Iterable<HipchatWebhook>' can't be assigned to the parameter type 'Iterable<Webhook>'.

line 55 col 14: The argument type '(Uri) → Installable' can't be assigned to the parameter type '(dynamic) → dynamic'.

line 62 col 14: The argument type '(Uri) → Configurable' can't be assigned to the parameter type '(dynamic) → dynamic'.

line 68 col 14: The argument type '(Uri) → HipchatLinks' can't be assigned to the parameter type '(dynamic) → dynamic'.

line 73 col 49: The argument type '(DefaultRoutePath) → Uri' can't be assigned to the parameter type '(dynamic) → dynamic'.

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 https://www.dartlang.org/dart-2#migration.

Running dartdoc failed.

Make sure dartdoc runs without any issues.

Package is too old.

The package was released more than two years ago.

Fix additional 17 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/router/acdart_router.dart (4 errors, 1 hint)
  • lib/src/config/config.dart (3 errors, 2 hints)
  • lib/src/router/common/standard_routes_impl.dart (3 errors, 1 hint)
  • lib/src/descriptor_builders/bitbucket_impl.dart (3 errors)
  • lib/src/descriptor_builders/confluence_impl.dart (3 errors)
  • lib/src/descriptor_builders/jira_impl.dart (3 errors)
  • lib/src/router/hipchat/hipchat_impl.dart (3 errors)
  • lib/src/router/common/common_routes_impl.dart (2 errors)
  • lib/acdart_app.dart (2 errors, 1 hint)
  • lib/src/router/bitbucket/bitbucket_impl.dart (2 errors, 1 hint)
  • lib/src/router/confluence/confluence_impl.dart (2 errors, 1 hint)
  • lib/src/router/jira/jira_impl.dart (2 errors, 1 hint)
  • lib/src/auth.dart (1 error, 3 hints)
  • lib/router.dart (1 error, 5 hints)
  • lib/acdart_shelf_middleware.dart (1 error, 1 hint)
  • lib/src/auth/auth_impl.dart (1 error)
  • lib/src/descriptor_builders/descriptor_builder.dart (2 hints)

Package is pre-v1 release.

While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction of the API.

Maintain an example.

None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use atlassian_connect_shelf.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.9.0 <2.0.0
appengine ^0.3.3 0.3.3+1 0.4.4+2
atlassian_connect_host >=0.5.7 <0.5.8 0.5.7
constrain ^0.2.8 0.2.8
either ^0.1.8 0.1.8
http_exception ^0.1.0 0.1.0
mojito >=0.6.5 <0.6.6 0.6.5 0.6.6
mustache >=0.2.5 <0.3.0 0.2.5+1 1.0.1
option ^1.1.0 1.2.0
stuff ^0.0.6 0.0.7
unscripted >=0.6.2 <0.7.0 0.6.2
uuid >=0.5.0 <0.6.0 0.5.1 1.0.1
Transitive dependencies
_discoveryapis_commons 0.1.6+1
ansicolor 0.0.10 0.1.1
args 0.13.7 1.4.4
async 1.13.3 2.0.8
atlassian_connect_jwt 0.3.7
atlassian_connect_models 0.0.3
bignum 0.0.7 0.1.0
bson 0.2.0 0.3.1
charcode 1.1.2
cipher 0.7.1
collection 1.14.11
concepts 0.2.0
config 0.0.5
convert 1.1.1 2.0.2
converters 0.0.3
crypto 0.9.2+1 2.0.6
dart_jwt 0.4.6 0.6.0
fixnum 0.9.1+2 0.10.8
gcloud 0.2.0+14 0.5.0
googleapis 0.28.0 0.51.0
googleapis_auth 0.2.5+1
googleapis_beta 0.27.1 0.46.0
hateoas_models 0.2.0
http 0.11.3+17
http_parser 3.1.3
http_server 0.9.8
logging 0.11.3+2
matcher 0.12.4
memcache 0.2.2 0.3.0
mime 0.9.6+2
mockable_filesystem 0.0.3
mongo_dart 0.2.10 0.3.2
mongo_dart_query 0.2.2 0.3.1
more 1.9.2
oauth 0.3.0 0.4.0
path 1.3.9 1.6.2
petitparser 1.7.7
protobuf 0.5.5 0.9.0+1
quiver 0.21.4 2.0.0+1
shelf 0.6.8 0.7.3+3
shelf_auth 0.7.2 0.7.4
shelf_auth_session 0.4.11 0.4.12
shelf_bind 0.9.3 0.9.4
shelf_exception_handler 0.1.0
shelf_oauth 0.8.2
shelf_oauth_memcache 0.3.7
shelf_path 0.1.8
shelf_proxy 0.1.0+4
shelf_response_formatter 0.1.0
shelf_rest 0.3.4 0.3.5
shelf_route 0.14.2 0.14.3
shelf_static 0.2.8
source_span 1.4.1
stack_trace 1.9.3
stream_channel 1.6.8
string_scanner 1.0.3
supports_color 0.1.1
typed_data 1.1.6
uri 0.11.3
utf 0.9.0+5
xml 2.6.0 3.0.1
Dev dependencies
mockito >=0.11.0 <0.12.0
test ^0.12.0