From 6b9f6f0823967010ca52fcbec1dc3b276af52913 Mon Sep 17 00:00:00 2001 From: XingY Date: Thu, 18 Jun 2026 19:18:20 -0700 Subject: [PATCH 1/3] Allow require reason on storage changes --- CHANGELOG.md | 3 +++ package-lock.json | 4 ++-- package.json | 2 +- src/labkey/Storage.ts | 5 +++++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 667dce8f..395979ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### 1.X - 2026-X +- Add `auditUserComment` option to `Storage.createStorageItem`, `Storage.updateStorageItem`, and `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..fe250726 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.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@labkey/api", - "version": "1.51.4", + "version": "1.51.5-fb-storageComment.1", "license": "Apache-2.0", "devDependencies": { "@babel/core": "7.29.7", diff --git a/package.json b/package.json index 0cbbf620..b3a62a2f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@labkey/api", - "version": "1.51.4", + "version": "1.51.5-fb-storageComment.1", "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..a4b018ea 100644 --- a/src/labkey/Storage.ts +++ b/src/labkey/Storage.ts @@ -27,6 +27,8 @@ export interface StorageCommandResponse { } export interface IStorageCommandOptions extends RequestCallbackOptions { + /** Optional comment that will be attached to the audit log record for this storage change. */ + auditUserComment?: string; /** The container path in which to execute the command. */ containerPath?: string; /** The specific set of props will differ for each storage item type: @@ -129,6 +131,7 @@ export function createStorageItem(config: IStorageCommandOptions): XMLHttpReques jsonData: { type: config.type, props: config.props, + auditUserComment: config.auditUserComment, }, success: getCallbackWrapper(getOnSuccess(config), config.scope), failure: getCallbackWrapper(getOnFailure(config), config.scope, true), @@ -175,6 +178,7 @@ export function updateStorageItem(config: IStorageCommandOptions): XMLHttpReques jsonData: { type: config.type, props: config.props, + auditUserComment: config.auditUserComment, }, success: getCallbackWrapper(getOnSuccess(config), config.scope), failure: getCallbackWrapper(getOnFailure(config), config.scope, true), @@ -209,6 +213,7 @@ export function deleteStorageItem(config: DeleteStorageCommandOptions): XMLHttpR jsonData: { type: config.type, props: { rowId: config.rowId }, + auditUserComment: config.auditUserComment, }, success: getCallbackWrapper(getOnSuccess(config), config.scope), failure: getCallbackWrapper(getOnFailure(config), config.scope, true), From 69ae7525fc324218b3c2a81c135f42c2fcd5fe77 Mon Sep 17 00:00:00 2001 From: XingY Date: Fri, 19 Jun 2026 12:10:14 -0700 Subject: [PATCH 2/3] Use props to hold auditUserComment and skip client api updates --- package-lock.json | 4 ++-- package.json | 2 +- src/labkey/Storage.ts | 29 ++++++++++++++++++++++------- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index fe250726..39fc7252 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@labkey/api", - "version": "1.51.5-fb-storageComment.1", + "version": "1.51.5-fb-storageComment.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@labkey/api", - "version": "1.51.5-fb-storageComment.1", + "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 b3a62a2f..8b0c36ca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@labkey/api", - "version": "1.51.5-fb-storageComment.1", + "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 a4b018ea..b7568862 100644 --- a/src/labkey/Storage.ts +++ b/src/labkey/Storage.ts @@ -27,8 +27,6 @@ export interface StorageCommandResponse { } export interface IStorageCommandOptions extends RequestCallbackOptions { - /** Optional comment that will be attached to the audit log record for this storage change. */ - auditUserComment?: string; /** The container path in which to execute the command. */ containerPath?: string; /** The specific set of props will differ for each storage item type: @@ -38,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. */ @@ -131,7 +131,6 @@ export function createStorageItem(config: IStorageCommandOptions): XMLHttpReques jsonData: { type: config.type, props: config.props, - auditUserComment: config.auditUserComment, }, success: getCallbackWrapper(getOnSuccess(config), config.scope), failure: getCallbackWrapper(getOnFailure(config), config.scope, true), @@ -163,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); @@ -178,7 +178,6 @@ export function updateStorageItem(config: IStorageCommandOptions): XMLHttpReques jsonData: { type: config.type, props: config.props, - auditUserComment: config.auditUserComment, }, success: getCallbackWrapper(getOnSuccess(config), config.scope), failure: getCallbackWrapper(getOnFailure(config), config.scope, true), @@ -205,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({ @@ -212,8 +225,10 @@ export function deleteStorageItem(config: DeleteStorageCommandOptions): XMLHttpR method: 'POST', jsonData: { type: config.type, - props: { rowId: config.rowId }, - auditUserComment: config.auditUserComment, + 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), From 8a9cb0384cdaf63cbd61432c523e92ed8838d911 Mon Sep 17 00:00:00 2001 From: XingY Date: Fri, 19 Jun 2026 12:11:47 -0700 Subject: [PATCH 3/3] comment update --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 395979ed..e9ebc7f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ ### 1.X - 2026-X -- Add `auditUserComment` option to `Storage.createStorageItem`, `Storage.updateStorageItem`, and `Storage.deleteStorageItem` for attaching a reason to the audit log record +- Pass `auditUserComment` option to `Storage.deleteStorageItem` for attaching a reason to the audit log record ### 1.51.4 - 2026-06-17 - Package updates