diff --git a/CHANGELOG.md b/CHANGELOG.md index 667dce8f..e9ebc7f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### 1.X - 2026-X +- Pass `auditUserComment` option to `Storage.deleteStorageItem` for attaching a reason to the audit log record + ### 1.51.4 - 2026-06-17 - Package updates diff --git a/package-lock.json b/package-lock.json index 8bd86a3e..39fc7252 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@labkey/api", - "version": "1.51.4", + "version": "1.51.5-fb-storageComment.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@labkey/api", - "version": "1.51.4", + "version": "1.51.5-fb-storageComment.2", "license": "Apache-2.0", "devDependencies": { "@babel/core": "7.29.7", diff --git a/package.json b/package.json index 0cbbf620..8b0c36ca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@labkey/api", - "version": "1.51.4", + "version": "1.51.5-fb-storageComment.2", "description": "JavaScript client API for LabKey Server", "scripts": { "build": "npm run build:dist && npm run build:docs", diff --git a/src/labkey/Storage.ts b/src/labkey/Storage.ts index 2f957648..b7568862 100644 --- a/src/labkey/Storage.ts +++ b/src/labkey/Storage.ts @@ -36,6 +36,8 @@ export interface IStorageCommandOptions extends RequestCallbackOptions; /** 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 * type: 'Terminal Storage Location', * props: { * rowId: 19382, - * locationId: 8089 // move Box #1 from Shelf #1 to Shelf #2 + * locationId: 8089, // move Box #1 from Shelf #1 to Shelf #2 + * auditUserComment: 'Relocated to make room for incoming samples from Lab B.' * }, * success: function(response) { * console.log(response); @@ -201,6 +204,20 @@ export interface DeleteStorageCommandOptions extends IStorageCommandOptions { * } * }); * ``` + * + * ```js + * // Delete a box and record a reason in the audit log + * LABKEY.Storage.deleteStorageItem({ + * type: 'Terminal Storage Location', + * rowId: 19382, + * props: { + * auditUserComment: 'Decommissioned; replaced by Box #2.' + * }, + * success: function(response) { + * console.log(response); + * } + * }); + * ``` */ export function deleteStorageItem(config: DeleteStorageCommandOptions): XMLHttpRequest { return request({ @@ -208,7 +225,10 @@ export function deleteStorageItem(config: DeleteStorageCommandOptions): XMLHttpR method: 'POST', jsonData: { type: config.type, - props: { rowId: config.rowId }, + props: { + rowId: config.rowId, + ...(config.props?.auditUserComment !== undefined && { auditUserComment: config.props.auditUserComment }), + }, }, success: getCallbackWrapper(getOnSuccess(config), config.scope), failure: getCallbackWrapper(getOnFailure(config), config.scope, true),