Skip to content

Commit a3b08f0

Browse files
authored
Allow require reason on storage changes (#218)
1 parent 39dbd79 commit a3b08f0

4 files changed

Lines changed: 28 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
### 1.51.5 - 2026-06-22
2+
- Pass `auditUserComment` option to `Storage.deleteStorageItem` for attaching a reason to the audit log record
3+
14
### 1.51.4 - 2026-06-17
25
- Package updates
36

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@labkey/api",
3-
"version": "1.51.4",
3+
"version": "1.51.5",
44
"description": "JavaScript client API for LabKey Server",
55
"scripts": {
66
"build": "npm run build:dist && npm run build:docs",

src/labkey/Storage.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ export interface IStorageCommandOptions extends RequestCallbackOptions<StorageCo
3636
* - Shelf/Rack/Canister: name, description, locationId (rowId of the parent freezer or Shelf/Rack/Canister)
3737
* - Storage Unit Type: name, description, unitType (one of the following: "Box", "Plate", "Bag", "Cane", "Tube Rack"), rows, cols (required if positionFormat is not "Num"), positionFormat (one of the following: "Num", "AlphaNum", "AlphaAlpha", "NumAlpha", "NumNum"), positionOrder (one of the following: "RowColumn", "ColumnRow")
3838
* - Terminal Storage Location: name, description, typeId (rowId of the Storage Unit Type), locationId (rowId of the parent freezer or Shelf/Rack/Canister)
39+
*
40+
* In addition, any storage item type accepts an optional `auditUserComment` (string) which is recorded as the "Reason" on the resulting audit event.
3941
*/
4042
props: Record<string, any>;
4143
/** Storage items can be of the following types: Physical Location, Freezer, Primary Storage, Shelf, Rack, Canister, Storage Unit Type, or Terminal Storage Location. */
@@ -160,7 +162,8 @@ export function createStorageItem(config: IStorageCommandOptions): XMLHttpReques
160162
* type: 'Terminal Storage Location',
161163
* props: {
162164
* rowId: 19382,
163-
* locationId: 8089 // move Box #1 from Shelf #1 to Shelf #2
165+
* locationId: 8089, // move Box #1 from Shelf #1 to Shelf #2
166+
* auditUserComment: 'Relocated to make room for incoming samples from Lab B.'
164167
* },
165168
* success: function(response) {
166169
* console.log(response);
@@ -201,14 +204,31 @@ export interface DeleteStorageCommandOptions extends IStorageCommandOptions {
201204
* }
202205
* });
203206
* ```
207+
*
208+
* ```js
209+
* // Delete a box and record a reason in the audit log
210+
* LABKEY.Storage.deleteStorageItem({
211+
* type: 'Terminal Storage Location',
212+
* rowId: 19382,
213+
* props: {
214+
* auditUserComment: 'Decommissioned; replaced by Box #2.'
215+
* },
216+
* success: function(response) {
217+
* console.log(response);
218+
* }
219+
* });
220+
* ```
204221
*/
205222
export function deleteStorageItem(config: DeleteStorageCommandOptions): XMLHttpRequest {
206223
return request({
207224
url: buildURL('storage', 'delete.api', config.containerPath),
208225
method: 'POST',
209226
jsonData: {
210227
type: config.type,
211-
props: { rowId: config.rowId },
228+
props: {
229+
rowId: config.rowId,
230+
...(config.props?.auditUserComment !== undefined && { auditUserComment: config.props.auditUserComment }),
231+
},
212232
},
213233
success: getCallbackWrapper(getOnSuccess(config), config.scope),
214234
failure: getCallbackWrapper(getOnFailure(config), config.scope, true),

0 commit comments

Comments
 (0)