{"id":20745410,"url":"https://github.com/elasticio/odata-component","last_synced_at":"2025-12-24T22:20:58.297Z","repository":{"id":14517952,"uuid":"43959009","full_name":"elasticio/odata-component","owner":"elasticio","description":"OData component for elastic.io iPaaS","archived":false,"fork":false,"pushed_at":"2023-04-06T14:56:01.000Z","size":2657,"stargazers_count":0,"open_issues_count":26,"forks_count":3,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-03-11T12:52:01.675Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elasticio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-10-09T14:03:06.000Z","updated_at":"2023-04-06T14:55:47.000Z","dependencies_parsed_at":"2025-03-11T12:48:27.798Z","dependency_job_id":"e7774685-117f-4dde-950f-8e52429eb236","html_url":"https://github.com/elasticio/odata-component","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/elasticio/odata-component","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elasticio%2Fodata-component","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elasticio%2Fodata-component/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elasticio%2Fodata-component/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elasticio%2Fodata-component/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elasticio","download_url":"https://codeload.github.com/elasticio/odata-component/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elasticio%2Fodata-component/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28010791,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-24T02:00:07.193Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T07:20:19.855Z","updated_at":"2025-12-24T22:20:58.254Z","avatar_url":"https://github.com/elasticio.png","language":"JavaScript","readme":"# OData Component\n[![NPM version][npm-image]][npm-url]\n[![Travis Build Status][travis-image]][travis-url]\n[![DependencyStatus][daviddm-image]][daviddm-url]\n\nOData with OAuth component for the [elastic.io platform](http://www.elastic.io).\n\nA component designed to work with generic APIs which implement the [OData v4\nspecification](http://www.odata.org).\n\n# Authentication\nSupports the following forms:\n* No Auth\n* Basic Auth\n* API key auth\n\n# Triggers\n## Get Objects Polling \nGet objects which have recently been modified or created.\n\nAll types of objects programmatically detectable are covered.  When selecting this trigger, the first input that must be configured is **Object type to fetch**.  This dropdown when opened will produce a list of all object types on the system.  \n\nThis trigger relies on the service implementing OData's delta links.  Not all services (e.g. TripPin and NAV/Business Center) support this.\n\n### Technical Notes\n* Time range options are not supported. \n* Standardized `isNew`,`createdOn` and `modifiedOn` not included in\noutput.\n* This trigger could not be tested directly but can the code path can be tested through dynamics CRM component\n* This trigger will throw an exception if no delta links are provided.\n* The schema of the snapshot stored by this trigger is \n```\n{\n  \"deltaLink\": \"string delta link\"\n}\n```\n* The first iteration will produce all the objects in the system.  Subsequent iterations will produce changes from the first iteration.\n* This trigger makes one API call per invocation\n* Does not produce metadata.\n\n# Actions\n## Lookup Object by Field\nGiven a field and a field value that matches exactly one record, find that matching record.\n\nThere are three configuration drop downs:\n* **Object Type to Lookup**: All types of objects programmatically detectable are covered.  This drop down when opened will produce a list of all object types on the system.\n* **Name of Field to Match**: Select a field to compare against.  Currently, this will return a list of all fields on the object selected in the `Object Type to Lookup` dropdown.  \n* **Allow Empty Criteria**: Should the lookup operation be skipped (i.e. this component becomes a No-op which emits the empty message) if all criteria are empty?\n\n### Technical Notes\n* All Objects Programmatically Detectable Covered. \n* Shows all fields, not just unique fields.  \n* In metadata is dynamic where based on \n  * The selected field, a type for the field is inferred\n  * Allow Empty Criteria, the required attribute for the field is inferred\n* OData has a complexity that in some values when placed in filters must be wrapped in quotes while others do not.  This action can query the OData metadata to learn which should be applied for this field.\n* The schema of the snapshot stored by this action is\n```\n{\n  \"version\": 1,   // Protect against schema revisions\n  \"fieldName\": \"Value selected from Name of Field to Match\",   // Protect against changing config values\n  \"objectType\": \"Value selected from Object Type to Lookup\",   // Protect against changing config value\n  \"operationType\": \"lookupObject\",    // Protect against changing action\n  \"wrapFieldInQuotes\": true/false   // Information learned from OData metadata document to correctly form request\n\n}\n```\n* PseudoCode:\n```\nIF empty field value AND allowEmptyCriteria THEN \n  emit empty object\nELSE  \n  CONST results = Fetch objects with value for field\n  IF results.length !== 1 THEN\n    Throw exception\n  emit result\n```\n* One API call per invocation\n\n## Upsert Object By ID\nUpdate an existing entry with the id provided.  Otherwise create a new entry.\n\nAll types of objects programmatically detectable are covered.  When selecting this trigger, the first input that must be configured is **Object type to fetch**.  This dropdown when opened will produce a list of all object types on the system. \n\n### Technical Notes\n* All Objects Programmatically Detectable Covered. \n* Adds an `isNew` flag to show update vs create\n* Metadata is dynamic. The object structure is learned from OData metadata.  The ID field(s) are flagged with `(Primary Key)`\n* OData has a complexity that in some values when placed PUT by ID calls must be wrapped in quotes while others do not.  This action can query the OData metadata to learn which should be applied for this field.\n* The schema of the snapshot stored by this action is\n```\n{\n  \"version\": 1,   // Protect against schema revisions\n  \"objectType\": \"Value selected from Object Type to Lookup\",   // Protect against changing config value\n  \"operationType\": \"upsert\",    // Protect against changing action\n  \"wrapFieldInQuotes\": true/false   // Information learned from OData metadata document to correctly form request\n\n}\n```\n* PseudoCode:\n```\nIF there is not a value for any key THEN\n  make POST request to create object\nELSE IF there is a value for every key THEN\n  make PATCH request to update object\nELSE\n  throw error\nEND    \n```\n* Limitation: [Does not work if the system can create objects based on an external key](https://github.com/elasticio/odata-component/issues/26)\n* TripPin does not work for updating/creating information.\n* One API call per invocation\n\n# Other Limitations\n* [Sometimes there are false positive when verifying credentials](https://github.com/elasticio/odata-component/issues/25)\n* [List of selectable object types for an action/trigger don't reflect that some object types are readonly or not modifiable/deletable](https://github.com/elasticio/odata-component/issues/20)\n* [Metadata does not expose the ids of linked objects as fields](https://github.com/elasticio/odata-component/issues/19)\n* Not successfully tested on local agent\n\n# Configuration Info\n## Required environment variables\nNo environment variables are required for deployment.\n\n## Version and compatibility information\nThis component interacts with OData version 4.  It has been\ntested with the [OData TripPin Reference Service](http://www.odata.org/odata-services/).\n\n[npm-image]: https://badge.fury.io/js/odata-component.svg\n[npm-url]: https://npmjs.org/package/odata-component\n[travis-image]: https://travis-ci.org/elasticio/odata-component.svg?branch=master\n[travis-url]: https://travis-ci.org/elasticio/odata-component\n[daviddm-image]: https://david-dm.org/elasticio/odata-component.svg?theme=shields.io\n[daviddm-url]: https://david-dm.org/elasticio/odata-component\n\n# Development Information\n## OData TripPin Sample Service\nThe OData consortium has created a sample OData service called TripPin.  The\nintegration tests for this repo are designed to run against this service.  This\nservice has numerous bugs and some of the checks that would normally be tested\nhas to be reduced in these unit tests.\n\nResources\n* [TripPin Intro](http://www.odata.org/blog/trippin-new-odata-v4-sample-service/)\n* [TripPin Sample Calls](http://www.odata.org/odata-services/)\n* [Request A Key To Identify Yourself to Trippin](http://www.odata.org/odata-services/service-usages/request-key-tutorial/)\n\n## NAV/Business Central\nInstructions are in [`documentation/NAV - Business Central Instructions`](documentation/NAV%20-%20Business%20Central%20Instructions.md).\n\n## Running Integration Tests\nFor the local testing (e.g. spec-integration) the following environment variables are required:\n* `TRIPPIN_RESOURCE_SERVER_URL` - Obtain a sample TripPin key and place the provided URL with key into this variable\n* `TRIPPIN_CONTACT_TO_LOOKUP_FIRST_NAME` - Sample contact name to lookup\n* `TRIPPIN_CONTACT_TO_LOOKUP_ID` - Sample contact id to lookup\n\n\nThis segment of tests are designed to run against Microsoft NAV/Business Central.  In theory they should work on any OData system that uses HTTP Basic auth for authentication and has an object with one key and one modifiable string field:\n* `BC_RESOURCE_SERVER_URL` - Url to the root of the OData service on your instance\n* `BC_USERNAME=\"NAVADMIN\"` - Username for authentication\n* `BC_WEB_SERVICE_ACCESS_KEY` - Password for authentication\n* `BC_TO_LOOKUP_FIELD_NAME` - Name of modifiable string field\n* `BC_PRIMARY_KEY` - Primary Key of the object\n* `BC_TO_LOOKUP_FIELD_VALUE` - Sample value of string field that should match exactly one result\n* `BC_TO_LOOKUP_ID` - ID value of the object with field value of `BC_TO_LOOKUP_FIELD_VALUE`\n* `BC_OBJECT_TYPE` - Object type to test\n\nThese environment variables must be placed in a [`.env`\nfile](https://www.npmjs.com/package/dotenv).  The integration tests can be run\nthrough npm with the cli command `npm run integration-test` or by the mocha test\nrunning capabilities of your IDE.  The integration tests are located in `spec-integration`.\n\n### Example .env file\n*(Replace `\u003cIncludeYourValueHere\u003e` with a value specific for your system)*\n```\nTRIPPIN_RESOURCE_SERVER_URL=\"http://services.odata.org/TripPinRESTierService/\u003cIncludeYourValueHere\u003e/\"\nTRIPPIN_CONTACT_TO_LOOKUP_FIRST_NAME=Russell\nTRIPPIN_CONTACT_TO_LOOKUP_ID=russellwhyte\n\nBC_RESOURCE_SERVER_URL=\"https://\u003cIncludeYourValueHere\u003e:7048/nav/odatav4\"\nBC_USERNAME=\"NAVADMIN\"\nBC_WEB_SERVICE_ACCESS_KEY=\"\u003cIncludeYourValueHere\u003e\"\nBC_TO_LOOKUP_FIELD_NAME=\"Name\"\nBC_PRIMARY_KEY=\"No\"\nBC_TO_LOOKUP_FIELD_VALUE=\"UniqueValue\"\nBC_TO_LOOKUP_ID=\"12\"\nBC_OBJECT_TYPE=\"CustomerCardService\"\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felasticio%2Fodata-component","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felasticio%2Fodata-component","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felasticio%2Fodata-component/lists"}