Skip to content

Revitalize #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2.1
parameters:
node-version:
type: string
default: "16.13.2"
default: "18.13.0"
orbs:
node: circleci/node@5.0.0
slack: circleci/slack@4.5.3
Expand Down Expand Up @@ -72,23 +72,23 @@ commands:
jobs:
test:
docker:
- image: circleci/node:16-stretch
- image: cimg/node:18.13.0
steps:
- checkout
- node/install:
node-version: << pipeline.parameters.node-version >>
- run:
name: Audit Dependencies
command: npm audit --production --audit-level=high
- node/install-packages:
cache-path: ./node_modules
override-ci-command: npm install
- run:
name: Audit Dependencies
command: npm audit --production --audit-level=high
- run:
name: Running Mocha Tests
command: npm test
build:
docker:
- image: circleci/node:16-stretch
- image: cimg/node:18.13.0
user: root
steps:
- checkout
Expand Down Expand Up @@ -118,8 +118,10 @@ workflows:
jobs:
- build:
name: "Build and publish docker image"
context:
- componentspusher
filters:
branches:
ignore: /.*/
tags:
only: /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/
only: /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/
4 changes: 3 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ module.exports = {
],
rules: {
'linebreak-style': 0,
'import/no-extraneous-dependencies': ['error', { devDependencies: ['spec/**/*', 'spec-integration/**/*'] }],
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
'import/no-import-module-exports': 0,
'no-plusplus': 0,
'no-unused-vars': 0,
'no-await-in-loop': 0,
'no-restricted-syntax': 0,
'prefer-default-export': 0,
'import/prefer-default-export': 0,
'class-methods-use-this': 1,
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 3.0.0 (January 19, 2024)
* Revitalize

## 2.0.1 (November 18, 2022)
* Fix `Lookup Objects (plural)` getMetadata function

Expand Down
97 changes: 62 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

[elastic.io](http://www.elastic.io) iPaaS component that connects to [ API]().

The current release of the component tested on API `v1`.

## Environment variables
| Name | Mandatory | Description | Values |
|-----------------------|-----------|------------------------------------------------------------------------------|-----------------------|
Expand All @@ -38,15 +40,15 @@ Component credentials configuration fields:

### Make Raw Request

Executes custom request.
Executes custom requests utilizing plain REST API

#### Configuration Fields

* **Don't throw error on 404 Response** - (optional, boolean): Treat 404 HTTP responses not as error, defaults to `false`.
* **Don't throw error on 404 Response** - (optional, boolean): Treat 404 HTTP responses not as an error, defaults to `false`.

#### Input Metadata

* **Url** - (string, required): Path of the resource relative to the base URL.
* **Url** - (string, required): Path of the resource relative to the base URL (here comes a part of the path that goes after `https://example.com/v1/`)
* **Method** - (string, required): HTTP verb to use in the request, one of `GET`, `POST`, `PUT`, `PATCH`, `DELETE`.
* **Request Body** - (object, optional): Body of the request to send.

Expand All @@ -58,28 +60,32 @@ Executes custom request.

### Upsert Object

Updates (of record found) or creates a new object.
Updates (if record found) or creates a new object.

#### Configuration Fields

* **Object Type** - (dropdown, required): Object-type to upsert. E.g `Users`.
* **Object Type** - (dropdown, required): Object-type to upsert. Currently, supported types are:
* Products
* Users

#### Input Metadata

* **ID** - (string, optional): ID of the object to upsert.
And dynamically generated fields according to chosen `Upsert Schema`.
And dynamically generated fields according to the chosen `Object Type`.

#### Output Metadata

Result object from upsert.
Result object from an upsert.

### Delete Object

Lookup a single object by a selected field that uniquely identifies it.
Lookup a single object by a selected field that uniquely identifies it and delete it

#### Configuration Fields

* **Object Type** - (string, required): Object-type to delete. E.g `Users`.
* **Object Type** - (string, required): Object-type to delete. Currently, supported types are:
* Products
* Users
* **Lookup Criteria** - (dropdown, required): A list of object parameters that can uniquely identify the object in the database.

#### Input Metadata
Expand All @@ -88,82 +94,97 @@ Lookup a single object by a selected field that uniquely identifies it.

#### Output Metadata

Object with result of deletion as value.
Object with the result of deletion as value.

### Lookup Objects (plural)

Lookup a set of object by defined criteria list. Can be emitted in different way.
Lookup a set of objects by defined criteria.

#### Configuration Fields

* **Object Type** - (dropdown, required): Object-type to lookup on. E.g `Users`.
* **Emit Behavior** - (dropdown, required): Defines the way result objects will be emitted, one of `Emit all`, `Emit page` or `Emit individually`.
* **Number of search terms** - text field to specify a number of search terms (positive integer number [1-99] or 0).
* **Object Type** - (dropdown, required): Object-type to lookup on. Currently, supported types are:
* Products
* Users
* **Emit Behavior** - (dropdown, required): Defines the way resulting objects will be emitted, one of `Emit all`, `Emit page` or `Emit individually`.
* **Number of search terms** - (number, optional): Specify a number of search terms (positive integer number [1-99] or 0).

#### Input Metadata

* **Search Criteria** - (array of strings, required): Search terms to be combined with the AND operator, E.g: `["userAge>29", "userName=Alex"]`
Depending on the configuration field `Number of search terms`.
* If `Number of search terms` is empty or equals `0`, additional fields will not be generated.
* If `Number of search terms = 1`, one search term will be added to the metadata.
* If `Number of search terms > 1`, the number of search terms equals to `Number of search terms` and the number of criteria links equals to `Number of search terms - 1`

If selected `Emit Behavior` is `Emit page` additionally fields will be added:
* **Page Number** - (number, defaults to X): Indicates index of page to be fetched.
* **Page Size** - (number, defaults to X): Indicates amount of objects per page. Value from 0 to X
Each search term has 3 fields:
* **Field name** - Chosen object field name.
* **Condition** - Condition to apply on selected field
* **Field value** - Value for the selected field

links between conditions have one of the following values: `AND`, `OR` to combine several search terms

#### Output Metadata

For `Emit All` mode: An object, with key `results` that has an array as its value.
For `Emit Page` mode: An object with key `results` that has an array as its value (if `Page Size` > 0). Key `totalCountOfMatchingResults` which contains the total number of results (not just on the page) which match the search criteria (if `Page Size` = 0).
For `Emit Individually` mode: Each object which fill the entire message.
* For `Emit All` and `Emit Page` mode: An object, with key `results` that has an array as its value.
* For `Emit Individually` mode: Each object which fill the entire message.

### Lookup Object (at most one)

Lookup a single object by a selected field that uniquely identifies it.

#### Configuration Fields

* **Object Type** - (string, required): Object-type to lookup on. E.g `Users`.
* **Lookup Criteria** - (dropdown, required): A list of object parameters that can uniquely identify the object in the database.
* **Allow criteria to be omitted** - (boolean, optional): If selected field `Lookup Criteria Value` becomes optional.
* **Allow zero results** - (boolean, optional): When selected, if the object is not found - an empty object will be returned instead of throwing error.
* **Object Type** - (dropdown, required): Object-type to upsert. Currently, supported types are:
* Products
* Users
* **Lookup Criteria** - (dropdown, required): A unique field by which you want to lookup the object. Currently, supported types are:
* ID - for all object types
* Title - for `Products` only
* **Allow criteria to be omitted** - (boolean, optional): If selected, the field Lookup Criteria Value becomes optional.
* **Allow zero results** - (boolean, optional): When selected, if the object is not found - an empty object will be returned instead of throwing an error.

#### Input Metadata

* **Lookup Criteria Value** - (string, required unless `Allow criteria to be omitted` is selected): Value for unique search criteria in `Lookup Criteria` configuration field.

#### Output Metadata

Object with result of lookup as value.
Result object depending on the object selected and the configuration setting `Allow Zero Result`.

### Lookup Object By ID

Lookup a single object by its ID.

#### Configuration Fields

* **Object Type** - (string, required): Object-type to lookup on. E.g `Users`.
* **Object Type** - (string, required): Object-type to lookup on. Currently, supported types are:
* Products
* Users

#### Input Metadata

* **ID Value** - (string, required): Value for ID of the object to lookup.

#### Output Metadata

Object with result of lookup as value.
Object with the result of lookup as value.

### Delete Object By ID

Delete a single object by its ID.

#### Configuration Fields

* **Object Type** - (string, required): Object-type to lookup on. E.g `Users`.
* **Object Type** - (string, required): Object-type to lookup on. Currently, supported types are:
* Products
* Users

#### Input Metadata

* **ID Value** - (string, required): Value for ID of the object to delete.

#### Output Metadata

Object with result of delete.
Object with the result of delete.

## Triggers

Expand All @@ -173,15 +194,21 @@ Retrieve all the updated or created objects within a given time range.

#### Configuration Fields

* **Object Type** - (string, required): Object-type to lookup on. E.g `Users`.
* **Start Time** - (string, optional): The timestamp, in ISO8601 format, to start polling from (inclusive). Default value is the beginning of time (January 1, 1970 at 00:00.000).
* **End Time** - (string, optional): The timestamp, in ISO8601 format, to end at (inclusive). Default value is never.
* **Object Type** - (string, required): Object-type to lookup on. Currently, supported types are:
* Products
* Users
* **Start Time** - (string, optional): The timestamp to start polling from (inclusive) - using ISO 8601 Date time utc format - YYYY-MM-DDThh:mm:ssZ. The default value is the beginning of time (January 1, 1970 at 00:00).
* **End Time** - (string, optional): The timestamp to stop polling (exclusive) - using ISO 8601 Date time utc format - YYYY-MM-DDThh:mm:ssZ. The default value is flow execution time.
* **Timestamp field to poll on** - (string, optional): Can be either Last Modified or Created dates (updated or new objects, respectively). Defaults to Last Modified.

#### Input/Output Metadata
#### Input Metadata

None.

#### Output Metadata
- For `Fetch page`: An object with key ***results*** that has an array as its value
- For `Emit Individually`: Each object fills the entire message

#### Limitations

Pagination has not been implemented yet in this trigger. Running a flow will return a single page with all of the results of the query.
None
Loading