@jacebenson/jsn 0.1.1 → 0.1.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jacebenson/jsn",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "A command-line interface for ServiceNow that follows the Unix philosophy: simple, composable, and scriptable.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -18,7 +18,7 @@ export function buildTicketCommands(table, displayName, alias, defaultColumns, s
18
18
  describe: `List ${table}`,
19
19
  builder: (y) => y
20
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")' })
21
+ .option('columns', { alias: ['c', 'fields'], 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) => {
@@ -81,7 +81,7 @@ export function buildDevCmd(name, table, aliases, defaultColumns, wrap, opts = {
81
81
  describe: `List ${name}`,
82
82
  builder: (y) => y
83
83
  .option('query', { type: 'string', describe: 'Encoded query (e.g. "nameLIKEincident" or "active=true^priority=1")' })
84
- .option('columns', { alias: 'c', type: 'string', describe: 'Comma-separated columns (e.g. "name,label,super_class")' })
84
+ .option('columns', { alias: ['c', 'fields'], type: 'string', describe: 'Comma-separated columns (e.g. "name,label,super_class")' })
85
85
  .option('limit', { alias: 'l', type: 'number', default: 20, describe: 'Max records' }),
86
86
  handler: wrap(async (argv, app) => {
87
87
  const query = argv.query || '';
@@ -251,6 +251,7 @@ export function buildDevCmd(name, table, aliases, defaultColumns, wrap, opts = {
251
251
  const findParams = new URLSearchParams();
252
252
  findParams.set('sysparm_query', `${queryField}=${id}`);
253
253
  findParams.set('sysparm_limit', '1');
254
+ findParams.set('sysparm_display_value', 'all');
254
255
  const records = await app.sdk.list(table, findParams);
255
256
  if (records.length === 0) {
256
257
  throw new Error(`${singular} not found: ${id}`);
@@ -280,6 +281,7 @@ export function buildDevCmd(name, table, aliases, defaultColumns, wrap, opts = {
280
281
  const findParams = new URLSearchParams();
281
282
  findParams.set('sysparm_query', `${queryField}=${id}`);
282
283
  findParams.set('sysparm_limit', '1');
284
+ findParams.set('sysparm_display_value', 'all');
283
285
  const records = await app.sdk.list(table, findParams);
284
286
  if (records.length === 0) {
285
287
  throw new Error(`${singular} not found: ${id}`);
@@ -13,7 +13,7 @@ export function flowsCmd(wrap) {
13
13
  describe: 'List flows',
14
14
  builder: (y) => y
15
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")' })
16
+ .option('columns', { alias: ['c', 'fields'], 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'];
@@ -13,7 +13,7 @@ export function logsCmd(wrap) {
13
13
  describe: 'List system logs',
14
14
  builder: (y) => y
15
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")' })
16
+ .option('columns', { alias: ['c', 'fields'], 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'];
@@ -13,7 +13,7 @@ export function scopesCmd(wrap) {
13
13
  describe: 'List application scopes',
14
14
  builder: (y) => y
15
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")' })
16
+ .option('columns', { alias: ['c', 'fields'], 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'];
@@ -13,7 +13,7 @@ export function updateSetsCmd(wrap) {
13
13
  describe: 'List update sets',
14
14
  builder: (y) => y
15
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")' })
16
+ .option('columns', { alias: ['c', 'fields'], 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'];
@@ -13,7 +13,7 @@ export function groupMembersCmd(wrap) {
13
13
  describe: 'List group members',
14
14
  builder: (y) => y
15
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")' })
16
+ .option('columns', { alias: ['c', 'fields'], 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'];
@@ -13,7 +13,7 @@ export function groupRolesCmd(wrap) {
13
13
  describe: 'List group roles',
14
14
  builder: (y) => y
15
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")' })
16
+ .option('columns', { alias: ['c', 'fields'], 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'];
@@ -13,7 +13,7 @@ export function groupsCmd(wrap) {
13
13
  describe: 'List groups',
14
14
  builder: (y) => y
15
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")' })
16
+ .option('columns', { alias: ['c', 'fields'], 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'];
@@ -32,7 +32,7 @@ export function recordsCmd(wrap) {
32
32
  .option('table', { type: 'string', demandOption: true, describe: 'Table name' })
33
33
  .option('sys-id', { type: 'string', describe: 'Record sys_id (filters to a single record)' })
34
34
  .option('query', { type: 'string', describe: 'Encoded query (e.g. "nameLIKEincident" or "active=true")' })
35
- .option('columns', { alias: 'c', type: 'string', describe: 'Comma-separated columns (e.g. "number,short_description")' })
35
+ .option('columns', { alias: ['c', 'fields'], type: 'string', describe: 'Comma-separated columns (e.g. "number,short_description")' })
36
36
  .option('limit', { type: 'number', default: 20, describe: 'Max records' })
37
37
  .option('offset', { type: 'number', default: 0, describe: 'Offset' }),
38
38
  handler: wrap(async (argv, app) => {
@@ -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('columns', { type: 'string', describe: 'Comma-separated columns (e.g. "number,short_description")' }),
115
+ .option('columns', { alias: ['c', 'fields'], type: 'string', describe: 'Comma-separated columns (e.g. "number,short_description")' }),
116
116
  handler: wrap(async (argv, app) => {
117
117
  const params = new URLSearchParams();
118
118
  params.set('sysparm_query', `sys_id=${argv['sys-id']}`);
@@ -13,7 +13,7 @@ export function ticketsCmd(wrap) {
13
13
  describe: 'List tickets',
14
14
  builder: (y) => y
15
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")' })
16
+ .option('columns', { alias: ['c', 'fields'], 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) => {
@@ -13,7 +13,7 @@ export function usersCmd(wrap) {
13
13
  describe: 'List users',
14
14
  builder: (y) => y
15
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")' })
16
+ .option('columns', { alias: ['c', 'fields'], 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'];