Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ezobjects

Package Overview
Dependencies
Maintainers
1
Versions
133
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ezobjects - npm Package Compare versions

Comparing version 2.5.0 to 2.5.1

2

generate-docs.js
const docket = require('docket-parser');
docket.title(`EZ Objects v2.5.0`);
docket.title(`EZ Objects v2.5.1`);
docket.linkClass('text-success');
docket.parseFiles(['index.js', 'mysql-connection.js']);
docket.generateDocs('docs');
{
"name": "ezobjects",
"version": "2.5.0",
"version": "2.5.1",
"description": "Easy dynamic object generation with optional MySQL table linking",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,2 +0,2 @@

# EZ Objects v2.5.0
# EZ Objects v2.5.1

@@ -83,3 +83,3 @@ EZ Objects is a Node.js module (that can also be usefully browserify'd) that aims to save you lots of time

* Create the DatabaseRecord object -- Note: This object is not
* linked to a MySQL table directory, and therefore has no tableName
* linked to a MySQL table directory, and therefore has no `tableName`
* property, but it has the MySQL configuration properties on `id`

@@ -237,11 +237,11 @@ * because it will be extended by another object that is linked to

### new DatabaseRecord([data])
### new MyObject([data])
* **Parameters:** data PlainObject (optional)
* **Description:** Create a new DatabaseRecord object and initialize it using either defaults or any provided key/value pairs in the plain object `data`. Keys can either be equal to the name of a property, or they can be have an underscore before the name of a property, as would be the case if you were to JSON.stringify() and then JSON.parse() an EZ Object. This allows for easy transferability in cases where JSON is used as the transfer medium.
* **Description:** Create a new MyObject object and initialize it using either defaults or any provided key/value pairs in the plain object `data`. Keys can either be equal to the name of a property, or they can be have an underscore before the name of a property, as would be the case if you were to JSON.stringify() and then JSON.parse() an EZ Object. This allows for easy transferability in cases where JSON is used as the transfer medium.
### new DatabaseRecord([data])
### new MyObject([data])
* **Parameters:** data string (optional)
* **Description:** Create a new DatabaseRecord object and initialize it using either defaults or any provided key/value pairs in the JSON encoded string `data`. Keys can either be equal to the name of a property, or they can be have an underscore before the name of a property, as would be the case if you were to JSON.stringify() an EZ Object. This allows for easy transferability in cases where JSON is used as the transfer medium.
* **Description:** Create a new MyObject object and initialize it using either defaults or any provided key/value pairs in the JSON encoded string `data`. Keys can either be equal to the name of a property, or they can be have an underscore before the name of a property, as would be the case if you were to JSON.stringify() an EZ Object. This allows for easy transferability in cases where JSON is used as the transfer medium.
### init([data])
### MyObject.init([data])
* **Parameters:** data PlainObject

@@ -253,7 +253,7 @@ * **Description:** Initialize this object using either defaults or any provided key/value pairs in the plain object `data`. This is also the method used by the constructor.

### myProperty()
### MyObject.myProperty()
* **Returns:** mixed
* **Description:** Get the value of the property.
### @signature myProperty(value)
### MyObject.myProperty(value)
* **Parameters:** value mixed

@@ -269,11 +269,11 @@ * **Throws:** TypeError if `value` is not of the correct javascript data type for myProperty

### delete(db)
### MyObject.delete(db)
* **Parameters:** db MySQLConnection
* **Description:** Delete the record in database `db`, table `tableName`, that has its `id` field equal to the `id` property of this object.
### insert(db)
### MyObject.insert(db)
* **Parameters:** db MySQLConnection
* **Description:** Insert this object's property values into the database `db`, table `tableName`, and store the resulting insertId in the `id` property of this object.
### load(db, id)
### MyObject.load(db, id)
* **Parameters:** db MySQLConnection

@@ -283,3 +283,3 @@ * **Parameters:** id number The value of the `id` property of the record you wish to load

### load(db, fieldValue)
### MyObject.load(db, fieldValue)
* **Parameters:** db MySQLConnection

@@ -289,9 +289,8 @@ * **Parameters:** fieldValue mixed The value of the `stringSearchField` property of the record you wish to load

### load(url)
### MyObject.load(url)
* **Parameters:** url The URL of a back-end that provides JSON data compatible with this object's initializer
* **Description:** Load the JSON-encoded data obtained from `url` using this object's initializer.
* **Note:** This signature is useful only when your classes are standalone browserify'd and requires you to implement a
* backend at `url` that will output the JSON. This signature also requires you have jQuery loaded prior to use.
* **Note:** This signature is useful only when your classes are standalone browserify'd and requires you to implement a backend at `url` that will output the JSON. This signature also requires you have jQuery loaded prior to use.
### update(db)
### MyObject.update(db)
* **Parameters:** db MySQLConnection

@@ -304,10 +303,10 @@ * **Description:** Update the record in database `db`, table `tableName`, with its `id` field equal to the `id` property of this object, using this object's property values.

### ezobjects.createTable(db, obj)**
Creates a MySQL table corresponding to the configuration outlined in `obj`, if it doesn't already exist
### ezobjects.createTable(db, objectConfig)
A function that creates a MySQL table corresponding to the configuration outlined in `objectConfig`, if it doesn't already exist
### ezobjects.createObject(obj)**
Creates an ES6 class corresponding to the configuration outlined in `obj`, with constructor, initializer, getters, setters, and also delete, insert, load, and update if `tableName` is configured
### ezobjects.createObject(objectConfig)
A function that creates an ES6 class corresponding to the configuration outlined in `objectConfig`, with constructor, initializer, getters, setters, and also delete, insert, load, and update if `tableName` is configured
### ezobjects.MySQLConnection(config)**
A MySQL database connection wrapper that uses the standard mysql package and wraps it with async/await and transaction helpers
### ezobjects.MySQLConnection(mysqlConfig)
A MySQL database connection class that wraps the standard mysql object and provides it with async/await functionality and transaction helpers

@@ -320,41 +319,41 @@ ## Configuration Specifications

* `tableName` - `string` - (optional) Provide if object should be linked with MySQL database table
* `className` - `string` - (required) Name of the class
* `extends` - `mixed` - (optional) The object that the new object should be extended from [required to extend object]
* `extendsConfig` - `object` - (optional) The EZ Object configuration for the object that is being extended from [required to extend object]
* `stringSearchField` - `string` - (optional) The name of a unique property of type `string` that you want to be able to load with as an alternative to `id`
* `properties` - `Array` - (required) An array of properties that the object (and MySQL table, if applicable) should contain
* `indexes` - `Array` - (optional) An array of indexes that should be created in the MySQL table, if applicable
* **tableName** - `string` - (optional) Provide if object should be linked with MySQL database table
* **className** - `string` - (required) Name of the class
* **extends** - `mixed` - (optional) The object that the new object should be extended from [required to extend object]
* **extendsConfig** - `object` - (optional) The EZ Object configuration for the object that is being extended from [required to extend object]
* **stringSearchField** - `string` - (optional) The name of a unique property of type `string` that you want to be able to load with as an alternative to `id`
* **properties** - `Array` - (required) An array of properties that the object (and MySQL table, if applicable) should contain
* **indexes** - `Array` - (optional) An array of indexes that should be created in the MySQL table, if applicable
### A property configuration can have the following:
* `name` - `string` - (required) Name of the property, must conform to both JavaScript and MySQL rules
* `type` - `string` - (required) JavaScript data type for the property
* `mysqlType` - `string` - (optional) MySQL data type for the property [required for MySQL table association]
* `length` - `number` - (optional) MySQL data length for the property [required for MySQL table association on some data types like VARCHAR]
* `decimals` - `number` - (optional) Number of decimals that should be provided for certain data types when SELECT'ed from the MySQL table
* `primary` - `boolean` - (optional) Indicates the property is a PRIMARY KEY in the MySQL table [required for MySQL table association on at least one property in the table]
* `unique` - `boolean` - (optional) Indicates the property is a UNIQUE KEY in the MySQL table
* `null` - `boolean` - (optional) Indicates the property can be NULL [default is properties must be NOT NULL]
* `default` - `mixed` - (optional) Sets the default value for the property in the class object
* `mysqlDefault` - `mixed` - (optional) Sets the default value for the property in the MySQL table, assuming its of the correct type
* `unsigned` - `boolean` - (optional) Indicates the property should be unsigned in the MySQL table
* `zerofill` - `boolean` - (optional) Indicates the property should be zero-filled in the MySQL table
* `comment` - `string` - (optional) Indicates the property should note the provided comment in the MySQL table
* `charsetName` - `string` - (optional) Indicates the property should use the provided charset in the MySQL table
* `collationName` - `string` - (optional) Indicates the property should use the provided collation in the MySQL table
* `autoIncrement` - `boolean` - (optional) Indicates the property should be auto-incremented in the MySQL table
* `getTransform` - `function` - (optional) Function that transforms and returns the property value prior to getting
* `setTransform` - `function` - (optional) Function that transforms and returns the property value prior to setting
* `saveTransform` - `function` - (optional) Function that transforms and returns the property value prior to saving in the database
* `loadTransform` - `function` - (optional) Function that transforms and returns the property value after loading from the database
* **name** - `string` - (required) Name of the property, must conform to both JavaScript and MySQL rules
* **type** - `string` - (required) JavaScript data type for the property
* **mysqlType** - `string` - (optional) MySQL data type for the property [required for MySQL table association]
* **length** - `number` - (optional) MySQL data length for the property [required for MySQL table association on some data types like VARCHAR]
* **decimals** - `number` - (optional) Number of decimals that should be provided for certain data types when SELECT'ed from the MySQL table
* **primary** - `boolean` - (optional) Indicates the property is a PRIMARY KEY in the MySQL table [required for MySQL table association on at least one property in the table]
* **unique** - `boolean` - (optional) Indicates the property is a UNIQUE KEY in the MySQL table
* **null** - `boolean` - (optional) Indicates the property can be NULL [default is properties must be NOT NULL]
* **default** - `mixed` - (optional) Sets the default value for the property in the class object
* **mysqlDefault** - `mixed` - (optional) Sets the default value for the property in the MySQL table, assuming its of the correct type
* **unsigned** - `boolean` - (optional) Indicates the property should be unsigned in the MySQL table
* **zerofill** - `boolean` - (optional) Indicates the property should be zero-filled in the MySQL table
* **comment** - `string` - (optional) Indicates the property should note the provided comment in the MySQL table
* **charsetName** - `string` - (optional) Indicates the property should use the provided charset in the MySQL table
* **collationName** - `string` - (optional) Indicates the property should use the provided collation in the MySQL table
* **autoIncrement** - `boolean` - (optional) Indicates the property should be auto-incremented in the MySQL table
* **getTransform** - `function` - (optional) Function that transforms and returns the property value prior to getting
* **setTransform** - `function` - (optional) Function that transforms and returns the property value prior to setting
* **saveTransform** - `function` - (optional) Function that transforms and returns the property value prior to saving in the database
* **loadTransform** - `function` - (optional) Function that transforms and returns the property value after loading from the database
### An index configuration can have the following (for MySQL table association only):
* `name` - `string` - (required) Name of the index, can be arbitrary, but must be unique and not PRIMARY
* `type` - `string` - (optional) Index type, can be BTREE or HASH, defaults to BTREE
* `keyBlockSize` - `number` - (optional) Indicates the index should use the provided key block size
* `withParser` - `string` - (optional) Indicates the index should use the provided parser
* `visible` - `boolean` - (optional) Indicates the index should be visible
* `invisible` - `boolean` - (optional) Indicates the index should be invisible
* **name** - `string` - (required) Name of the index, can be arbitrary, but must be unique and not PRIMARY
* **type** - `string` - (optional) Index type, can be BTREE or HASH, defaults to BTREE
* **keyBlockSize** - `number` - (optional) Indicates the index should use the provided key block size
* **withParser** - `string` - (optional) Indicates the index should use the provided parser
* **visible** - `boolean` - (optional) Indicates the index should be visible
* **invisible** - `boolean` - (optional) Indicates the index should be invisible

@@ -367,2 +366,2 @@ ### Default intiailizations for different JavaScript types

* `Array` - []
* anything else - null
* Everything else - null

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc