@jacebenson/jsn 4.3.9-dev.64 → 4.3.9-dev.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commands/updatesets.js +13 -1
package/package.json
CHANGED
|
@@ -6,6 +6,8 @@ import { FormatAuto } from '../output.js';
|
|
|
6
6
|
import { getCurrentApplication, getCurrentUpdateSet, requireCurrentUserSysId, setCurrentApplication, setCurrentUpdateSet } from '../context.js';
|
|
7
7
|
import { errAPI, errUsage, errConfirmationRequired } from '../errors.js';
|
|
8
8
|
import { declareCapabilities } from '../capabilities.js';
|
|
9
|
+
import { resolveScope } from './scopes.js';
|
|
10
|
+
import { unwrapSysId } from '../resolve-record.js';
|
|
9
11
|
|
|
10
12
|
declareCapabilities('updatesets', {
|
|
11
13
|
mutationSubcommands: ['create', 'set', 'complete', 'ignore', 'parent'],
|
|
@@ -612,12 +614,22 @@ export function updateSetsCmd(wrap) {
|
|
|
612
614
|
describe: 'Create a new update set (auto-sets as current)',
|
|
613
615
|
builder: (y) => y
|
|
614
616
|
.option('name', { alias: 'n', type: 'string', demandOption: true, describe: 'Update set name' })
|
|
615
|
-
.option('description', { type: 'string', describe: 'Description' })
|
|
617
|
+
.option('description', { type: 'string', describe: 'Description' })
|
|
618
|
+
.option('scope', { type: 'string', describe: 'Switch to this application before creating (scope value, sys_id, or name)' }),
|
|
616
619
|
handler: wrap(async (argv, app) => {
|
|
620
|
+
let scopeSysID;
|
|
621
|
+
if (argv.scope !== undefined) {
|
|
622
|
+
if (!String(argv.scope).trim()) throw errUsage('Scope must not be empty');
|
|
623
|
+
const scope = await resolveScope(app.sdk, argv.scope);
|
|
624
|
+
scopeSysID = unwrapSysId(scope);
|
|
625
|
+
const userSysID = await requireCurrentUserSysId(app.sdk);
|
|
626
|
+
await setCurrentApplication(app.sdk, userSysID, scopeSysID);
|
|
627
|
+
}
|
|
617
628
|
const record = await app.sdk.create('sys_update_set', {
|
|
618
629
|
name: argv.name,
|
|
619
630
|
description: argv.description || argv.name,
|
|
620
631
|
state: 'in progress',
|
|
632
|
+
...(scopeSysID ? { application: scopeSysID } : {}),
|
|
621
633
|
});
|
|
622
634
|
|
|
623
635
|
// Auto-set as current update set
|