@jacebenson/jsn 0.0.8 → 0.0.10
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/cli.js +3 -1
- package/src/commands/_ticket.js +3 -3
- package/src/commands/dev/_generic.js +5 -5
- package/src/commands/dev/flows.js +2 -2
- package/src/commands/dev/logs.js +2 -2
- package/src/commands/dev/scopes.js +2 -2
- package/src/commands/dev/updatesets.js +2 -2
- package/src/commands/groupmembers.js +2 -2
- package/src/commands/grouproles.js +2 -2
- package/src/commands/groups.js +2 -2
- package/src/commands/records.js +6 -6
- package/src/commands/tickets.js +5 -5
- package/src/commands/users.js +2 -2
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -139,4 +139,6 @@ export const cli = yargs(hideBin(process.argv))
|
|
|
139
139
|
.version(false)
|
|
140
140
|
.strictCommands()
|
|
141
141
|
.strictOptions(false)
|
|
142
|
-
.epilogue('
|
|
142
|
+
.epilogue('TIPS\n'
|
|
143
|
+
+ ' --query is available on every list command (e.g. "incidents list --query priority=1")\n'
|
|
144
|
+
+ ' Use "jsn <command> --help" for details, or "jsn <command> list --help" for list options');
|
package/src/commands/_ticket.js
CHANGED
|
@@ -9,7 +9,7 @@ export function buildTicketCommands(table, displayName, alias, defaultColumns, s
|
|
|
9
9
|
return {
|
|
10
10
|
command: `${displayName} [subcommand]`,
|
|
11
11
|
aliases: [table, alias],
|
|
12
|
-
describe: `Manage ${displayName}`,
|
|
12
|
+
describe: `Manage ${displayName} (e.g. "${displayName} list --query priority=1")`,
|
|
13
13
|
builder: (yargs) => {
|
|
14
14
|
return yargs
|
|
15
15
|
.command({
|
|
@@ -17,8 +17,8 @@ export function buildTicketCommands(table, displayName, alias, defaultColumns, s
|
|
|
17
17
|
aliases: ['ls'],
|
|
18
18
|
describe: `List ${table}`,
|
|
19
19
|
builder: (y) => y
|
|
20
|
-
.option('query', { type: 'string', describe: 'Encoded query
|
|
21
|
-
.option('columns', { alias: 'c', type: 'string', describe: 'Comma-separated columns' })
|
|
20
|
+
.option('query', { type: 'string', describe: 'Encoded query (e.g. "nameLIKEincident" or "active=true")' })
|
|
21
|
+
.option('columns', { alias: 'c', type: 'string', describe: 'Comma-separated columns (e.g. "number,short_description")' })
|
|
22
22
|
.option('limit', { alias: 'l', type: 'number', default: 20, describe: 'Max records' })
|
|
23
23
|
.option('offset', { alias: 'o', type: 'number', default: 0, describe: 'Offset for pagination' }),
|
|
24
24
|
handler: wrap(async (argv, app) => {
|
|
@@ -61,8 +61,8 @@ export function buildDevCmd(name, table, aliases, defaultColumns, wrap, opts = {
|
|
|
61
61
|
aliases: ['ls'],
|
|
62
62
|
describe: `List ${name}`,
|
|
63
63
|
builder: (y) => y
|
|
64
|
-
.option('query', { type: 'string', describe: 'Encoded query
|
|
65
|
-
.option('columns', { alias: 'c', type: 'string', describe: 'Comma-separated columns' })
|
|
64
|
+
.option('query', { type: 'string', describe: 'Encoded query (e.g. "nameLIKEincident" or "active=true^priority=1")' })
|
|
65
|
+
.option('columns', { alias: 'c', type: 'string', describe: 'Comma-separated columns (e.g. "name,label,super_class")' })
|
|
66
66
|
.option('limit', { alias: 'l', type: 'number', default: 20, describe: 'Max records' }),
|
|
67
67
|
handler: wrap(async (argv, app) => {
|
|
68
68
|
const columns = argv.columns ? argv.columns.split(',') : defaultColumns;
|
|
@@ -123,7 +123,7 @@ export function buildDevCmd(name, table, aliases, defaultColumns, wrap, opts = {
|
|
|
123
123
|
.command({
|
|
124
124
|
command: 'create',
|
|
125
125
|
describe: `Create a new ${singular}`,
|
|
126
|
-
builder: (y) => y.option('data', { type: 'string', demandOption: true, describe: 'JSON
|
|
126
|
+
builder: (y) => y.option('data', { type: 'string', demandOption: true, describe: 'JSON fields (e.g. \'{"state":"2"}\')' }),
|
|
127
127
|
handler: wrap(async (argv, app) => {
|
|
128
128
|
const recordData = JSON.parse(argv.data);
|
|
129
129
|
const record = await app.sdk.create(table, recordData);
|
|
@@ -138,7 +138,7 @@ export function buildDevCmd(name, table, aliases, defaultColumns, wrap, opts = {
|
|
|
138
138
|
.command({
|
|
139
139
|
command: 'update <identifier>',
|
|
140
140
|
describe: `Update ${vowelArticle(singular)} ${singular}`,
|
|
141
|
-
builder: (y) => y.option('data', { type: 'string', demandOption: true, describe: 'JSON
|
|
141
|
+
builder: (y) => y.option('data', { type: 'string', demandOption: true, describe: 'JSON fields (e.g. \'{"state":"2"}\')' }),
|
|
142
142
|
handler: wrap(async (argv, app) => {
|
|
143
143
|
const id = argv.identifier;
|
|
144
144
|
const queryField = isHexString(id) && id.length === 32 ? 'sys_id' : 'name';
|
|
@@ -213,7 +213,7 @@ export function buildDevCmd(name, table, aliases, defaultColumns, wrap, opts = {
|
|
|
213
213
|
return {
|
|
214
214
|
command: `${name} [subcommand]`,
|
|
215
215
|
aliases: aliases || [],
|
|
216
|
-
describe: `Manage ${name}`,
|
|
216
|
+
describe: `Manage ${name} (e.g. "${name} list --query nameLIKEincident")`,
|
|
217
217
|
builder,
|
|
218
218
|
handler: (argv) => {
|
|
219
219
|
if (argv.help) return;
|
|
@@ -12,8 +12,8 @@ export function flowsCmd(wrap) {
|
|
|
12
12
|
aliases: ['ls'],
|
|
13
13
|
describe: 'List flows',
|
|
14
14
|
builder: (y) => y
|
|
15
|
-
.option('query', { type: 'string', describe: 'Encoded query
|
|
16
|
-
.option('columns', { alias: 'c', type: 'string', describe: 'Comma-separated columns' })
|
|
15
|
+
.option('query', { type: 'string', describe: 'Encoded query (e.g. "nameLIKEincident" or "active=true")' })
|
|
16
|
+
.option('columns', { alias: 'c', type: 'string', describe: 'Comma-separated columns (e.g. "number,short_description")' })
|
|
17
17
|
.option('limit', { alias: 'l', type: 'number', default: 20, describe: 'Max records' }),
|
|
18
18
|
handler: wrap(async (argv, app) => {
|
|
19
19
|
const columns = argv.columns ? argv.columns.split(',') : ['name', 'active', 'description', 'sys_created_by', 'sys_updated_on'];
|
package/src/commands/dev/logs.js
CHANGED
|
@@ -12,8 +12,8 @@ export function logsCmd(wrap) {
|
|
|
12
12
|
aliases: ['ls'],
|
|
13
13
|
describe: 'List system logs',
|
|
14
14
|
builder: (y) => y
|
|
15
|
-
.option('query', { type: 'string', describe: 'Encoded query
|
|
16
|
-
.option('columns', { alias: 'c', type: 'string', describe: 'Comma-separated columns' })
|
|
15
|
+
.option('query', { type: 'string', describe: 'Encoded query (e.g. "nameLIKEincident" or "active=true")' })
|
|
16
|
+
.option('columns', { alias: 'c', type: 'string', describe: 'Comma-separated columns (e.g. "number,short_description")' })
|
|
17
17
|
.option('limit', { alias: 'l', type: 'number', default: 50, describe: 'Max records' }),
|
|
18
18
|
handler: wrap(async (argv, app) => {
|
|
19
19
|
const columns = argv.columns ? argv.columns.split(',') : ['level', 'message', 'source', 'created'];
|
|
@@ -12,8 +12,8 @@ export function scopesCmd(wrap) {
|
|
|
12
12
|
aliases: ['ls'],
|
|
13
13
|
describe: 'List application scopes',
|
|
14
14
|
builder: (y) => y
|
|
15
|
-
.option('query', { type: 'string', describe: 'Encoded query
|
|
16
|
-
.option('columns', { alias: 'c', type: 'string', describe: 'Comma-separated columns' })
|
|
15
|
+
.option('query', { type: 'string', describe: 'Encoded query (e.g. "nameLIKEincident" or "active=true")' })
|
|
16
|
+
.option('columns', { alias: 'c', type: 'string', describe: 'Comma-separated columns (e.g. "number,short_description")' })
|
|
17
17
|
.option('limit', { alias: 'l', type: 'number', default: 20, describe: 'Max records' }),
|
|
18
18
|
handler: wrap(async (argv, app) => {
|
|
19
19
|
const columns = argv.columns ? argv.columns.split(',') : ['name', 'scope', 'short_description', 'active'];
|
|
@@ -12,8 +12,8 @@ export function updateSetsCmd(wrap) {
|
|
|
12
12
|
aliases: ['ls'],
|
|
13
13
|
describe: 'List update sets',
|
|
14
14
|
builder: (y) => y
|
|
15
|
-
.option('query', { type: 'string', describe: 'Encoded query
|
|
16
|
-
.option('columns', { alias: 'c', type: 'string', describe: 'Comma-separated columns' })
|
|
15
|
+
.option('query', { type: 'string', describe: 'Encoded query (e.g. "nameLIKEincident" or "active=true")' })
|
|
16
|
+
.option('columns', { alias: 'c', type: 'string', describe: 'Comma-separated columns (e.g. "number,short_description")' })
|
|
17
17
|
.option('limit', { alias: 'l', type: 'number', default: 20, describe: 'Max records' }),
|
|
18
18
|
handler: wrap(async (argv, app) => {
|
|
19
19
|
const columns = argv.columns ? argv.columns.split(',') : ['name', 'state', 'application'];
|
|
@@ -12,8 +12,8 @@ export function groupMembersCmd(wrap) {
|
|
|
12
12
|
aliases: ['ls'],
|
|
13
13
|
describe: 'List group members',
|
|
14
14
|
builder: (y) => y
|
|
15
|
-
.option('query', { type: 'string', describe: 'Encoded query
|
|
16
|
-
.option('columns', { alias: 'c', type: 'string', describe: 'Comma-separated columns' })
|
|
15
|
+
.option('query', { type: 'string', describe: 'Encoded query (e.g. "nameLIKEincident" or "active=true")' })
|
|
16
|
+
.option('columns', { alias: 'c', type: 'string', describe: 'Comma-separated columns (e.g. "number,short_description")' })
|
|
17
17
|
.option('limit', { alias: 'l', type: 'number', default: 20, describe: 'Max records' }),
|
|
18
18
|
handler: wrap(async (argv, app) => {
|
|
19
19
|
const columns = argv.columns ? argv.columns.split(',') : ['user.name', 'group.name'];
|
|
@@ -12,8 +12,8 @@ export function groupRolesCmd(wrap) {
|
|
|
12
12
|
aliases: ['ls'],
|
|
13
13
|
describe: 'List group roles',
|
|
14
14
|
builder: (y) => y
|
|
15
|
-
.option('query', { type: 'string', describe: 'Encoded query
|
|
16
|
-
.option('columns', { alias: 'c', type: 'string', describe: 'Comma-separated columns' })
|
|
15
|
+
.option('query', { type: 'string', describe: 'Encoded query (e.g. "nameLIKEincident" or "active=true")' })
|
|
16
|
+
.option('columns', { alias: 'c', type: 'string', describe: 'Comma-separated columns (e.g. "number,short_description")' })
|
|
17
17
|
.option('limit', { alias: 'l', type: 'number', default: 20, describe: 'Max records' }),
|
|
18
18
|
handler: wrap(async (argv, app) => {
|
|
19
19
|
const columns = argv.columns ? argv.columns.split(',') : ['group.name', 'role.name'];
|
package/src/commands/groups.js
CHANGED
|
@@ -12,8 +12,8 @@ export function groupsCmd(wrap) {
|
|
|
12
12
|
aliases: ['ls'],
|
|
13
13
|
describe: 'List groups',
|
|
14
14
|
builder: (y) => y
|
|
15
|
-
.option('query', { type: 'string', describe: 'Encoded query
|
|
16
|
-
.option('columns', { alias: 'c', type: 'string', describe: 'Comma-separated columns' })
|
|
15
|
+
.option('query', { type: 'string', describe: 'Encoded query (e.g. "nameLIKEincident" or "active=true")' })
|
|
16
|
+
.option('columns', { alias: 'c', type: 'string', describe: 'Comma-separated columns (e.g. "number,short_description")' })
|
|
17
17
|
.option('limit', { alias: 'l', type: 'number', default: 20, describe: 'Max records' }),
|
|
18
18
|
handler: wrap(async (argv, app) => {
|
|
19
19
|
const columns = argv.columns ? argv.columns.split(',') : ['name', 'manager', 'email'];
|
package/src/commands/records.js
CHANGED
|
@@ -22,7 +22,7 @@ function getDefaultColumns(table) {
|
|
|
22
22
|
export function recordsCmd(wrap) {
|
|
23
23
|
return {
|
|
24
24
|
command: 'records <subcommand>',
|
|
25
|
-
describe: 'Query and manage records in any table',
|
|
25
|
+
describe: 'Query and manage records in any table (e.g. "records list --table incident --query priority=1")',
|
|
26
26
|
builder: (yargs) => {
|
|
27
27
|
return yargs
|
|
28
28
|
.command({
|
|
@@ -30,8 +30,8 @@ export function recordsCmd(wrap) {
|
|
|
30
30
|
describe: 'List records from a table',
|
|
31
31
|
builder: (y) => y
|
|
32
32
|
.option('table', { type: 'string', demandOption: true, describe: 'Table name' })
|
|
33
|
-
.option('query', { type: 'string', describe: 'Encoded query
|
|
34
|
-
.option('columns', { alias: 'c', type: 'string', describe: 'Comma-separated columns' })
|
|
33
|
+
.option('query', { type: 'string', describe: 'Encoded query (e.g. "nameLIKEincident" or "active=true")' })
|
|
34
|
+
.option('columns', { alias: 'c', type: 'string', describe: 'Comma-separated columns (e.g. "number,short_description")' })
|
|
35
35
|
.option('limit', { type: 'number', default: 20, describe: 'Max records' })
|
|
36
36
|
.option('offset', { type: 'number', default: 0, describe: 'Offset' }),
|
|
37
37
|
handler: wrap(async (argv, app) => {
|
|
@@ -80,7 +80,7 @@ export function recordsCmd(wrap) {
|
|
|
80
80
|
builder: (y) => y
|
|
81
81
|
.option('table', { type: 'string', demandOption: true, describe: 'Table name' })
|
|
82
82
|
.option('sys-id', { type: 'string', demandOption: true, describe: 'Record sys_id' })
|
|
83
|
-
.option('columns', { type: 'string', describe: 'Comma-separated columns' }),
|
|
83
|
+
.option('columns', { type: 'string', describe: 'Comma-separated columns (e.g. "number,short_description")' }),
|
|
84
84
|
handler: wrap(async (argv, app) => {
|
|
85
85
|
const params = new URLSearchParams();
|
|
86
86
|
params.set('sysparm_query', `sys_id=${argv['sys-id']}`);
|
|
@@ -99,7 +99,7 @@ export function recordsCmd(wrap) {
|
|
|
99
99
|
describe: 'Create a new record',
|
|
100
100
|
builder: (y) => y
|
|
101
101
|
.option('table', { type: 'string', demandOption: true, describe: 'Table name' })
|
|
102
|
-
.option('data', { type: 'string', demandOption: true, describe: 'JSON
|
|
102
|
+
.option('data', { type: 'string', demandOption: true, describe: 'JSON fields (e.g. \'{"state":"2"}\')' }),
|
|
103
103
|
handler: wrap(async (argv, app) => {
|
|
104
104
|
const recordData = JSON.parse(argv.data);
|
|
105
105
|
const record = await app.sdk.create(argv.table, recordData);
|
|
@@ -112,7 +112,7 @@ export function recordsCmd(wrap) {
|
|
|
112
112
|
builder: (y) => y
|
|
113
113
|
.option('table', { type: 'string', demandOption: true, describe: 'Table name' })
|
|
114
114
|
.option('sys-id', { type: 'string', demandOption: true, describe: 'Record sys_id' })
|
|
115
|
-
.option('data', { type: 'string', demandOption: true, describe: 'JSON
|
|
115
|
+
.option('data', { type: 'string', demandOption: true, describe: 'JSON fields (e.g. \'{"state":"2"}\')' }),
|
|
116
116
|
handler: wrap(async (argv, app) => {
|
|
117
117
|
const recordData = JSON.parse(argv.data);
|
|
118
118
|
const record = await app.sdk.update(argv.table, argv['sys-id'], recordData);
|
package/src/commands/tickets.js
CHANGED
|
@@ -4,7 +4,7 @@ export function ticketsCmd(wrap) {
|
|
|
4
4
|
return {
|
|
5
5
|
command: 'tickets [subcommand]',
|
|
6
6
|
aliases: ['ticket'],
|
|
7
|
-
describe: 'Query generic tickets',
|
|
7
|
+
describe: 'Query generic tickets (e.g. "tickets list --query active=true")',
|
|
8
8
|
builder: (yargs) => {
|
|
9
9
|
return yargs
|
|
10
10
|
.command({
|
|
@@ -12,8 +12,8 @@ export function ticketsCmd(wrap) {
|
|
|
12
12
|
aliases: ['ls'],
|
|
13
13
|
describe: 'List tickets',
|
|
14
14
|
builder: (y) => y
|
|
15
|
-
.option('query', { type: 'string', describe: 'Encoded query
|
|
16
|
-
.option('columns', { alias: 'c', type: 'string', describe: 'Comma-separated columns' })
|
|
15
|
+
.option('query', { type: 'string', describe: 'Encoded query (e.g. "active=true^priority=1")' })
|
|
16
|
+
.option('columns', { alias: 'c', type: 'string', describe: 'Comma-separated columns (e.g. "number,short_description,priority")' })
|
|
17
17
|
.option('limit', { alias: 'l', type: 'number', default: 20, describe: 'Max records' })
|
|
18
18
|
.option('offset', { alias: 'o', type: 'number', default: 0, describe: 'Offset' }),
|
|
19
19
|
handler: wrap(async (argv, app) => {
|
|
@@ -73,7 +73,7 @@ export function ticketsCmd(wrap) {
|
|
|
73
73
|
.command({
|
|
74
74
|
command: 'create',
|
|
75
75
|
describe: 'Create a new ticket',
|
|
76
|
-
builder: (y) => y.option('data', { type: 'string', demandOption: true, describe: 'JSON
|
|
76
|
+
builder: (y) => y.option('data', { type: 'string', demandOption: true, describe: 'JSON fields (e.g. \'{"state":"2","priority":"1"}\')' }),
|
|
77
77
|
handler: wrap(async (argv, app) => {
|
|
78
78
|
const recordData = JSON.parse(argv.data);
|
|
79
79
|
const record = await app.sdk.create('ticket', recordData);
|
|
@@ -83,7 +83,7 @@ export function ticketsCmd(wrap) {
|
|
|
83
83
|
.command({
|
|
84
84
|
command: 'update <number>',
|
|
85
85
|
describe: 'Update a ticket',
|
|
86
|
-
builder: (y) => y.option('data', { type: 'string', demandOption: true, describe: 'JSON
|
|
86
|
+
builder: (y) => y.option('data', { type: 'string', demandOption: true, describe: 'JSON fields (e.g. \'{"state":"2","priority":"1"}\')' }),
|
|
87
87
|
handler: wrap(async (argv, app) => {
|
|
88
88
|
const recordData = JSON.parse(argv.data);
|
|
89
89
|
const findParams = new URLSearchParams();
|
package/src/commands/users.js
CHANGED
|
@@ -12,8 +12,8 @@ export function usersCmd(wrap) {
|
|
|
12
12
|
aliases: ['ls'],
|
|
13
13
|
describe: 'List users',
|
|
14
14
|
builder: (y) => y
|
|
15
|
-
.option('query', { type: 'string', describe: 'Encoded query
|
|
16
|
-
.option('columns', { alias: 'c', type: 'string', describe: 'Comma-separated columns' })
|
|
15
|
+
.option('query', { type: 'string', describe: 'Encoded query (e.g. "nameLIKEincident" or "active=true")' })
|
|
16
|
+
.option('columns', { alias: 'c', type: 'string', describe: 'Comma-separated columns (e.g. "number,short_description")' })
|
|
17
17
|
.option('limit', { alias: 'l', type: 'number', default: 20, describe: 'Max records' }),
|
|
18
18
|
handler: wrap(async (argv, app) => {
|
|
19
19
|
const columns = argv.columns ? argv.columns.split(',') : ['user_name', 'name', 'email', 'active'];
|