Describes an Atomic Resource, which has a Subject URL and a bunch of Property / Value combinations.

Type Parameters

Hierarchy

  • Resource

Constructors

  • Type Parameters

    Parameters

    • subject: string
    • Optional newResource: boolean

    Returns Resource<C>

Properties

__internalObject: Resource<C>
appliedCommitSignatures: Set<string>

Every commit that has been applied should be stored here, which prevents applying the same commit twice

commitBuilder: any
commitError?: Error

If the commit could not be saved, we put that info here.

equalsCurrentValue: any

Returns true if the value has not changed

error?: Error

If the resource could not be fetched, we put that info here.

hasQueue: any
inProgressCommit: any
isParentNew: any
loading: boolean

Is true when the Resource is currently being fetched, awaiting a response from the Server

new: boolean

Is true for locally created, unsaved resources

propvals: any
subject: any

Accessors

  • get title(): string
  • Returns string

Methods

  • Adds the given classes to the resource

    Parameters

    • store: Store
    • Rest ...classSubject: string[]

    Returns Promise<void>

  • Checks if the agent has write rights by traversing the graph. Recursive function.

    Parameters

    • store: Store
    • Optional agent: string
    • Optional child: string

    Returns Promise<[boolean, undefined | string]>

  • Creates a clone of the Resource, which makes sure the reference is different from the previous one. This can be useful when doing reference compares.

    Returns Resource<C>

  • Removes the resource form both the server and locally

    Parameters

    Returns Promise<void>

  • Checks if the content of two Resource instances is equal

    Parameters

    Returns boolean

  • Get a Value by its property, returns as Array or throws error. Returns empty array if there is no value

    Parameters

    • propUrl: string

    Returns JSONArray

  • Returns the subject of the list of Children

    Returns string

  • Returns a list of classes of this resource

    Returns string[]

  • Returns string

  • builds all versions using the Commits

    Parameters

    Returns Promise<Version[]>

  • Returns the internal Map of Property-Values

    Returns PropVals

  • Iterates over the parents of the resource, returns who has read / write rights for this resource

    Parameters

    Returns Promise<Right[]>

  • Returns the subject URL of the Resource

    Returns string

  • Returns the subject URL of the Resource

    Returns string

  • Get a Value by its property, returns as Array with subjects instead of the full resource or throws error. Returns empty array if there is no value

    Parameters

    • propUrl: string

    Returns string[]

  • Checks if the resource is all of the given classes

    Parameters

    • Rest ...classSubjects: string[]

    Returns boolean

  • Returns true if the resource has changes in it's commit builder that are not yet saved to the server.

    Returns boolean

  • Checks if the resource is both loaded and free from errors

    Returns boolean

  • Returns true is the resource had an Unauthorized 401 response.

    Returns boolean

  • Appends a Resource to a ResourceArray

    Parameters

    • propUrl: string
    • values: JSONArray
    • Optional unique: boolean

    Returns void

  • Remove the given classes from the resource

    Parameters

    • store: Store
    • Rest ...classSubjects: string[]

    Returns Promise<void>

  • Removes a property value combination from the resource and adds it to the next Commit

    Parameters

    • propertyUrl: string

    Returns void

  • Removes a property value combination from this resource, does not store the remove action in Commit

    Parameters

    • propertyUrl: string

    Returns void

  • Commits the changes and sends the Commit to the resource's /commit endpoint. Returns the Url of the created Commit. If you don't pass an Agent explicitly, the default Agent of the Store is used. When there are no changes no commit is made and the function returns Promise.

    Parameters

    Returns Promise<undefined | string>

  • Set a Property, Value combination and perform a validation. Will throw if property is not valid for the datatype. Will fetch the datatype if it's not available. Adds the property to the commitbuilder.

    When undefined is passed as value, the property is removed from the resource.

    Type Parameters

    Parameters

    • prop: Prop
    • value: Value
    • store: Store
    • Optional validate: boolean

      Disable validation if you don't need it. It might cause a fetch if the Property is not present when set is called

    Returns Promise<void>

  • Sets the error on the Resource. Does not Throw.

    Parameters

    • e: Error

    Returns void

  • Set the Subject / ID URL of the Resource. Does not update the Store.

    Parameters

    • subject: string

    Returns void

  • Set a Property, Value combination without performing validations or adding it to the CommitBuilder.

    Parameters

    Returns void

Generated using TypeDoc