Skip to content
This repository has been archived by the owner on Nov 29, 2020. It is now read-only.

Commit

Permalink
refactor: upgrading to final WC spec and LitElement
Browse files Browse the repository at this point in the history
  • Loading branch information
jarrodek committed Aug 7, 2019
1 parent 4aef40a commit d31f181
Show file tree
Hide file tree
Showing 23 changed files with 9,941 additions and 3,436 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
coverage/
_site/
dist/
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@advanced-rest-client/eslint-config', 'eslint-config-prettier'].map(require.resolve)
};
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,5 @@ $RECYCLE.BIN/
.nfs*

node_modules
build
dist
coverage
dev-lib/jexl.min.js
12 changes: 7 additions & 5 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
coverage/
test/
demo/
gen-tsd.json
wct.conf.json
CONTRIBUTING.md
analysis.json
demo/
bower.json
.travis.yml
index.html
polymer.json
dev-lib/
karma.*
husky.*
commitlint.*
.*
*.config.*
prettier.config.js
18 changes: 5 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
language: node_js
node_js: 8
node_js: stable
sudo: required
before_script: npm install -g polymer-cli @advanced-rest-client/wct-istanbub
addons:
firefox: latest
apt:
sources:
- google-chrome
- google-chrome
packages:
- google-chrome-stable
sauce_connect: true
- google-chrome-stable
script:
- npm run lint
- xvfb-run polymer test --module-resolution=node --npm --plugin local
- >-
if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then polymer test
--module-resolution=node --npm --plugin sauce --job-name
"arc-request-logic:${TRAVIS_BRANCH}" --build-number=${TRAVIS_BUILD_NUMBER};
fi
- npm test
- if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then npm run test:sl; fi
env:
global:
- secure: >-
Expand Down
68 changes: 21 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,12 @@

[![Build Status](https://travis-ci.org/advanced-rest-client/arc-request-logic.svg?branch=stage)](https://travis-ci.org/advanced-rest-client/arc-request-logic)

[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/advanced-rest-client/arc-request-logic)


# arc-request-logic

A request logic for Advanced REST Client excluding HTTP transport.

This component is responsible for handing `api-request` event, handing variables processing, request actions, `before-request` event, dispatching URL history store event, communicating with transport library, and finally dispatching `api-response` event. If the transport library it the hearth of the application then this component is it's brain.

This library uses `@advanced-rest-client/variables-evaluator` which depend on `Jexl` (version 2.x) and this library is not included by default in the element.
You need to add this dependency manually.

## Example:

```html
<arc-request-logic></arc-request-logic>
```

## API components

This components is a part of [API components ecosystem](https://elements.advancedrestclient.com/)
Expand All @@ -31,56 +19,42 @@ This components is a part of [API components ecosystem](https://elements.advance
npm install --save @advanced-rest-client/arc-request-logic
```

### In an html file
## Jexl dependency

```html
<html>
<head>
<script type="module">
import './node_modules/@advanced-rest-client/arc-request-logic/arc-request-logic.js';
</script>
</head>
<body>
<arc-request-logic></arc-request-logic>
</body>
</html>
```
This library uses `@advanced-rest-client/arc-request-logic` which depend on `Jexl` and this library is not included by default in the element.
You need to add this dependency manually.

### In a Polymer 3 element
You must install [Jexl](https://github.com/TomFrost/Jexl) on your project, and build it for browser. See `dev-lib/` folder for an example of such a build.

```js
import {PolymerElement, html} from './node_modules/@polymer/polymer/polymer-element.js';
import './node_modules/@advanced-rest-client/arc-request-logic/arc-request-logic.js';
Finally you have to either pass the pointer to Jexl library to `jexl` property or point to a relative in the `window` object.

class SampleElement extends PolymerElement {
static get template() {
return html`
<arc-request-logic></arc-request-logic>
`;
}
}
customElements.define('sample-element', SampleElement);
Setting Jexl reference:

```javascript
const eval = document.querySelector('arc-request-logic');
eval.jexl = myJexlVariable;
```

### Installation
Setting path to Jexl:

```sh
git clone https://github.com/advanced-rest-client/arc-request-logic
cd api-url-editor
npm install
npm install -g polymer-cli
```html
<arc-request-logic jexlpath="ArcVariables.JexlDev"></arc-request-logic>
```
This expects the Jexl library to be under `window.ArcVariables.JexlDev` variable.


### Running the demo locally
### development

```sh
polymer serve --npm
open http://127.0.0.1:<port>/demo/
git clone https://github.com/advanced-rest-client/arc-request-logic
cd arc-request-logic
npm install
```

### Running the tests

```sh
polymer test --npm
npm test
```

### Middleware
Expand Down

0 comments on commit d31f181

Please sign in to comment.