lansenger-cli 1.0.2 → 1.0.3

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.
@@ -12,8 +12,8 @@ function registerGroupCommands(program) {
12
12
  .option("--owner <ownerId>", "Owner staff ID", "")
13
13
  .option("-d, --desc <desc>", "Group description", "")
14
14
  .option("--avatar <avatarId>", "Avatar ID", "")
15
- .option("--staff <ids...>", "Staff IDs to add, space-separated")
16
- .option("--dept <ids...>", "Department IDs to add, space-separated")
15
+ .option("--staff <ids>", "Staff IDs to add, comma-separated")
16
+ .option("--dept <ids>", "Department IDs to add, comma-separated")
17
17
  .option("--user-token <token>", "User token", "")
18
18
  .action(async (name, orgId, opts) => {
19
19
  const client = (0, utils_1.getClient)();
@@ -21,8 +21,8 @@ function registerGroupCommands(program) {
21
21
  owner_id: opts.owner || undefined,
22
22
  description: opts.desc || undefined,
23
23
  avatar_id: opts.avatar || undefined,
24
- staff_id_list: opts.staff || undefined,
25
- department_id_list: opts.dept || undefined,
24
+ staff_id_list: opts.staff ? (0, utils_1.commaList)(opts.staff) : undefined,
25
+ department_id_list: opts.dept ? (0, utils_1.commaList)(opts.dept) : undefined,
26
26
  user_token: opts.userToken || undefined,
27
27
  });
28
28
  (0, utils_1.checkError)(result);
@@ -110,16 +110,16 @@ function registerGroupCommands(program) {
110
110
  .command("update-members")
111
111
  .description("Add or remove group members")
112
112
  .argument("<groupId>", "Group ID")
113
- .option("--add <ids...>", "Staff IDs to add, space-separated")
114
- .option("--remove <ids...>", "Staff IDs to remove, space-separated")
115
- .option("--add-dept <ids...>", "Department IDs to add, space-separated")
113
+ .option("--add <ids>", "Staff IDs to add, comma-separated")
114
+ .option("--remove <ids>", "Staff IDs to remove, comma-separated")
115
+ .option("--add-dept <ids>", "Department IDs to add, comma-separated")
116
116
  .option("--user-token <token>", "User token", "")
117
117
  .action(async (groupId, opts) => {
118
118
  const client = (0, utils_1.getClient)();
119
119
  const result = await client.updateGroupMembers(groupId, {
120
- add_user_list: opts.add || undefined,
121
- del_user_list: opts.remove || undefined,
122
- add_department_id_list: opts.addDept || undefined,
120
+ add_user_list: opts.add ? (0, utils_1.commaList)(opts.add) : undefined,
121
+ del_user_list: opts.remove ? (0, utils_1.commaList)(opts.remove) : undefined,
122
+ add_department_id_list: opts.addDept ? (0, utils_1.commaList)(opts.addDept) : undefined,
123
123
  user_token: opts.userToken || undefined,
124
124
  });
125
125
  (0, utils_1.checkError)(result);
@@ -14,7 +14,7 @@ function registerMessageCommands(program) {
14
14
  .option("--cover-image <path>", "Cover image path for video attachments", "")
15
15
  .option("-g, --group", "Send as group message", false)
16
16
  .option("--mention-all", "@all in group", false)
17
- .option("--mention <ids...>", "User IDs to @mention (space-separated, e.g. --mention id1 id2)")
17
+ .option("--mention <ids>", "User IDs to @mention (comma-separated, e.g. --mention id1,id2)")
18
18
  .option("--user-token <token>", "User token for private channel", "")
19
19
  .option("--sender-id <senderId>", "Sender staff ID for group message", "")
20
20
  .action(async (chatId, content, opts) => {
@@ -25,7 +25,7 @@ function registerMessageCommands(program) {
25
25
  cover_image_path: opts.coverImage || undefined,
26
26
  is_group: opts.group,
27
27
  reminder_all: opts.mentionAll,
28
- reminder_user_ids: opts.mention || undefined,
28
+ reminder_user_ids: opts.mention ? (0, utils_1.commaList)(opts.mention) : undefined,
29
29
  user_token: opts.userToken || undefined,
30
30
  sender_id: opts.senderId || undefined,
31
31
  });
@@ -38,7 +38,7 @@ function registerMessageCommands(program) {
38
38
  .argument("<chatId>", "Chat ID")
39
39
  .argument("<content>", "Markdown content")
40
40
  .option("--mention-all", "@all in group", false)
41
- .option("--mention <ids...>", "User IDs to @mention (space-separated, e.g. --mention id1 id2)")
41
+ .option("--mention <ids>", "User IDs to @mention (comma-separated, e.g. --mention id1,id2)")
42
42
  .option("-g, --group", "Send as group message", false)
43
43
  .option("--user-token <token>", "User token for private channel", "")
44
44
  .option("--sender-id <senderId>", "Sender staff ID for group message", "")
@@ -46,7 +46,7 @@ function registerMessageCommands(program) {
46
46
  const client = (0, utils_1.getClient)();
47
47
  const result = await client.sendMarkdown(chatId, content, {
48
48
  reminder_all: opts.mentionAll,
49
- reminder_user_ids: opts.mention || undefined,
49
+ reminder_user_ids: opts.mention ? (0, utils_1.commaList)(opts.mention) : undefined,
50
50
  is_group: opts.group,
51
51
  user_token: opts.userToken || undefined,
52
52
  sender_id: opts.senderId || undefined,
@@ -165,8 +165,8 @@ function registerMessageCommands(program) {
165
165
  .option("--head-icon <url>", "Head icon URL", "")
166
166
  .option("--status-desc <desc>", "Head status description (div-style HTML, max 30 bytes)", "")
167
167
  .option("--status-colour <colour>", "Head status DOT colour (hex, e.g. #FFB116)", "")
168
- .option("--field <json...>", "Card field as JSON, space-separated, e.g. --field '{\"key\":\"k\",\"value\":\"v\"}' '{\"key\":\"k2\",\"value\":\"v2\"}'")
169
- .option("--link <json...>", "Card link as JSON, space-separated, e.g. --link '{\"title\":\"T\",\"url\":\"U\"}' '{\"title\":\"T2\",\"url\":\"U2\"}'")
168
+ .option("--field <json>", "Card fields as JSON array, e.g. --field '[{\"key\":\"k\",\"value\":\"v\"},{\"key\":\"k2\",\"value\":\"v2\"}]'")
169
+ .option("--link <json>", "Card links as JSON array, e.g. --link '[{\"title\":\"T\",\"url\":\"U\"},{\"title\":\"T2\",\"url\":\"U2\"}]'")
170
170
  .option("-g, --group", "Send as group message", false)
171
171
  .option("--user-token <token>", "User token for private channel", "")
172
172
  .option("--sender-id <senderId>", "Sender staff ID for group message", "")
@@ -179,8 +179,8 @@ function registerMessageCommands(program) {
179
179
  colour: opts.statusColour || "",
180
180
  };
181
181
  }
182
- const parsedFields = opts.field ? opts.field.map((f) => (0, utils_1.parseJsonOption)(f)) : undefined;
183
- const parsedLinks = opts.link ? opts.link.map((l) => (0, utils_1.parseJsonOption)(l)) : undefined;
182
+ const parsedFields = opts.field ? (0, utils_1.parseJsonOption)(opts.field) : undefined;
183
+ const parsedLinks = opts.link ? (0, utils_1.parseJsonOption)(opts.link) : undefined;
184
184
  const result = await client.sendAppCard(chatId, bodyTitle, {
185
185
  head_title: opts.headTitle || undefined,
186
186
  body_sub_title: opts.subTitle || undefined,
@@ -209,7 +209,7 @@ function registerMessageCommands(program) {
209
209
  .option("--last", "Mark as last update", false)
210
210
  .option("--status-desc <desc>", "New status description (div-style HTML, max 30 bytes)", "")
211
211
  .option("--status-colour <colour>", "New status DOT colour (hex)", "")
212
- .option("--link <json...>", "Updated link as JSON, space-separated")
212
+ .option("--link <json>", "Updated links as JSON array")
213
213
  .action(async (msgId, opts) => {
214
214
  const client = (0, utils_1.getClient)();
215
215
  let headStatusInfo = undefined;
@@ -219,7 +219,7 @@ function registerMessageCommands(program) {
219
219
  colour: opts.statusColour || "",
220
220
  };
221
221
  }
222
- const parsedLinks = opts.link ? opts.link.map((l) => (0, utils_1.parseJsonOption)(l)) : undefined;
222
+ const parsedLinks = opts.link ? (0, utils_1.parseJsonOption)(opts.link) : undefined;
223
223
  const result = await client.updateDynamicCard(msgId, {
224
224
  is_last_update: opts.last,
225
225
  head_status_info: headStatusInfo,
@@ -248,15 +248,15 @@ function registerMessageCommands(program) {
248
248
  .description("Send a bot notification message")
249
249
  .argument("<msgType>", "Message type")
250
250
  .argument("<msgData>", "Message data as JSON")
251
- .option("--chat-id <ids...>", "Chat IDs, space-separated (or group IDs if --group)")
252
- .option("--dept <ids...>", "Department IDs, space-separated (bot channel only)")
251
+ .option("--chat-id <ids>", "Chat IDs, comma-separated (or group IDs if --group)")
252
+ .option("--dept <ids>", "Department IDs, comma-separated (bot channel only)")
253
253
  .option("--user-token <token>", "User token", "")
254
254
  .option("--entry-id <entryId>", "App entry selector", "")
255
255
  .option("-g, --group", "Send to groups instead of users", false)
256
256
  .action(async (msgType, msgData, opts) => {
257
257
  const client = (0, utils_1.getClient)();
258
258
  const parsedData = (0, utils_1.parseJsonOption)(msgData);
259
- const result = await client.sendBotMessage(msgType, parsedData, opts.chatId || undefined, opts.dept || undefined, {
259
+ const result = await client.sendBotMessage(msgType, parsedData, opts.chatId ? (0, utils_1.commaList)(opts.chatId) : undefined, opts.dept ? (0, utils_1.commaList)(opts.dept) : undefined, {
260
260
  user_token: opts.userToken || undefined,
261
261
  entry_id: opts.entryId || undefined,
262
262
  is_group: opts.group,
@@ -273,7 +273,7 @@ function registerMessageCommands(program) {
273
273
  .option("--user-token <token>", "User token", "")
274
274
  .option("--sender-id <senderId>", "Sender staff ID", "")
275
275
  .option("--mention-all", "@all (text/formatText only)", false)
276
- .option("--mention <ids...>", "User IDs to @mention, space-separated (text/formatText only)")
276
+ .option("--mention <ids>", "User IDs to @mention (comma-separated, text/formatText only)")
277
277
  .option("--outlines <outlines>", "Group notification digest", "")
278
278
  .option("--entry-id <entryId>", "App entry selector", "")
279
279
  .action(async (groupId, msgType, msgData, opts) => {
@@ -283,7 +283,7 @@ function registerMessageCommands(program) {
283
283
  user_token: opts.userToken || undefined,
284
284
  sender_id: opts.senderId || undefined,
285
285
  reminder_all: opts.mentionAll,
286
- reminder_user_ids: opts.mention || undefined,
286
+ reminder_user_ids: opts.mention ? (0, utils_1.commaList)(opts.mention) : undefined,
287
287
  outlines: opts.outlines || undefined,
288
288
  entry_id: opts.entryId || undefined,
289
289
  });
@@ -312,7 +312,7 @@ function registerMessageCommands(program) {
312
312
  .option("--head <head>", "OA card head title", "")
313
313
  .option("--sub-title <sub>", "OA card sub title", "")
314
314
  .option("--staff-id <id>", "Staff ID", "")
315
- .option("--field <json...>", "Card field as JSON, space-separated, e.g. --field '{\"key\":\"k\",\"value\":\"v\"}'")
315
+ .option("--field <json>", "Card fields as JSON array, e.g. --field '[{\"key\":\"k\",\"value\":\"v\"}]'")
316
316
  .option("--link <url>", "Card click link URL", "")
317
317
  .option("--pc-link <url>", "PC link URL", "")
318
318
  .option("--pad-link <url>", "Pad link URL", "")
@@ -322,7 +322,7 @@ function registerMessageCommands(program) {
322
322
  .option("--sender-id <senderId>", "Sender staff ID for group message", "")
323
323
  .action(async (chatId, title, opts) => {
324
324
  const client = (0, utils_1.getClient)();
325
- const parsedFields = opts.field ? opts.field.map((f) => (0, utils_1.parseJsonOption)(f)) : undefined;
325
+ const parsedFields = opts.field ? (0, utils_1.parseJsonOption)(opts.field) : undefined;
326
326
  const parsedAction = opts.cardAction ? (0, utils_1.parseJsonOption)(opts.cardAction) : undefined;
327
327
  const result = await client.sendOacard(chatId, title, {
328
328
  head: opts.head || undefined,
@@ -345,8 +345,8 @@ function registerMessageCommands(program) {
345
345
  .description("Send a public account message")
346
346
  .argument("<msgType>", "Message type")
347
347
  .argument("<msgData>", "Message data as JSON")
348
- .option("--chat-id <ids...>", "Chat IDs, space-separated")
349
- .option("--dept <ids...>", "Department IDs, space-separated")
348
+ .option("--chat-id <ids>", "Chat IDs, comma-separated")
349
+ .option("--dept <ids>", "Department IDs, comma-separated")
350
350
  .option("--account-id <id>", "Account ID", "")
351
351
  .option("--entry-id <entryId>", "App entry selector", "")
352
352
  .option("--attach <attach>", "Attach info", "")
@@ -354,7 +354,7 @@ function registerMessageCommands(program) {
354
354
  .action(async (msgType, msgData, opts) => {
355
355
  const client = (0, utils_1.getClient)();
356
356
  const parsedData = (0, utils_1.parseJsonOption)(msgData);
357
- const result = await client.sendAccountMessage(msgType, parsedData, opts.chatId || undefined, opts.dept || undefined, {
357
+ const result = await client.sendAccountMessage(msgType, parsedData, opts.chatId ? (0, utils_1.commaList)(opts.chatId) : undefined, opts.dept ? (0, utils_1.commaList)(opts.dept) : undefined, {
358
358
  account_id: opts.accountId || undefined,
359
359
  entry_id: opts.entryId || undefined,
360
360
  attach: opts.attach || undefined,
@@ -73,8 +73,8 @@ function registerStaffCommands(program) {
73
73
  .argument("<keyword>", "Search keyword")
74
74
  .option("--user-token <token>", "User token", "")
75
75
  .option("--user-id <userId>", "User ID context", "")
76
- .option("--recursive/--no-recursive", "Recursive search", true)
77
- .option("--sector <ids...>", "Sector IDs, space-separated")
76
+ .option("--recursive", "Recursive search", true)
77
+ .option("--sector <ids>", "Sector IDs, comma-separated")
78
78
  .option("-p, --page <page>", "Page number")
79
79
  .option("-s, --size <size>", "Page size")
80
80
  .action(async (keyword, opts) => {
@@ -83,7 +83,7 @@ function registerStaffCommands(program) {
83
83
  user_token: opts.userToken || undefined,
84
84
  user_id: opts.userId || undefined,
85
85
  recursive: opts.recursive,
86
- sector_ids: opts.sector || undefined,
86
+ sector_ids: opts.sector ? (0, utils_1.commaList)(opts.sector) : undefined,
87
87
  page: opts.page ? parseInt(opts.page) : undefined,
88
88
  page_size: opts.size ? parseInt(opts.size) : undefined,
89
89
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lansenger-cli",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "CLI for Lansenger (蓝信) — send messages, manage groups, staff, departments, calendars, todos, and more",
5
5
  "main": "dist/main.js",
6
6
  "bin": {