diff --git a/docs/assets/search.js b/docs/assets/search.js index 1fce51e..b56da4f 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAACrWb23LjuBGG30W+1WqMIy3fZWdqayep7CSVqdy4XFO0BI+5I4kKSY3juPzuAXgQu6luiRTlKxctNPpHf40GSIKvkyx9zie3d6+TH8lmObmV08kmXrvJ7cRfuv9OppNdtvJX63S5W7n8Q/nf2VOxXvmfFqs4z503n0zepoc95Nniw8d0tXKLIkk3B135n7+1Px/tU8ibfa9Ej7VNt8ejnU8n2zhzm+JQZ+vWiHYwi3STF9luUaTZQL9X2LSPhhkpR17rNgyPSZYXQ5U0RhfS4HsZLKG2uZCCLN4s0/VQDXurC6lYpLvN4EA0RhfSsNsk/9m5oSL2VhdSsXQrVwxWsbcaoQJVnU9xET/EuSNrTvNj74pz0Bsc1r63I912xrLvD7i7lroN4sO/XFEkm+/5AI9XyKp1XuTLX5L8l22W/IzLGJNSZoQma4yye1HfvhUv2yEhAIJme+PTQWk7AQNiAvWUMvWnr6JZ3cN5spphMep2uaOXit7q6h7eRd3W9/mcZstxCkEv76JyOXzqESpBL5dSiape7oov21CQBk1YZDVA15kbFEZF383JMRkIme9wc2R/xstorS5RvToLdNn7GYLOjgleFpP8DAnI6gIq/EqfvQwR0Bic6Rstyb+71RbUQ7ggVz/1Xo47PcFx1D2xHXbU1z0x4fqfy9J/xHSBPHR01TY/5XB23K+vVu5rsna/pdk6phOGcH9gNVzFkGpCKOhbSdggoHz5e+p3hWS6lL/0zhbcDxxC1Q/XW0d01Q17L7ah06Tr4qpuecLP7KS3L9lvcdJvWFeo/SjPu23Isi/Zx8zFzC7/wPuBzSgFS+dTLKWL2IHrtvEon3zZPPB4umD28BeveoKtGo7ytXHPn/2sjTeLnjixwVDfQyrMgeu+9YV2jfYofq1a9Rxw05TYk6SFX5rd8gz/fj+zjrOXv7meeYXaX1TJD/fylbuvO5DRNr6ohsdkte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XFPujP2CcYGYazq465wacwdTnpkvzpg0EB8zpiBumX8PT5ks5kEQgQoLLvnBMdtkckwVZBDJXc+UuvJ6gd5xwB3PEmNz9gOAKLn+DMVHY4Ub3mOjDEgNyUHKVM1iyqQ/oWm55PljAFFhUFOe2SP/McXQNCK/hwNZHAkECgkXIcNHZH5QC3oBIy9FsvpNvzYA3TmJzNBNoBBwMF8bKzG9b6i9mQDxB7ihuslQfDYOEA+gEV/Lqt85gXoIFJeKiWVotmpM0IKQgOJYrIKVxgje6IDzRUbvOGm/BGCOuyFaGO3zHawH9iItO+LRvG+OtLrCTpEd/275Ntm6VbHyju/u3t/8DN0JryWxFAAA="; \ No newline at end of file +window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAACr2c23LbyBGG34W+pWnNEZDusnZtxUllN6l15calckHkyEJMEgoA2nFUfvfMgADRDXaTA4LOFU1zuvuf/hpzAAZ6mZXFt2p29/Fl9iXfrmZ3cj7bZhs3u5v5r+4/s/lsV679t02x2q1d9ab538VTvVn7n5brrKqcN5/NfsyPPVTl8s3bYr12yzovtkeu/M+f+p9P+hQyPXglPLY2Q48nnc9nz1nptvWxzj6sEX1nlsW2qsvdsi7KkXFfYdMYDQtSjrzRfRoe87KqxyrpjK6kwXsZLaG1uZKCMtuuis1YDQerK6lYFrvt6ER0RlfSsNvm/965sSIOVldSsXJrV49WcbCaoAKNOu+yOnvIKkeOOd2P0SPOkTfYrYO3E24HfTn4A+FupO6T+PCHq+t8+7kaEfEVsuqD19XqdV69fi7zr1mTY1LKgtBkjVH2IOrTp/r785gUAEGLg/H5pPROQIeYRD0VzPgTq2jRerhMVtctRt2ucvRUEa2u9fBT1D17n9+KcjVNIfDyU1Suxl96hErg5Voq0ahXufr35zAgjbpgkdUIXRcuUBgVsYuTUzIQMu9we2J9xsvora4xeg0m6Mb7BYIuzgmeFvPqAgnI6goq/Exffh8joDO4MDaakv/s1s9gPIQT8v6n6Ol44An2o/XEOhyobz0x6fqvK4u/Z/QAeRzoVd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cD6gZkhTV/qA4v1wEFoGIEx7B7mN6bAYJt7iwH8nCEGRAA3fabCMauvz0OSg70NGF7Cl46AUkCV6XketqfzARqAVzNG4ZT8SAaKFTFpSYYFeVjc6wdmILkKj5e8xo0GDSASM4mHE44ZmnABWG5eM1dQFDvoGxSbojzNqv9GSUgEwA0J4J9cdgMpNNwQ5Q36w8yAluQGsOh8Lb1ELwG4A3Xyaf2VR7AD+RTsmYFxieASMEBxKd1QYWC7GjFGjd/DKG3AtcDN87laKwwFhQK17G8OmYO7Azbt2pboIwYkH3LIfdlMlwMKBBNc7jXGU4/rErGpH1oDzgDgaqbi7iAW/ctP7x0AMTCyYgbz5qnAQ8opQkYQVMupa3dsn38DEZREDXhrYlLCYTVnNz+hVpQ3gCK4GC2rwgMLn0F2GiuUNu3VgAcoFS207zi0DbWD935FpAncInYW8a4+0sMwAxYcUbdCTxQgkCxYYO1J5SZhSMYlTXvoj0qBkKDwcdy48f+XCQIBqYpw9VC92QWJAdkJ+E0+pVK0b1XDIoIXHCCW/SFlwpW3UsFoIqAWs2VfHicRa+r4TrthDG5xgNFJLj6DcbETAKX86dEH49NIMuSzbK35ErfgHxZLtdHM6YChaS4sHXxrwpn14BL3HL9bI+QAiuQHcsl9nCwDtiB2dJyhdv9VZHeDFhx+eiO8oJYAL45beYXZ+37hSCfwFxxF+b+TyyAggPZFNyQ155SANcluLhSLpuN1bI7eQWMAYqE09kY5wh8AvqXnrQbLA4sKM+UW0buDXd4X28hR+5aDi9CP2d4QQ9KW5LD+v189pw/u3W+9Y0+3v/48T/dQoB6mkoAAA=="; \ No newline at end of file diff --git a/docs/classes/src_Collection.Collection.html b/docs/classes/src_Collection.Collection.html index 7390171..1a89da4 100644 --- a/docs/classes/src_Collection.Collection.html +++ b/docs/classes/src_Collection.Collection.html @@ -1,6 +1,6 @@ Collection | nodequent

A collection class that extends the Array class. Mostly for convenience.

-

Hierarchy

  • Array
    • Collection

Constructors

Hierarchy

  • Array
    • Collection

Constructors

Properties

Constructors

Properties

[unscopables]: {
    [unscopables]?: boolean;
    length?: boolean;
    [iterator]?: any;
    at?: any;
    concat?: any;
    copyWithin?: any;
    entries?: any;
    every?: any;
    fill?: any;
    filter?: any;
    find?: any;
    findIndex?: any;
    flat?: any;
    flatMap?: any;
    forEach?: any;
    includes?: any;
    indexOf?: any;
    join?: any;
    keys?: any;
    lastIndexOf?: any;
    map?: any;
    pop?: any;
    push?: any;
    reduce?: any;
    reduceRight?: any;
    reverse?: any;
    shift?: any;
    slice?: any;
    some?: any;
    sort?: any;
    splice?: any;
    toLocaleString?: any;
    toString?: any;
    unshift?: any;
    values?: any;
}

Is an object whose properties have the value 'true' +

Constructors

Properties

[unscopables]: {
    [unscopables]?: boolean;
    length?: boolean;
    [iterator]?: any;
    at?: any;
    concat?: any;
    copyWithin?: any;
    entries?: any;
    every?: any;
    fill?: any;
    filter?: any;
    find?: any;
    findIndex?: any;
    flat?: any;
    flatMap?: any;
    forEach?: any;
    includes?: any;
    indexOf?: any;
    join?: any;
    keys?: any;
    lastIndexOf?: any;
    map?: any;
    pop?: any;
    push?: any;
    reduce?: any;
    reduceRight?: any;
    reverse?: any;
    shift?: any;
    slice?: any;
    some?: any;
    sort?: any;
    splice?: any;
    toLocaleString?: any;
    toString?: any;
    unshift?: any;
    values?: any;
}

Is an object whose properties have the value 'true' when they will be absent when used in a 'with' statement.

Type declaration

  • Optional Readonly [unscopables]?: boolean

    Is an object whose properties have the value 'true' when they will be absent when used in a 'with' statement.

    @@ -71,9 +71,9 @@
  • Optional end: number

    If not specified, length of the this object is used as its default value.

Returns this

  • Return the number of items in the collection. To stay in the Laravel spirit.

    Returns number

    The length of the collection

    -
  • Delete all models in the collection.

    Returns void

    void

    -
  • Returns an iterable of key, value pairs for every entry in the array

    +
  • Returns an iterable of key, value pairs for every entry in the array

    Returns IterableIterator<[number, any]>

  • Determines whether all the members of an array satisfy the specified test.

    Type Parameters

    • S extends any

    Parameters

    • predicate: ((value, index, array) => value is S)

      A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value @@ -115,7 +115,7 @@

    Returns number

  • Get the first (x) item(s) from the collection.

    Parameters

    • Optional amount: number

      The amount of items to get. Optional.

    Returns any

    any

    -
  • Returns a new array with all sub-array elements concatenated into it recursively up to the +

  • Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

    Type Parameters

    • A
    • D extends number = 1

    Parameters

    • this: A
    • Optional depth: D

      The maximum recursion depth

    Returns FlatArray<A, D>[]

  • Calls a defined callback function on each element of an array. Then, flattens the result into @@ -140,7 +140,7 @@

    Returns IterableIterator<number>

  • Get the last (x) item(s) from the collection.

    Parameters

    • Optional amount: number

      The amount of items to get. Optional.

    Returns any

    any

    -
  • Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present.

    +
  • Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present.

    Parameters

    • searchElement: any

      The value to locate in the array.

    • Optional fromIndex: number

      The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array.

    Returns number

  • Calls a defined callback function on each element of an array, and returns an array that contains the results.

    @@ -152,7 +152,7 @@

    Parameters

    • Rest ...items: any[]

      New elements to add to the array.

    Returns number

  • Get a pseudo-random item from the collection.

    Returns any

    any

    -
  • Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

    +
  • Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

    Parameters

    • callbackfn: ((previousValue, currentValue, currentIndex, array) => any)

      A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

        • (previousValue, currentValue, currentIndex, array): any
        • Parameters

          • previousValue: any
          • currentValue: any
          • currentIndex: number
          • array: any[]

          Returns any

    Returns any

  • Parameters

    • callbackfn: ((previousValue, currentValue, currentIndex, array) => any)
        • (previousValue, currentValue, currentIndex, array): any
        • Parameters

          • previousValue: any
          • currentValue: any
          • currentIndex: number
          • array: any[]

          Returns any

    • initialValue: any

    Returns any

  • Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

    Type Parameters

    • U

    Parameters

    • callbackfn: ((previousValue, currentValue, currentIndex, array) => U)

      A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

      @@ -199,7 +199,7 @@

      Returns string

  • Returns a string representation of an array.

    Returns string

  • Inserts new elements at the start of an array, and returns the new length of the array.

    +
  • Inserts new elements at the start of an array, and returns the new length of the array.

    Parameters

    • Rest ...items: any[]

      Elements to insert at the start of the array.

    Returns number

  • Returns an iterable of values in the array

    Returns IterableIterator<any>

  • Creates an array from an array-like object.

    diff --git a/docs/classes/src_Database.Database.html b/docs/classes/src_Database.Database.html index 21b2482..eef412b 100644 --- a/docs/classes/src_Database.Database.html +++ b/docs/classes/src_Database.Database.html @@ -1,5 +1,5 @@ Database | nodequent

    Database class to handle database connections and interactions.

    -

    Constructors

    Constructors

    Properties

    Methods

    connect @@ -9,9 +9,9 @@

    Constructors

    • Create a new instance of the Database class.

      Parameters

      • Optional options: any

        The options to use for the database connection.

      Returns Database

      void

      -

    Properties

    connection: any = null
    dbSettings: {
        database: string;
        host: string;
        password: string;
        user: string;
    }

    Type declaration

    • database: string
    • host: string
    • password: string
    • user: string

    Methods

    Properties

    connection: any = null
    dbSettings: {
        database: string;
        host: string;
        password: string;
        user: string;
    }

    Type declaration

    • database: string
    • host: string
    • password: string
    • user: string

    Methods

    • Disconnect from the database.

      Returns void

      void

      -
    • Parameters

      • sql: string

      Returns Promise<unknown>

    • Set the default database options. Mainly for the init function.

      -

      Parameters

      • options: {
            database: string;
            host: string;
            password: string;
            user: string;
        }
        • database: string
        • host: string
        • password: string
        • user: string

      Returns void

    \ No newline at end of file +
  • Parameters

    • sql: string

    Returns Promise<unknown>

  • Set the default database options. Mainly for the init function.

    +

    Parameters

    • options: {
          database: string;
          host: string;
          password: string;
          user: string;
      }
      • database: string
      • host: string
      • password: string
      • user: string

    Returns void

\ No newline at end of file diff --git a/docs/classes/src_Helper.Helper.html b/docs/classes/src_Helper.Helper.html index 80bf949..02fa595 100644 --- a/docs/classes/src_Helper.Helper.html +++ b/docs/classes/src_Helper.Helper.html @@ -1,4 +1,4 @@ -Helper | nodequent

Constructors

constructor +Helper | nodequent

Constructors

Methods

Constructors

Methods

  • Parameters

    • date: any

    Returns string

  • Parameters

    • num: number
    • places: number

    Returns string

\ No newline at end of file +

Constructors

Methods

  • Parameters

    • date: any

    Returns string

  • Parameters

    • num: number
    • places: number

    Returns string

\ No newline at end of file diff --git a/docs/classes/src_Model.Model.html b/docs/classes/src_Model.Model.html index 55504ca..628e0c2 100644 --- a/docs/classes/src_Model.Model.html +++ b/docs/classes/src_Model.Model.html @@ -1,18 +1,22 @@ Model | nodequent

Base class for all models.

-

Constructors

Constructors

Properties

attributes: {} = {}

Type declaration

    Var

    object The model's attributes.

    -
    fillable: string[] = []

    Var

    string[] The attributes that are mass assignable.

    -
    incrementing: boolean = true

    Var

    bool Indicates if the IDs are auto-incrementing.

    -
    keyType: string = 'int'

    Var

    string The type of the primary key.

    -
    primaryKey: string = 'id'

    Var

    string The primary key for the model.

    -
    softDeletes: boolean = false

    Var

    bool Whether or not soft deletes are enabled.

    -
    table: string

    Var

    string The table associated with the model.

    -

    Methods

    • Clear the model's attributes.

      -

      Returns void

    • Remove the model from the database

      +

    Constructors

    Properties

    attributes: {} = {}

    Type declaration

      Var

      object The model's attributes.

      +
      fillable: string[] = []

      Var

      string[] The attributes that are mass assignable.

      +
      incrementing: boolean = true

      Var

      bool Indicates if the IDs are auto-incrementing.

      +
      keyType: string = 'int'

      Var

      string The type of the primary key.

      +
      original: {} = {}

      Type declaration

        Var

        object The original attributes of the model.

        +

        Since

        1.0.5

        +
        primaryKey: string = 'id'

        Var

        string The primary key for the model.

        +
        softDeletes: boolean = false

        Var

        bool Whether or not soft deletes are enabled.

        +
        table: string

        Var

        string The table associated with the model.

        +

        Methods

        • Clear the model's attributes.

          +

          Returns void

        • Remove the model from the database

          Returns Promise<unknown>

          void

          -
        • Delete the model from the database, regardless of soft deletes.

          +
        • Delete the model from the database, regardless of soft deletes.

          Returns Promise<unknown>

          void

          -
        • Gets attributes that are different than the original attributes.

          +

          Returns {}

          object The model's dirty attributes

          +

            Since

            1.0.5

            +
          • Get the value of the primary key

            Returns any

            The primary key

            -
          • Get the original value of an attribute.

            +

            Parameters

            • key: string

              The attribute

              +

            Returns any

            The value of the attribute

            +

            Since

            1.0.5

            +
          • Get the table name

            Returns string

            The table name

            -
          • Check if the model is the same as another model.

            +
          • Check if the model is the same as another model.

            Parameters

            • model: Model

              The model to check against

            Returns boolean

            boolean

            -
          • Check if the model is not the same as another model.

            +
          • Check if the model, or a specific attribute, is dirty.

            +

            Parameters

            • Optional key: string

              The attribute to check

              +

            Returns boolean

            boolean

            +

            Since

            1.0.5

            +
          • Check if the model is not the same as another model.

            Parameters

            • model: Model

              The model to check against

            Returns boolean

            boolean

            -
          • Refresh the model from the database

            +
          • Refresh the model from the database

            Returns Promise<unknown>

            Model

            -
          • Register getters and setters for the model's attributes.

            +
          • Register getters and setters for the model's attributes.

            Parameters

            • attributes: any = {}

              The attributes to register.

              -

            Returns void

          • Restore a soft-deleted model. Only works if soft deletes are enabled.

            +

          Returns void

          \ No newline at end of file +
          \ No newline at end of file diff --git a/docs/classes/src_QueryBuilder.QueryBuilder.html b/docs/classes/src_QueryBuilder.QueryBuilder.html index cf80cbb..cf02e28 100644 --- a/docs/classes/src_QueryBuilder.QueryBuilder.html +++ b/docs/classes/src_QueryBuilder.QueryBuilder.html @@ -1,5 +1,5 @@ QueryBuilder | nodequent

          Builds SQL queries for models.

          -

          Constructors

          Constructors

          Properties

          Constructors

          Properties

          columns: string[] = []
          connection: any
          model: any
          orderByClause: {
              column: string;
              direction: string;
          } = ...

          Type declaration

          • column: string
          • direction: string
          whereClauses: {
              column: string;
              operator: string;
              value: any;
          }[] = []

          Type declaration

          • column: string
          • operator: string
          • value: any

          Methods

          • Parameters

            • column: string

              The column to order by

              +

          Constructors

          Properties

          columns: string[] = []
          connection: any
          model: any
          orderByClause: {
              column: string;
              direction: string;
          } = ...

          Type declaration

          • column: string
          • direction: string
          whereClauses: {
              column: string;
              operator: string;
              value: any;
          }[] = []

          Type declaration

          • column: string
          • operator: string
          • value: any

          Methods

          • Parameters

            • column: string

              The column to order by

            • direction: string = 'asc'

              The direction to order in

            Returns this

            QueryBuilder

            -
          • Select columns

            Parameters

            • Rest ...columns: string[]

              Columns to select.

            Returns this

            QueryBuilder

            -
          • Add a WHERE clause to the query.

            Parameters

            • column: string

              The column to check on

            • Optional operator: any

              The operator to use

            • Optional value: any

              The value to check against

            Returns this

            QueryBuilder

            -
          • Convenience method for where(column, 'IN', values)

            +
          • Convenience method for where(column, 'IN', values)

            Parameters

            • column: string

              The column to check on

            • values: any[]

              The values to check against

            Returns this

            QueryBuilder

            -
          • Convenience method for the inverse of where()

            Parameters

            • column: string

              The column to check on

            • value: any

              The value to check against

            Returns this

            QueryBuilder

            -
          • Where clause to check for null values

            Parameters

            • column: string

              The column to check on

            Returns this

            QueryBuilder

            -
          \ No newline at end of file +
          \ No newline at end of file diff --git a/docs/modules/index.html b/docs/modules/index.html index 0b3a77c..452f16f 100644 --- a/docs/modules/index.html +++ b/docs/modules/index.html @@ -1 +1 @@ -index | nodequent

          Module index

          \ No newline at end of file +index | nodequent

          Module index

          \ No newline at end of file diff --git a/docs/modules/src_Collection.html b/docs/modules/src_Collection.html index 306e7c2..3ea6846 100644 --- a/docs/modules/src_Collection.html +++ b/docs/modules/src_Collection.html @@ -1,2 +1,2 @@ -src/Collection | nodequent

          Module src/Collection

          Index

          Classes

          Collection +src/Collection | nodequent

          Module src/Collection

          Index

          Classes

          \ No newline at end of file diff --git a/docs/modules/src_Database.html b/docs/modules/src_Database.html index 2171b57..430a112 100644 --- a/docs/modules/src_Database.html +++ b/docs/modules/src_Database.html @@ -1,2 +1,2 @@ -src/Database | nodequent

          Module src/Database

          Index

          Classes

          Database +src/Database | nodequent

          Module src/Database

          Index

          Classes

          \ No newline at end of file diff --git a/docs/modules/src_Helper.html b/docs/modules/src_Helper.html index 61a5d65..d0ba037 100644 --- a/docs/modules/src_Helper.html +++ b/docs/modules/src_Helper.html @@ -1,2 +1,2 @@ -src/Helper | nodequent

          Module src/Helper

          Index

          Classes

          Helper +src/Helper | nodequent

          Module src/Helper

          Index

          Classes

          \ No newline at end of file diff --git a/docs/modules/src_Model.html b/docs/modules/src_Model.html index 22bb273..62917c2 100644 --- a/docs/modules/src_Model.html +++ b/docs/modules/src_Model.html @@ -1,2 +1,2 @@ -src/Model | nodequent

          Module src/Model

          Index

          Classes

          Model +src/Model | nodequent

          Module src/Model

          Index

          Classes

          \ No newline at end of file diff --git a/docs/modules/src_QueryBuilder.html b/docs/modules/src_QueryBuilder.html index 8809303..3f4f6b8 100644 --- a/docs/modules/src_QueryBuilder.html +++ b/docs/modules/src_QueryBuilder.html @@ -1,2 +1,2 @@ -src/QueryBuilder | nodequent

          Module src/QueryBuilder

          Index

          Classes

          QueryBuilder +src/QueryBuilder | nodequent

          Module src/QueryBuilder

          Index

          Classes

          \ No newline at end of file diff --git a/package.json b/package.json index 31cafb4..28b464f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nodequent", - "version": "1.0.4", + "version": "1.0.5", "description": "Laravel Eloquent for Node.js", "main": "dist/index.js", "scripts": { diff --git a/src/Model.ts b/src/Model.ts index 5550eb6..e769bae 100644 --- a/src/Model.ts +++ b/src/Model.ts @@ -42,12 +42,19 @@ export class Model { */ private attributes = {}; + /** + * @var object The original attributes of the model. + * @since 1.0.5 + */ + public original = {}; + constructor(attributes: any = {}) { if (attributes) { this.attributes = attributes; this.registerAttributes(attributes); } + this.original = Object.assign({}, attributes); this.registerAttributes(this.fillable); } @@ -83,6 +90,45 @@ export class Model { }); } + /** + * Get the original value of an attribute. + * @param key The attribute + * @returns The value of the attribute + * @since 1.0.5 + */ + public getOriginal(key: string): any { + return this.original[key]; + } + + /** + * Gets attributes that are different than the original attributes. + * @returns object The model's dirty attributes + * @since 1.0.5 + */ + public getDirty() { + let dirty = {}; + Object.keys(this.attributes).forEach((key) => { + if (this.attributes[key] !== this.original[key]) { + dirty[key] = this.attributes[key]; + } + }); + return dirty; + } + + /** + * Check if the model, or a specific attribute, is dirty. + * @param [key] The attribute to check + * @returns boolean + * @since 1.0.5 + */ + public isDirty(key?: string): boolean { + if (key) { + return this.attributes[key] !== this.original[key]; + } + + return Object.keys(this.getDirty()).length > 0; + } + /** * Get the table name * @returns The table name @@ -145,6 +191,8 @@ export class Model { attributes['updated_at'] = 'NOW()'; + this.original = this.attributes; + if (this.attributes[this.primaryKey]) { sql = `UPDATE ${this.table} SET ${Object.keys(attributes).map(key => `${key} = ${attributes[key]}`).join(', ')} WHERE ${this.primaryKey} = ${this.attributes[this.primaryKey]}`; } else { @@ -202,6 +250,7 @@ export class Model { return new Promise(async (resolve) => { const model = await (this.constructor as typeof Model).find(this.attributes[this.primaryKey]); this.attributes = model.attributes; + this.original = Object.assign({}, this.attributes); this.registerAttributes(this.attributes); resolve(this); });