@hydra-cg/heracles.ts > ProcessingState
Maintains a JSON-LD processing context.
class:
ProcessingState
⊕ new ProcessingState(graphToProcess: object[], baseUrl: string, client: IHydraClient, linksPolicy: LinksPolicy): ProcessingState
⊕ new ProcessingState(objectToProcess: object, ownerIri: string, parentIri: string, parentState: ProcessingState): ProcessingState
Defined in JsonLd/ProcessingState.ts:90
Initializes a new instance of the ProcessingState class.
Parameters:
| Name | Type | Description |
|---|---|---|
| graphToProcess | object[] |
Actual graph to process. |
| baseUrl | string |
Base URL. |
| client | IHydraClient | Hydra client instance. |
| linksPolicy | LinksPolicy | Policy defining what is considered a link. |
Returns: ProcessingState
Defined in JsonLd/ProcessingState.ts:99
Initializes a new instance of the ProcessingState class.
Parameters:
| Name | Type | Description |
|---|---|---|
| objectToProcess | object |
Actual object to process. |
| ownerIri | string |
Object to process owning resource’s IRI. |
| parentIri | string |
Object to process parent resource’s IRI. |
| parentState | ProcessingState | Parent processing state to obtain more details from. |
Returns: ProcessingState
<Private> allHypermedia● allHypermedia: IResource[]
Defined in JsonLd/ProcessingState.ts:86
● baseUrl: string
Defined in JsonLd/ProcessingState.ts:61
Gets the base URL to use for relative ones.
readonly:
returns:
<Private> client● client: IHydraClient
Defined in JsonLd/ProcessingState.ts:87
● currentResource: IResource = null
Defined in JsonLd/ProcessingState.ts:82
Gets the processed object’s resource. This is provided once the {@link ProcessingState.provideResource(boolean) is called.
type: {IResource = null}
<Private> finalHypermedia● finalHypermedia: IResource[] = null
Defined in JsonLd/ProcessingState.ts:15
<Private> forbiddenHypermedia● forbiddenHypermedia: IDictionary<boolean>
Defined in JsonLd/ProcessingState.ts:85
<Private> foundResources● foundResources: IDictionary<any>
Defined in JsonLd/ProcessingState.ts:88
● linksPolicy: LinksPolicy
Defined in JsonLd/ProcessingState.ts:75
Gets the current links policy.
readonly:
returns:
<Private> notifications● notifications: IDictionary<Notification[]>
Defined in JsonLd/ProcessingState.ts:90
● ownerIri: string
Defined in JsonLd/ProcessingState.ts:47
Gets the processed object’s owning resource’s IRI. This owning resource may not be a direct parent.
readonly:
returns:
● parentIri: string
Defined in JsonLd/ProcessingState.ts:54
Gets the processed object’s parent resource’s IRI.
readonly:
returns:
<Private> payload● payload: object[]
Defined in JsonLd/ProcessingState.ts:89
● processedObject: object
Defined in JsonLd/ProcessingState.ts:22
Gets the currently processed object.
readonly:
returns:
<Private> resourceMap● resourceMap: IDictionary<IResource>
Defined in JsonLd/ProcessingState.ts:84
● rootUrl: string
Defined in JsonLd/ProcessingState.ts:68
Gets the protocol, host and port of the baseUrl;
readonly:
returns:
get hypermedia(): IResource[]
Defined in JsonLd/ProcessingState.ts:29
Gets all hypermedia discovered.
readonly:
Returns: IResource[]
▸ copyFor(objectToProcess: object): ProcessingState
Defined in JsonLd/ProcessingState.ts:195
Creates a child processing context.
Parameters:
| Name | Type | Description |
|---|---|---|
| objectToProcess | object |
Nested object to be processed. |
Returns: ProcessingState
<Private> createResource▸ createResource(iri: string, types: string[]): IResource
Defined in JsonLd/ProcessingState.ts:267
Parameters:
| Name | Type |
|---|---|
| iri | string |
| types | string[] |
Returns: IResource
▸ findRawResource(iri: string): any
Defined in JsonLd/ProcessingState.ts:172
Searches an original response payload for a resource of a given Iri.
Parameters:
| Name | Type | Description |
|---|---|---|
| iri | string |
Resource’s Iri to search for. |
Returns: any
▸ getVisitedResource(iri: string): any
Defined in JsonLd/ProcessingState.ts:186
Gets a visited resource.
Parameters:
| Name | Type | Description |
|---|---|---|
| iri | string |
Iri of the resource to be obtained. |
Returns: any
▸ markAsOwned(iri: string): void
Defined in JsonLd/ProcessingState.ts:154
Marks as owned hypermedia, this the given iri won’t be available as a standalone hypermedia control.
Parameters:
| Name | Type | Description |
|---|---|---|
| iri | string |
Iri to be marked. |
Returns: void
▸ notifyMaterialized(iri: string, notification: Notification): void
Defined in JsonLd/ProcessingState.ts:244
Registers a handler to be invoked once the resource of a given Iri is materialized.
Parameters:
| Name | Type | Description |
|---|---|---|
| iri | string |
Iri of the resource that must be materialized for notification. |
| notification | Notification | Delegate used for invocation. |
Returns: void
▸ onMaterialized(resource: IResource): void
Defined in JsonLd/ProcessingState.ts:257
Raises notifications about resource materialized.
Parameters:
| Name | Type | Description |
|---|---|---|
| resource | IResource | Resource that was just materialized. |
Returns: void
▸ provideResource(addToHypermedia?: boolean): IResource
Defined in JsonLd/ProcessingState.ts:223
Creates a resource representation of the object being processed.
Parameters:
| Name | Type | Default value | Description |
|---|---|---|---|
Default value addToHypermedia |
boolean |
true | Value indicating whether to add this resource to the ProcessingState.hypermedia collection. |
Returns: IResource