furo-entity-agent

furo-entity-agent #

@furo/data v2.18.0
import '@furo/data/src/furo-entity-agent.js';
exports FuroEntityAgent js
exports <furo-entity-agent> custom-element-definition
superclass LitElement
mixes FBP

summary interface component to handle entity requests

furo-entity-agent is an interface component to handle entity requests.

Note When you trigger the save method and there is a HTS wich allows to PATCH the record, only the deltas (changes) of the values are sent.

Hint PUT will send all fields which are not marked as readonly. If you want to send all data on PUT (without filtering readonly fields) set Env.api.sendAllDataOnMethodPut = true;

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
<!-- The furo-entity-agent will fetch the data from ProjectService and pass it in at-response to the furo-data-object.  -->
<furo-entity-agent
  service="ProjectService"
  fn-hts-in="--hts" at-response="--response"
  ></furo-entity-agent>


<!-- The furo-data-object will send a initial dataObject of type project.Project on at-response-ready -->
<furo-data-object
  type="project.ProjectEntity"
  fn-inject-raw="--response"
  ></furo-data-object>

Attributes and Properties #

service #

service String

Setze den Service

loadOnHtsIn #

load-on-hts-in Boolean

triggers a load when link rel=“self” is in the injected hts (after hts-injected is fired)

appendUpdateMaskQP #

with-update-mask Boolean

Creates the query param update mask according to the google api design guidelines.

Your update service must have a query param update_mask to use this feature.

https://cloud.google.com/apis/design/standard_methods#update

You may not need it if your server can handle PATCHes without a update_mask https://grpc-ecosystem.github.io/grpc-gateway/docs/patch.html

Events #

response-hts-updated #

at-response-hts-updatedhts

Fired when hts was updated from the response.

load-success #

at-load-successresponse

Fired when load() was successful.

load-failed #

at-load-failedresponse

Fired when load() was not successful.

delete-success #

at-delete-successresponse

Fired when delete() was successful.

delete-failed #

at-delete-failedresponse

Fired when delete() was not successful.

save-success #

at-save-successresponse

Fired when save() was successful.

save-failed #

at-save-failedresponse

Fired when save() was not successful.

put-success #

at-put-successresponse

Fired when update() was successful.

put-failed #

at-put-failedresponse

Fired when update() was not successful.

create-success #

at-create-successresponse

Fired when create() was successful.

create-failed #

at-create-failedresponse

Fired when create() was not successful.

hts-updated #

at-hts-updated{Array|HATEOAS}

Fired when hateoas is updated from response.

hts-injected #

at-hts-injectedHateoas links

Fired when hateoas is updated.

request-aborted #

at-request-abortedRequest

Fired when a request was canceled.

request-started #

at-request-startedRequest

Fired when a request is sent.

response-raw #

at-response-rawObject

Fired when a response is received.

response-error #

at-response-errorObject

Fired when an error has occoured. This is a general error event. The specific error events are fired additionally.

response-error-[status-code] #

at-response-error-[status-code]Object

Fired when an error has occoured. This is a specific error event.

fatal-error #

at-fatal-errorRequest

Requests are made via the Fetch API if possible.Fallback XMLHttpRequest

response-error-4xx #

at-response-error-4xxObject

Fired when an error has occoured. This is a group error event. E.g. response-error-5xx, response-error-4xx

response-error-5xx #

at-response-error-5xxObject

Fired when an error has occoured. This is a group error event. E.g. response-error-5xx, response-error-4xx

response-error-raw #

at-response-error-rawObject

Fired when a error has occoured.

response #

at-responseObject

Fired when a response is received.

Methods #

updateQp #

updateQp(qp `` key Object ) ⟹ void

`` Object fn-update-qp

Update query params a qp like {“active”:true} will just update the qp active

If the current value of the qp is not the same like the injected value, a qp-changed event will be fired

  • qp
  • key value pairs

bindRequestData #

bindRequestData(dataObject `` ) ⟹ void

`` fn-bind-request-data

Binds a furo-data-object type. Use this if you want save data.

  • dataObject

clearQp #

clearQp() ⟹ void

*fn-clear-qp

clear the query params that you have setted before



load #

load() ⟹ void

*fn-load

loads the entity if hts is available



delete #

delete() ⟹ void

*fn-delete

delete the entity if hts is available



save #

save() ⟹ void

*fn-save

loads the entity if hts is available



put #

put() ⟹ void

*fn-put

saves the entity with method put if hts is available



create #

create() ⟹ void

*fn-create

creating the entity if hts rel=“create” is available



htsIn #

htsIn(hts `` ) ⟹ void

`` fn-hts-in

  • hts

abortPendingRequest #

abortPendingRequest() ⟹ void

*fn-abort-pending-request

Aborts a pending request