Skip to content

Commit

Permalink
make all and fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jrchudy committed Oct 24, 2024
1 parent fdc14cc commit 08b51ad
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 6 deletions.
70 changes: 70 additions & 0 deletions docs/dev-docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,8 @@ to use for ERMrest JavaScript agents.
* [.generateColumnsList(tuple, columnsList, dontChangeReference, skipLog)](#ERMrest.Reference+generateColumnsList)[<code>Array.&lt;ReferenceColumn&gt;</code>](#ERMrest.ReferenceColumn)
* [.generateActiveList([tuple])](#ERMrest.Reference+generateActiveList) ⇒ <code>Object</code>
* [.computeBulkCreateForeignKeyObject(prefillObject)](#ERMrest.Reference+computeBulkCreateForeignKeyObject) ⇒ <code>BulkCreateForeignKeyObject</code>
* [~findLeafColumnAndSetBulkCreate(constraintNameProp)](#ERMrest.Reference+computeBulkCreateForeignKeyObject..findLeafColumnAndSetBulkCreate)
* [~findLeafColumn(col, constraintName)](#ERMrest.Reference+computeBulkCreateForeignKeyObject..findLeafColumnAndSetBulkCreate..findLeafColumn)
* [._getReadPath(useEntity, getTRS, getTCRS, getUnlinkTRS)](#ERMrest.Reference+_getReadPath) : <code>Object</code>
* [~processSortObject()](#ERMrest.Reference+_getReadPath..processSortObject)
* [.Page](#ERMrest.Page)
Expand Down Expand Up @@ -729,6 +731,8 @@ to use for ERMrest JavaScript agents.
* [.generateColumnsList(tuple, columnsList, dontChangeReference, skipLog)](#ERMrest.Reference+generateColumnsList)[<code>Array.&lt;ReferenceColumn&gt;</code>](#ERMrest.ReferenceColumn)
* [.generateActiveList([tuple])](#ERMrest.Reference+generateActiveList) ⇒ <code>Object</code>
* [.computeBulkCreateForeignKeyObject(prefillObject)](#ERMrest.Reference+computeBulkCreateForeignKeyObject) ⇒ <code>BulkCreateForeignKeyObject</code>
* [~findLeafColumnAndSetBulkCreate(constraintNameProp)](#ERMrest.Reference+computeBulkCreateForeignKeyObject..findLeafColumnAndSetBulkCreate)
* [~findLeafColumn(col, constraintName)](#ERMrest.Reference+computeBulkCreateForeignKeyObject..findLeafColumnAndSetBulkCreate..findLeafColumn)
* [._getReadPath(useEntity, getTRS, getTCRS, getUnlinkTRS)](#ERMrest.Reference+_getReadPath) : <code>Object</code>
* [~processSortObject()](#ERMrest.Reference+_getReadPath..processSortObject)
* [.AttributeGroupReference](#ERMrest.AttributeGroupReference) : <code>object</code>
Expand Down Expand Up @@ -1324,6 +1328,8 @@ Documentation for this table
<a name="ERMrest.Table+_showSavedQuery"></a>

#### table.\_showSavedQuery : <code>boolean</code>
if showSavedQueryAnnoVal is -1, turn off the feature

**Kind**: instance property of [<code>Table</code>](#ERMrest.Table)
<a name="ERMrest.Table+favoritesPath"></a>

Expand Down Expand Up @@ -3188,6 +3194,8 @@ Constructor for a ParsedFilter.
* [.generateColumnsList(tuple, columnsList, dontChangeReference, skipLog)](#ERMrest.Reference+generateColumnsList)[<code>Array.&lt;ReferenceColumn&gt;</code>](#ERMrest.ReferenceColumn)
* [.generateActiveList([tuple])](#ERMrest.Reference+generateActiveList) ⇒ <code>Object</code>
* [.computeBulkCreateForeignKeyObject(prefillObject)](#ERMrest.Reference+computeBulkCreateForeignKeyObject) ⇒ <code>BulkCreateForeignKeyObject</code>
* [~findLeafColumnAndSetBulkCreate(constraintNameProp)](#ERMrest.Reference+computeBulkCreateForeignKeyObject..findLeafColumnAndSetBulkCreate)
* [~findLeafColumn(col, constraintName)](#ERMrest.Reference+computeBulkCreateForeignKeyObject..findLeafColumnAndSetBulkCreate..findLeafColumn)
* [._getReadPath(useEntity, getTRS, getTCRS, getUnlinkTRS)](#ERMrest.Reference+_getReadPath) : <code>Object</code>
* [~processSortObject()](#ERMrest.Reference+_getReadPath..processSortObject)

Expand Down Expand Up @@ -4015,6 +4023,36 @@ Will compute and return a BulkCreateForeignKeyObject if:
| --- | --- | --- |
| prefillObject | <code>Object</code> | computed prefill object from chaise |


* [.computeBulkCreateForeignKeyObject(prefillObject)](#ERMrest.Reference+computeBulkCreateForeignKeyObject) ⇒ <code>BulkCreateForeignKeyObject</code>
* [~findLeafColumnAndSetBulkCreate(constraintNameProp)](#ERMrest.Reference+computeBulkCreateForeignKeyObject..findLeafColumnAndSetBulkCreate)
* [~findLeafColumn(col, constraintName)](#ERMrest.Reference+computeBulkCreateForeignKeyObject..findLeafColumnAndSetBulkCreate..findLeafColumn)

<a name="ERMrest.Reference+computeBulkCreateForeignKeyObject..findLeafColumnAndSetBulkCreate"></a>

##### computeBulkCreateForeignKeyObject~findLeafColumnAndSetBulkCreate(constraintNameProp) ⇒
Using the given constraintName, determines the leaf column to be used for bulk foreign key create from the annotation value.
If no constraintName is provided, uses the other foreign key found on the table as the leaf
NOTE: when no constraintName, this is only called if there are 2 foreign keys and we know the main column

**Kind**: inner method of [<code>computeBulkCreateForeignKeyObject</code>](#ERMrest.Reference+computeBulkCreateForeignKeyObject)
**Returns**: BulkCreateForeignKeyObject if leaf column can be found, null otherwise

| Param | Type | Description |
| --- | --- | --- |
| constraintNameProp | <code>Array.&lt;Array.&lt;string&gt;&gt;</code> \| <code>Array.&lt;string&gt;</code> | constraint name of the foreingkey from annotation or array of constraint names |

<a name="ERMrest.Reference+computeBulkCreateForeignKeyObject..findLeafColumnAndSetBulkCreate..findLeafColumn"></a>

###### findLeafColumnAndSetBulkCreate~findLeafColumn(col, constraintName) ⇒
**Kind**: inner method of [<code>findLeafColumnAndSetBulkCreate</code>](#ERMrest.Reference+computeBulkCreateForeignKeyObject..findLeafColumnAndSetBulkCreate)
**Returns**: the foreign key column that represents the leaf table

| Param | Type | Description |
| --- | --- | --- |
| col | <code>ERMRest.Column</code> | foreign key column to check if it's in the list of visible columns and matches the constraint name |
| constraintName | <code>Array.&lt;string&gt;</code> | |

<a name="ERMrest.Reference+_getReadPath"></a>

#### reference.\_getReadPath(useEntity, getTRS, getTCRS, getUnlinkTRS) : <code>Object</code>
Expand Down Expand Up @@ -7117,6 +7155,8 @@ get PathColumn object by column name
* [.generateColumnsList(tuple, columnsList, dontChangeReference, skipLog)](#ERMrest.Reference+generateColumnsList)[<code>Array.&lt;ReferenceColumn&gt;</code>](#ERMrest.ReferenceColumn)
* [.generateActiveList([tuple])](#ERMrest.Reference+generateActiveList) ⇒ <code>Object</code>
* [.computeBulkCreateForeignKeyObject(prefillObject)](#ERMrest.Reference+computeBulkCreateForeignKeyObject) ⇒ <code>BulkCreateForeignKeyObject</code>
* [~findLeafColumnAndSetBulkCreate(constraintNameProp)](#ERMrest.Reference+computeBulkCreateForeignKeyObject..findLeafColumnAndSetBulkCreate)
* [~findLeafColumn(col, constraintName)](#ERMrest.Reference+computeBulkCreateForeignKeyObject..findLeafColumnAndSetBulkCreate..findLeafColumn)
* [._getReadPath(useEntity, getTRS, getTCRS, getUnlinkTRS)](#ERMrest.Reference+_getReadPath) : <code>Object</code>
* [~processSortObject()](#ERMrest.Reference+_getReadPath..processSortObject)

Expand Down Expand Up @@ -7944,6 +7984,36 @@ Will compute and return a BulkCreateForeignKeyObject if:
| --- | --- | --- |
| prefillObject | <code>Object</code> | computed prefill object from chaise |


* [.computeBulkCreateForeignKeyObject(prefillObject)](#ERMrest.Reference+computeBulkCreateForeignKeyObject) ⇒ <code>BulkCreateForeignKeyObject</code>
* [~findLeafColumnAndSetBulkCreate(constraintNameProp)](#ERMrest.Reference+computeBulkCreateForeignKeyObject..findLeafColumnAndSetBulkCreate)
* [~findLeafColumn(col, constraintName)](#ERMrest.Reference+computeBulkCreateForeignKeyObject..findLeafColumnAndSetBulkCreate..findLeafColumn)

<a name="ERMrest.Reference+computeBulkCreateForeignKeyObject..findLeafColumnAndSetBulkCreate"></a>

##### computeBulkCreateForeignKeyObject~findLeafColumnAndSetBulkCreate(constraintNameProp) ⇒
Using the given constraintName, determines the leaf column to be used for bulk foreign key create from the annotation value.
If no constraintName is provided, uses the other foreign key found on the table as the leaf
NOTE: when no constraintName, this is only called if there are 2 foreign keys and we know the main column

**Kind**: inner method of [<code>computeBulkCreateForeignKeyObject</code>](#ERMrest.Reference+computeBulkCreateForeignKeyObject)
**Returns**: BulkCreateForeignKeyObject if leaf column can be found, null otherwise

| Param | Type | Description |
| --- | --- | --- |
| constraintNameProp | <code>Array.&lt;Array.&lt;string&gt;&gt;</code> \| <code>Array.&lt;string&gt;</code> | constraint name of the foreingkey from annotation or array of constraint names |

<a name="ERMrest.Reference+computeBulkCreateForeignKeyObject..findLeafColumnAndSetBulkCreate..findLeafColumn"></a>

###### findLeafColumnAndSetBulkCreate~findLeafColumn(col, constraintName) ⇒
**Kind**: inner method of [<code>findLeafColumnAndSetBulkCreate</code>](#ERMrest.Reference+computeBulkCreateForeignKeyObject..findLeafColumnAndSetBulkCreate)
**Returns**: the foreign key column that represents the leaf table

| Param | Type | Description |
| --- | --- | --- |
| col | <code>ERMRest.Column</code> | foreign key column to check if it's in the list of visible columns and matches the constraint name |
| constraintName | <code>Array.&lt;string&gt;</code> | |

<a name="ERMrest.Reference+_getReadPath"></a>

#### reference.\_getReadPath(useEntity, getTRS, getTCRS, getUnlinkTRS) : <code>Object</code>
Expand Down
8 changes: 4 additions & 4 deletions js/reference.js
Original file line number Diff line number Diff line change
Expand Up @@ -4130,10 +4130,10 @@

if (foundColumn) break;
}
};
}

return foundColumn;
}
};

var leafCol = null;
// use for loop so we can break if we find the leaf column
Expand Down Expand Up @@ -4162,11 +4162,11 @@
}

if (leafCol) break;
};
}

if (!leafCol) return null;
return new BulkCreateForeignKeyObject(self, prefillObject, fkCols, mainColumn, leafCol);
}
};

if (!mainColumn) {
// if no mainColumn, this API can't be used
Expand Down
4 changes: 2 additions & 2 deletions js/utils/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@
*/
_isValidForeignKeyName = function (fkName) {
return Array.isArray(fkName) && fkName.length === 2 && typeof fkName[0] === 'string' && typeof fkName[1] === 'string';
}
};

/**
* Given input value for bulk_create_foreign_key, will return true or false depending if the value is of a valid type and value for the bulk_create_foreign_key
Expand All @@ -915,7 +915,7 @@
*/
_isValidBulkCreateForeignKey = function (bulkCreateProp) {
return bulkCreateProp === false || bulkCreateProp === null || _isValidForeignKeyName(bulkCreateProp);
}
};

/**
* @function
Expand Down

0 comments on commit 08b51ad

Please sign in to comment.