haystack 0.6.1+1

  • Readme
  • Changelog
  • Example
  • Installing
  • 30

haystack #

Port of haystack java toolkit. Use it to connect and work with SkySpark. [Project Haystack]http://project-haystack.org/ defines a tagging model and REST API for sensor systems such as HVAC, lighting, and energy equipment. [SkySpark] is a project to serve your IoT data and make analytics.

To use this package you need installed SkySpark server (and apply a some license). Authentication methods are skipped now, so you can use this library from SkySpark pub folder. Just create in you SkySpark's folder root 'pub' directory and place here your app. It will be accessible by 'localhost_or_smth:80/pub/my_app.html'. Only client side is implemented at this moment, you can't use it from server or command-line apps.

Usage #

A simple usage example (include this into HTML page):

import 'package:haystack/core.dart';
import 'package:haystack/hclient.dart';

final String uri = "http://localhost:8080/api/demo";
final String user = "haystack";
final String pass = "testpass";
HClient client;

main() {
  client = new HClient(uri, user, pass);
  client.open().then((_) => client.about()).then((HDict result) {
    print(result);
  });
}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

Changelog #

0.6.1+1 #

  • Added zinc mime type

0.6.1 #

  • Added common SkySpark interface for web and flutter clients

0.6.0+9 #

  • HTime: fixed zinc decoding for fractional seconds
  • Added commit method in HProj
  • Added simplify utils
  • Improved editing grids in HGridBuilder
  • Fixed types in Error handlers due to Dart update
  • Make CallErrError readable in console

0.6.0+5 #

  • Updated http dependency
  • Fixed CryptoUtils inport
  • Removed build in tag lists
  • Now HClientFlutter can be reused for another project
  • HClientFlutter provides setter and getter of headers for authentication requests

0.6.0 #

  • Fixed dart2 compatibility

0.6.0-dev.0.1+2 #

  • Fixed type errors
  • Fixed sdk and dependencies constrains

0.6.0-dev.0.1 #

  • Switched to dart 2

0.5.0 #

  • Made types more strict

0.4.21+1 #

  • Added HNull class

0.4.21 #

  • Updated version header

0.4.20+3 #

  • Fixed grid dump with sub-grids

0.4.20+2 #

  • Added List implementation for HGrid (unmodifiable)

0.4.20+1 #

  • Fixed column's dis method

0.4.20 #

  • Fixed HGrid toString method

0.4.19 #

  • Fixed dollar sign string parsing

0.4.18 #

  • Added HList, HXStr,
  • Made HDict and HGrid HVals
  • Enhanced Zinc for nested data structures
  • Created HaystackTokenizer for parsing haystack types

0.4.17 #

  • test renamed to work with automatic testing

0.4.16 #

  • added HGrid.rows readonly getter
  • fixed tests to work with new test package

0.4.15 #

  • added tags

0.4.14 #

  • added map interface for HDict, HRow and HHisItem

0.4.13 #

  • fixed initial bool value error in HClientWatch class

0.4.11 #

  • Just fixed hclient library names conflict

0.4.10 #

  • Added HRemove singleton

0.4.0 #

  • Initial version, created by Dmitriy Vasilyev aka kelegorm

example/main.dart

// Copyright (c) 2015, <your name>. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

library haystack.example;

import 'package:haystack/core.dart';
import 'package:haystack/hclient.dart';

final String uri = "http://localhost:8080/api/demo";
final String user = "haystack";
final String pass = "testpass";
HClient client;

void main() {
  client = new HClient(uri, user, pass);
  client.open().then((_) => client.about()).then((HDict result) {
    print(result);
  });
}

Use this package as a library

1. Depend on it

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


dependencies:
  haystack: ^0.6.1+1

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:haystack/core.dart';
import 'package:haystack/utils.dart';
import 'package:haystack/hclient.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
34
Health:
Code health derived from static analysis. [more]
2
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
60
Overall:
Weighted score of the above. [more]
30
Learn more about scoring.

We analyzed this package on Nov 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21

Platforms

Detected platforms: web

Platform components identified in package: html, io.

Health suggestions

Fix lib/src/client/HClient.dart. (-28.88 points)

Analysis of lib/src/client/HClient.dart reported 68 hints, including:

line 38 col 9: Use isEmpty instead of length

line 39 col 7: DO use curly braces for all flow control structures.

line 39 col 13: Unnecessary new keyword.

line 41 col 12: Unnecessary new keyword.

line 69 col 12: Unnecessary new keyword.

Fix lib/src/client/HClientFlutter.dart. (-27.08 points)

Analysis of lib/src/client/HClientFlutter.dart reported 63 hints, including:

line 40 col 9: Use isEmpty instead of length

line 40 col 33: Unnecessary new keyword.

line 42 col 12: Unnecessary new keyword.

line 46 col 18: Unnecessary new keyword.

line 83 col 12: Unnecessary new keyword.

Fix lib/src/HFilter.dart. (-24.47 points)

Analysis of lib/src/HFilter.dart reported 56 hints, including:

line 28 col 14: Unnecessary new keyword.

line 31 col 28: Use rethrow to rethrow a caught exception.

line 32 col 13: Unnecessary new keyword.

line 41 col 38: Unnecessary new keyword.

line 41 col 47: Unnecessary new keyword.

Fix additional 51 files with analysis or formatting issues. (-298.80 points)

Additional issues in the following files:

  • lib/src/HDateTime.dart (38 hints)
  • lib/src/HGrid.dart (38 hints)
  • lib/src/HDateTimeRange.dart (33 hints)
  • lib/src/HTime.dart (33 hints)
  • lib/src/io/HaystackToken.dart (33 hints)
  • lib/src/auth/ScramScheme.dart (30 hints)
  • lib/src/auth/AuthClientContext.dart (26 hints)
  • lib/src/io/HZincReader.dart (24 hints)
  • lib/src/io/HaystackTokenizer.dart (24 hints)
  • lib/src/HDate.dart (23 hints)
  • lib/src/HDict.dart (23 hints)
  • lib/src/HGridBuilder.dart (23 hints)
  • lib/src/HProj.dart (22 hints)
  • lib/src/auth/AuthMsg.dart (22 hints)
  • lib/src/HRef.dart (21 hints)
  • lib/src/util/cryptoUtil.dart (19 hints)
  • lib/src/HDictBuilder.dart (17 hints)
  • lib/src/HNum.dart (16 hints)
  • lib/src/HStr.dart (16 hints)
  • lib/src/io/HZincWriter.dart (16 hints)
  • lib/src/HCoord.dart (15 hints)
  • lib/src/auth/AuthScheme.dart (14 hints)
  • lib/src/HRow.dart (12 hints)
  • lib/src/io/HJsonWriter.dart (12 hints)
  • lib/src/HHisItem.dart (11 hints)
  • lib/src/HXStr.dart (11 hints)
  • lib/src/HList.dart (9 hints)
  • lib/src/HRemove.dart (9 hints)
  • lib/src/HBin.dart (8 hints)
  • lib/src/HUri.dart (5 hints)
  • lib/src/HTimeZone.dart (4 hints)
  • lib/src/client/CallErrError.dart (4 hints)
  • lib/src/HBool.dart (3 hints)
  • lib/src/utils/simplify.dart (3 hints)
  • lib/src/HMarker.dart (1 hint)
  • lib/src/HNA.dart (1 hint)
  • lib/src/HNull.dart (1 hint)
  • lib/src/HWatch.dart (1 hint)
  • lib/src/ParseError.dart (1 hint)
  • lib/src/UnknownNameError.dart (1 hint)
  • lib/src/UnknownRecError.dart (1 hint)
  • lib/src/UnknownWatchError.dart (1 hint)
  • lib/src/auth/AuthException.dart (1 hint)
  • lib/src/client/SkysparkProj.dart (1 hint)
  • lib/src/io/HGridReader.dart (1 hint)
  • lib/src/io/HGridWriter.dart (1 hint)
  • lib/src/tags.dart (1 hint)
  • lib/src/util/WebUtil.dart (1 hint)
  • lib/core.dart (Run dartfmt to format lib/core.dart.)
  • lib/src/HVal.dart (Run dartfmt to format lib/src/HVal.dart.)
  • lib/utils.dart (Run dartfmt to format lib/utils.dart.)

Maintenance issues and suggestions

Support latest dependencies. (-20 points)

The version constraint in pubspec.yaml does not support the latest published versions for 2 dependencies (intl, unicode).

Use constrained dependencies. (-20 points)

The pubspec.yaml contains 1 dependency without version constraints. Specify version ranges for the following dependencies: http.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
collection ^1.14.6 1.14.12
crypto ^2.0.3 2.1.3
http >=0.11.3 0.12.0+2
intl ^0.15.7 0.15.8 0.16.0
quiver >=0.29.0+1 <3.0.0 2.1.2+1
unicode ^0.1.0 0.1.0 0.2.2
Transitive dependencies
async 2.4.0
charcode 1.1.2
convert 2.1.1
http_parser 3.1.3
lists 0.0.23 0.1.3
matcher 0.12.6
meta 1.1.8
path 1.6.4
pedantic 1.8.0+1
source_span 1.5.5
stack_trace 1.9.3
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
test >=0.12.18+2 <2.0.0