@jinshuju/cli 0.16.0 → 0.17.0

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/README.md CHANGED
@@ -256,6 +256,7 @@ jinshuju checkin create --form Kp7mQ2 # needs the check-in plugin en
256
256
  jinshuju checkin edit 42 --disable
257
257
  jinshuju notification create --form Kp7mQ2 --approach SMS --recipients field_2 --sms-template 6650a1 --placeholders field_1
258
258
  jinshuju notification list --form Kp7mQ2 # each rule says whether it can send, and why not
259
+ jinshuju notification log 6650b2 --form Kp7mQ2 --from 2026-10-01 # what the rule sent: how many succeeded, failed, and why
259
260
  ```
260
261
 
261
262
  Deletion always requires `--yes`. This CLI is non-interactive — stdin belongs to
@@ -507,7 +508,7 @@ sent again with `sms task resend` to the entries that got a result.
507
508
  ```bash
508
509
  jinshuju sms send --form Kp7mQ2 --field field_2 --template-id 6512a1c2d3e4f5a6b7c8d9e0 --filter 'field_5 eq 已报名' --estimate
509
510
  jinshuju sms send --form Kp7mQ2 --field field_2 --template-id 6512a1c2d3e4f5a6b7c8d9e0 --filter 'field_5 eq 已报名' --yes
510
- jinshuju sms task list --form Kp7mQ2
511
+ jinshuju sms task list --form Kp7mQ2 --from 2026-10-01 # each task with how many numbers succeeded or failed
511
512
  jinshuju sms task activities 6716f2a8c1d2e3f4a5b6c7d9 --form Kp7mQ2 --status FAILED
512
513
  jinshuju sms task resend 6716f2a8c1d2e3f4a5b6c7d9 --form Kp7mQ2 --status FAILED --yes
513
514
  jinshuju email smtp-account list
@@ -1,6 +1,6 @@
1
1
  import { PAGINATION_OPTIONS } from '../options.js';
2
2
  import { bodyChoices, call, choices } from '../spec.js';
3
- import { ESTIMATE_OPTION, estimating, FORM_OPTION, given, LISTING, NARROWING_OPTIONS, narrowingBody, narrowingQuery, paging, requiredOption, SELECT_ALL_OPTION, selectAll, SEND_OPTION } from './shared.js';
3
+ import { DAY_RANGE_OPTIONS, dayRange, ESTIMATE_OPTION, estimating, FORM_OPTION, given, LISTING, NARROWING_OPTIONS, narrowingBody, narrowingQuery, paging, requiredOption, SELECT_ALL_OPTION, selectAll, SEND_OPTION } from './shared.js';
4
4
  const SMTP_ACCOUNT_OPTION = {
5
5
  name: '--smtp-account-id',
6
6
  type: 'string',
@@ -62,8 +62,8 @@ export const EMAIL = [
62
62
  },
63
63
  {
64
64
  path: ['email', 'task', 'list'],
65
- summary: "List a form's email tasks, newest first",
66
- description: 'Without how many addresses succeeded or failed: `email task get` has those.',
65
+ summary: "List a form's email tasks, newest first, with how many addresses succeeded or failed so far",
66
+ description: '--from and --to pick the tasks by the day they were created. A page holds at most 100 tasks.',
67
67
  options: [
68
68
  FORM_OPTION,
69
69
  {
@@ -73,14 +73,15 @@ export const EMAIL = [
73
73
  placeholder: '<status>',
74
74
  description: 'Only the tasks in this status'
75
75
  },
76
+ ...DAY_RANGE_OPTIONS,
76
77
  ...PAGINATION_OPTIONS
77
78
  ],
78
79
  request: (input) => call('listEmailTasks', {
79
80
  path: { form_token: requiredOption(input, 'form') },
80
- query: { status: input.options.status, ...paging(input) }
81
+ query: { status: input.options.status, ...dayRange(input), ...paging(input) }
81
82
  }),
82
83
  paginate: LISTING,
83
- examples: ['jinshuju email task list --form Kp7mQ2']
84
+ examples: ['jinshuju email task list --form Kp7mQ2', 'jinshuju email task list --form Kp7mQ2 --from 2026-10-01']
84
85
  },
85
86
  {
86
87
  path: ['email', 'task', 'get'],
@@ -1,6 +1,6 @@
1
- import { JSON_OPTION, UsageError } from '../options.js';
2
- import { bodyChoices, call } from '../spec.js';
3
- import { YES_OPTION, confirmed, overriding, requiredOption } from './shared.js';
1
+ import { JSON_OPTION, PAGINATION_OPTIONS, UsageError } from '../options.js';
2
+ import { bodyChoices, call, choices } from '../spec.js';
3
+ import { DAY_RANGE_OPTIONS, LISTING, YES_OPTION, confirmed, dayRange, overriding, paging, requiredOption } from './shared.js';
4
4
  const RULE_ARG = { name: 'rule', required: true, description: 'Notification rule id' };
5
5
  const FORM_OPTION = { name: '--form', type: 'string', placeholder: '<token>', description: 'Form token' };
6
6
  /** What `notification create` and `notification edit` both take. */
@@ -131,5 +131,33 @@ export const NOTIFICATION = [
131
131
  path: { form_token: requiredOption(input, 'form'), id: input.args.rule }
132
132
  });
133
133
  }
134
+ },
135
+ {
136
+ path: ['notification', 'log'],
137
+ summary: 'List what a notification rule sent, with how many succeeded or failed and why',
138
+ description: 'Covers the last 180 days, as the notification log page does; notifications scheduled for later are not listed. ' +
139
+ '--from and --to pick them by the day they were sent. The summary counts every match, not just the page.',
140
+ args: [RULE_ARG],
141
+ options: [
142
+ FORM_OPTION,
143
+ {
144
+ name: '--status',
145
+ type: 'string',
146
+ choices: choices('listNotificationRuleNotifications', 'status'),
147
+ placeholder: '<status>',
148
+ description: 'Only the notifications in this status, e.g. FAILED'
149
+ },
150
+ ...DAY_RANGE_OPTIONS,
151
+ ...PAGINATION_OPTIONS
152
+ ],
153
+ request: (input) => call('listNotificationRuleNotifications', {
154
+ path: { form_token: requiredOption(input, 'form'), id: input.args.rule },
155
+ query: { status: input.options.status, ...dayRange(input), ...paging(input) }
156
+ }),
157
+ paginate: LISTING,
158
+ examples: [
159
+ 'jinshuju notification log 6650b2 --form Kp7mQ2',
160
+ 'jinshuju notification log 6650b2 --form Kp7mQ2 --status FAILED --from 2026-10-01 --to 2026-10-31'
161
+ ]
134
162
  }
135
163
  ];
@@ -18,6 +18,12 @@ export declare function paging(input: CommandInput): {
18
18
  limit?: number;
19
19
  next?: string;
20
20
  };
21
+ /** A range of days, Asia/Shanghai; either end can be left open. */
22
+ export declare const DAY_RANGE_OPTIONS: readonly OptionSpec[];
23
+ export declare function dayRange(input: CommandInput): {
24
+ start_date?: string;
25
+ end_date?: string;
26
+ };
21
27
  /** The sort rules as the API's own objects, for a body. */
22
28
  export declare function sortRules(input: CommandInput): {
23
29
  api_code: string;
@@ -42,6 +42,14 @@ export function sort(input, key) {
42
42
  export function paging(input) {
43
43
  return { limit: input.options.limit, next: input.options.next };
44
44
  }
45
+ /** A range of days, Asia/Shanghai; either end can be left open. */
46
+ export const DAY_RANGE_OPTIONS = [
47
+ { name: '--from', type: 'string', placeholder: '<YYYY-MM-DD>', description: 'First day, Asia/Shanghai' },
48
+ { name: '--to', type: 'string', placeholder: '<YYYY-MM-DD>', description: 'Last day, inclusive' }
49
+ ];
50
+ export function dayRange(input) {
51
+ return { start_date: input.options.from, end_date: input.options.to };
52
+ }
45
53
  /** The sort rules as the API's own objects, for a body. */
46
54
  export function sortRules(input) {
47
55
  const rules = input.options.sort ?? [];
@@ -1,7 +1,7 @@
1
1
  import { PAGINATION_OPTIONS, UsageError } from '../options.js';
2
2
  import { progress } from '../progress.js';
3
3
  import { bodyChoices, call, choices } from '../spec.js';
4
- import { confirmed, ESTIMATE_OPTION, estimating, FORM_OPTION, given, LISTING, NARROWING_OPTIONS, narrowingBody, narrowingQuery, paging, requiredOption as required, SELECT_ALL_OPTION, selectAll, SEND_OPTION, sendingConfirmed, YES_OPTION } from './shared.js';
4
+ import { confirmed, DAY_RANGE_OPTIONS, dayRange, ESTIMATE_OPTION, estimating, FORM_OPTION, given, LISTING, NARROWING_OPTIONS, narrowingBody, narrowingQuery, paging, requiredOption as required, SELECT_ALL_OPTION, selectAll, SEND_OPTION, sendingConfirmed, YES_OPTION } from './shared.js';
5
5
  import { upload } from './upload.js';
6
6
  import { basename } from 'node:path';
7
7
  /**
@@ -431,8 +431,8 @@ export const SMS = [
431
431
  },
432
432
  {
433
433
  path: ['sms', 'task', 'list'],
434
- summary: "List a form's SMS tasks, newest first",
435
- description: 'Without how many numbers succeeded or failed: `sms task get` has those.',
434
+ summary: "List a form's SMS tasks, newest first, with how many numbers succeeded or failed so far",
435
+ description: '--from and --to pick the tasks by the day they were created. A page holds at most 100 tasks.',
436
436
  options: [
437
437
  FORM_OPTION,
438
438
  {
@@ -442,14 +442,19 @@ export const SMS = [
442
442
  placeholder: '<status>',
443
443
  description: 'Only the tasks in this status'
444
444
  },
445
+ ...DAY_RANGE_OPTIONS,
445
446
  ...PAGINATION_OPTIONS
446
447
  ],
447
448
  request: (input) => call('listSmsTasks', {
448
449
  path: { form_token: required(input, 'form') },
449
- query: { status: input.options.status, ...paging(input) }
450
+ query: { status: input.options.status, ...dayRange(input), ...paging(input) }
450
451
  }),
451
452
  paginate: LISTING,
452
- examples: ['jinshuju sms task list --form Kp7mQ2', 'jinshuju sms task list --form Kp7mQ2 --status template_fail']
453
+ examples: [
454
+ 'jinshuju sms task list --form Kp7mQ2',
455
+ 'jinshuju sms task list --form Kp7mQ2 --status template_fail',
456
+ 'jinshuju sms task list --form Kp7mQ2 --from 2026-10-01 --to 2026-10-31'
457
+ ]
453
458
  },
454
459
  {
455
460
  path: ['sms', 'task', 'get'],
@@ -1,7 +1,7 @@
1
1
  import type { Operation, Schema } from '../spec.js';
2
2
  /** The path every operation's path is relative to, from `servers`. */
3
3
  export declare const BASE_PATH = "/api/v1";
4
- export type OperationId = 'aggregateEntries' | 'aggregateFormViewEntries' | 'aggregateTableEntries' | 'aggregateTableViewEntries' | 'aggregateTradeTransactions' | 'checkFormFieldData' | 'checkTableFieldData' | 'copyForm' | 'countEntries' | 'countEntriesAcrossForms' | 'countFormViewEntries' | 'countTableEntries' | 'countTableViewEntries' | 'createCheckinCampaign' | 'createEmailTask' | 'createEntriesBatch' | 'createEntry' | 'createEntryComment' | 'createEntryImport' | 'createEntryLegacy' | 'createFillFormEntry' | 'createFillViewEntry' | 'createFolder' | 'createForm' | 'createFormView' | 'createFormWebhook' | 'createNotificationRule' | 'createOpensearchQuery' | 'createPredefinedChoicesSet' | 'createRoutine' | 'createSmsSignature' | 'createSmsTask' | 'createSmsTemplate' | 'createTable' | 'createTableEntry' | 'createTableEntryComment' | 'createTableView' | 'createTemplateUsage' | 'createWeixinOauthSession' | 'deleteCheckinCampaign' | 'deleteEntry' | 'deleteEntryComment' | 'deleteForm' | 'deleteFormView' | 'deleteFormWebhook' | 'deleteNotificationRule' | 'deletePredefinedChoicesSet' | 'deleteRoutine' | 'deleteSmsSignature' | 'deleteSmsTemplate' | 'deleteTable' | 'deleteTableEntry' | 'deleteTableEntryComment' | 'deleteTableView' | 'estimateEmailTask' | 'estimateEmailTaskResend' | 'estimateSmsTask' | 'estimateSmsTaskChange' | 'estimateSmsTaskResend' | 'getBillingAccount' | 'getCheckinCampaign' | 'getCurrentUser' | 'getEmailTask' | 'getEntry' | 'getEntryImport' | 'getEntryStats' | 'getEvaluationSetting' | 'getExamSetting' | 'getFieldType' | 'getFillFormPage' | 'getFillViewPage' | 'getFolder' | 'getForm' | 'getFormSetting' | 'getFormView' | 'getManuallyCloseRule' | 'getNotificationRule' | 'getOpensearchQuery' | 'getRoutine' | 'getSmsTask' | 'getTable' | 'getTableEntry' | 'getTableView' | 'getTradeMerchant' | 'listBillingAccountInvoices' | 'listBillingAccountPaidFeatures' | 'listBillingAccountPaymentHistories' | 'listBillingAccountUsers' | 'listCheckinCampaigns' | 'listContacts' | 'listEmailTaskActivities' | 'listEmailTasks' | 'listEntries' | 'listEntryComments' | 'listExtendedAttributes' | 'listFieldRules' | 'listFieldTypes' | 'listFolders' | 'listFormCooperators' | 'listFormViewEntries' | 'listFormViews' | 'listForms' | 'listMyFilledForms' | 'listMySubmittedEntries' | 'listNotificationRules' | 'listOpensearchQueries' | 'listOpensearchQuerySuggestions' | 'listPredefinedChoicesSets' | 'listRoutineRuns' | 'listRoutines' | 'listSmsAuditStatuses' | 'listSmsSignatures' | 'listSmsTaskActivities' | 'listSmsTasks' | 'listSmsTemplates' | 'listSmtpAccounts' | 'listTableEntries' | 'listTableEntryComments' | 'listTableViewEntries' | 'listTableViews' | 'listTables' | 'listTradePayouts' | 'listTradeRefunds' | 'listTradeTransactions' | 'moveFormToFolder' | 'moveTableToFolder' | 'patchEntriesBatch' | 'pauseRoutine' | 'previewFormFieldTypeChange' | 'previewTableFieldTypeChange' | 'replaceEntry' | 'replaceTableEntry' | 'resendEmailTask' | 'resendSmsTask' | 'resumeRoutine' | 'runRoutine' | 'searchEntriesAcrossForms' | 'searchMySubmittedEntries' | 'sendSmsTask' | 'summarizeEntries' | 'summarizeFormViewEntries' | 'summarizeTableEntries' | 'summarizeTableViewEntries' | 'updateAccessPolicy' | 'updateCheckinCampaign' | 'updateEntry' | 'updateEntryComment' | 'updateEntryViaPost' | 'updateEvaluationSetting' | 'updateExamSetting' | 'updateForm' | 'updateFormSetting' | 'updateFormTheme' | 'updateFormView' | 'updateManuallyCloseRule' | 'updateNotificationRule' | 'updateOpensearchQuery' | 'updatePredefinedChoicesSet' | 'updateRoutine' | 'updateSmsSignature' | 'updateSmsTask' | 'updateSmsTemplate' | 'updateTable' | 'updateTableEntry' | 'updateTableEntryComment' | 'updateTableEntryViaPost' | 'updateTableView' | 'uploadEntryAttachment' | 'uploadFormImage' | 'uploadImportFile' | 'uploadUserLicenseAttachment' | 'verifyRedirectParams';
4
+ export type OperationId = 'aggregateEntries' | 'aggregateFormViewEntries' | 'aggregateTableEntries' | 'aggregateTableViewEntries' | 'aggregateTradeTransactions' | 'checkFormFieldData' | 'checkTableFieldData' | 'copyForm' | 'countEntries' | 'countEntriesAcrossForms' | 'countFormViewEntries' | 'countTableEntries' | 'countTableViewEntries' | 'createCheckinCampaign' | 'createEmailTask' | 'createEntriesBatch' | 'createEntry' | 'createEntryComment' | 'createEntryImport' | 'createEntryLegacy' | 'createFillFormEntry' | 'createFillViewEntry' | 'createFolder' | 'createForm' | 'createFormView' | 'createFormWebhook' | 'createNotificationRule' | 'createOpensearchQuery' | 'createPredefinedChoicesSet' | 'createRoutine' | 'createSmsSignature' | 'createSmsTask' | 'createSmsTemplate' | 'createTable' | 'createTableEntry' | 'createTableEntryComment' | 'createTableView' | 'createTemplateUsage' | 'createWeixinOauthSession' | 'deleteCheckinCampaign' | 'deleteEntry' | 'deleteEntryComment' | 'deleteForm' | 'deleteFormView' | 'deleteFormWebhook' | 'deleteNotificationRule' | 'deletePredefinedChoicesSet' | 'deleteRoutine' | 'deleteSmsSignature' | 'deleteSmsTemplate' | 'deleteTable' | 'deleteTableEntry' | 'deleteTableEntryComment' | 'deleteTableView' | 'estimateEmailTask' | 'estimateEmailTaskResend' | 'estimateSmsTask' | 'estimateSmsTaskChange' | 'estimateSmsTaskResend' | 'getBillingAccount' | 'getCheckinCampaign' | 'getCurrentUser' | 'getEmailTask' | 'getEntry' | 'getEntryImport' | 'getEntryStats' | 'getEvaluationSetting' | 'getExamSetting' | 'getFieldType' | 'getFillFormPage' | 'getFillViewPage' | 'getFolder' | 'getForm' | 'getFormSetting' | 'getFormView' | 'getManuallyCloseRule' | 'getNotificationRule' | 'getOpensearchQuery' | 'getRoutine' | 'getSmsTask' | 'getTable' | 'getTableEntry' | 'getTableView' | 'getTradeMerchant' | 'listBillingAccountInvoices' | 'listBillingAccountPaidFeatures' | 'listBillingAccountPaymentHistories' | 'listBillingAccountUsers' | 'listCheckinCampaigns' | 'listContacts' | 'listEmailTaskActivities' | 'listEmailTasks' | 'listEntries' | 'listEntryComments' | 'listExtendedAttributes' | 'listFieldRules' | 'listFieldTypes' | 'listFolders' | 'listFormCooperators' | 'listFormViewEntries' | 'listFormViews' | 'listForms' | 'listMyFilledForms' | 'listMySubmittedEntries' | 'listNotificationRuleNotifications' | 'listNotificationRules' | 'listOpensearchQueries' | 'listOpensearchQuerySuggestions' | 'listPredefinedChoicesSets' | 'listRoutineRuns' | 'listRoutines' | 'listSmsAuditStatuses' | 'listSmsSignatures' | 'listSmsTaskActivities' | 'listSmsTasks' | 'listSmsTemplates' | 'listSmtpAccounts' | 'listTableEntries' | 'listTableEntryComments' | 'listTableViewEntries' | 'listTableViews' | 'listTables' | 'listTradePayouts' | 'listTradeRefunds' | 'listTradeTransactions' | 'moveFormToFolder' | 'moveTableToFolder' | 'patchEntriesBatch' | 'pauseRoutine' | 'previewFormFieldTypeChange' | 'previewTableFieldTypeChange' | 'replaceEntry' | 'replaceTableEntry' | 'resendEmailTask' | 'resendSmsTask' | 'resumeRoutine' | 'runRoutine' | 'searchEntriesAcrossForms' | 'searchMySubmittedEntries' | 'sendSmsTask' | 'summarizeEntries' | 'summarizeFormViewEntries' | 'summarizeTableEntries' | 'summarizeTableViewEntries' | 'updateAccessPolicy' | 'updateCheckinCampaign' | 'updateEntry' | 'updateEntryComment' | 'updateEntryViaPost' | 'updateEvaluationSetting' | 'updateExamSetting' | 'updateForm' | 'updateFormSetting' | 'updateFormTheme' | 'updateFormView' | 'updateManuallyCloseRule' | 'updateNotificationRule' | 'updateOpensearchQuery' | 'updatePredefinedChoicesSet' | 'updateRoutine' | 'updateSmsSignature' | 'updateSmsTask' | 'updateSmsTemplate' | 'updateTable' | 'updateTableEntry' | 'updateTableEntryComment' | 'updateTableEntryViaPost' | 'updateTableView' | 'uploadEntryAttachment' | 'uploadFormImage' | 'uploadImportFile' | 'uploadUserLicenseAttachment' | 'verifyRedirectParams';
5
5
  export declare const OPERATIONS: {
6
6
  readonly [id in OperationId]: Operation;
7
7
  };
@@ -868,7 +868,9 @@ export const OPERATIONS = {
868
868
  in: 'query',
869
869
  schema: { type: 'string', enum: ['waiting_for_send', 'sending', 'all_sent', 'partial_sent', 'none_sent'] }
870
870
  },
871
- { name: 'limit', in: 'query', schema: { type: 'integer' } },
871
+ { name: 'start_date', in: 'query', schema: { type: 'string' } },
872
+ { name: 'end_date', in: 'query', schema: { type: 'string' } },
873
+ { name: 'limit', in: 'query', schema: { type: 'integer', minimum: 1, maximum: 100 } },
872
874
  { name: 'next', in: 'query', schema: { type: 'integer', minimum: 0 } },
873
875
  { name: 'skip', in: 'query', schema: { type: 'integer', minimum: 0, maximum: 10000 } }
874
876
  ]
@@ -998,6 +1000,27 @@ export const OPERATIONS = {
998
1000
  { name: 'skip', in: 'query', schema: { type: 'integer', minimum: 0, maximum: 10000 } }
999
1001
  ]
1000
1002
  },
1003
+ listNotificationRuleNotifications: {
1004
+ method: 'GET',
1005
+ path: '/forms/{form_token}/notification_rules/{id}/notifications',
1006
+ parameters: [
1007
+ { name: 'form_token', in: 'path', required: true, schema: { type: 'string' } },
1008
+ { name: 'id', in: 'path', required: true, schema: { type: 'string' } },
1009
+ { name: 'start_date', in: 'query', schema: { type: 'string' } },
1010
+ { name: 'end_date', in: 'query', schema: { type: 'string' } },
1011
+ {
1012
+ name: 'status',
1013
+ in: 'query',
1014
+ schema: {
1015
+ type: 'string',
1016
+ enum: ['SUCCESS', 'FAILED', 'WAITING', 'AUDITING', 'APPROVED', 'REJECTED', 'CANCELLED', 'REVOKED']
1017
+ }
1018
+ },
1019
+ { name: 'limit', in: 'query', schema: { type: 'integer', minimum: 1, maximum: 1000 } },
1020
+ { name: 'next', in: 'query', schema: { type: 'integer', minimum: 0 } },
1021
+ { name: 'skip', in: 'query', schema: { type: 'integer', minimum: 0, maximum: 10000 } }
1022
+ ]
1023
+ },
1001
1024
  listNotificationRules: {
1002
1025
  method: 'GET',
1003
1026
  path: '/forms/{form_token}/notification_rules',
@@ -1084,7 +1107,9 @@ export const OPERATIONS = {
1084
1107
  ]
1085
1108
  }
1086
1109
  },
1087
- { name: 'limit', in: 'query', schema: { type: 'integer' } },
1110
+ { name: 'start_date', in: 'query', schema: { type: 'string' } },
1111
+ { name: 'end_date', in: 'query', schema: { type: 'string' } },
1112
+ { name: 'limit', in: 'query', schema: { type: 'integer', minimum: 1, maximum: 100 } },
1088
1113
  { name: 'next', in: 'query', schema: { type: 'integer', minimum: 0 } },
1089
1114
  { name: 'skip', in: 'query', schema: { type: 'integer', minimum: 0, maximum: 10000 } }
1090
1115
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jinshuju/cli",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "Command line interface for Jinshuju Open API v1",
5
5
  "homepage": "https://github.com/jinshuju/cli#readme",
6
6
  "bugs": {