@jinshuju/cli 0.16.0 → 0.18.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
@@ -254,8 +254,9 @@ jinshuju comment create --form Kp7mQ2 --entry 12 "Contacted, awaiting reply"
254
254
  jinshuju opensearch edit Qy7nR3 --disable
255
255
  jinshuju checkin create --form Kp7mQ2 # needs the check-in plugin enabled for the account
256
256
  jinshuju checkin edit 42 --disable
257
- jinshuju notification create --form Kp7mQ2 --approach SMS --recipients field_2 --sms-template 6650a1 --placeholders field_1
257
+ jinshuju notification create --form Kp7mQ2 --approach SMS --recipients field_2 --template-id 6650a1 --placeholder 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
@@ -465,7 +466,9 @@ how much a type conversion would keep and how much it would clear.
465
466
  ## SMS signatures and templates
466
467
 
467
468
  An SMS notification needs a signature and a template, and both wait on a
468
- review, so submit them as early as you can. A template can go in while its
469
+ review, so submit them as early as you can. The materials a signature is
470
+ applied with replace your ID card information, and the account's business
471
+ license unless the account has passed license verification. A template can go in while its
469
472
  signature is still under review; `sms status` follows both, with the reason
470
473
  when one is rejected.
471
474
 
@@ -476,6 +479,9 @@ review, can be changed and sent back to review; only the flags given change. The
476
479
  same ones can be deleted with `--yes`; deleting a signature takes its templates
477
480
  with it.
478
481
 
482
+ While your own are under review, `sms template list --scope official` lists the official
483
+ templates, which are approved already and can be sent right away.
484
+
479
485
  ```bash
480
486
  jinshuju sms signature create 小金培训 --license ./license.jpg --company-name 小金培训有限公司 --company-id 91110000MA00000000 \
481
487
  --id-card-front ./front.jpg --id-card-back ./back.jpg --id-card-name 张三 --id-card-number 110101199001011234 --mobile 13800000000
@@ -483,6 +489,7 @@ jinshuju sms template create --signature 小金培训 --content "你报名的课
483
489
  jinshuju sms status
484
490
  jinshuju sms signature list --status FAIL
485
491
  jinshuju sms template list --keyword 开课 --scope owned
492
+ jinshuju sms template list --scope official
486
493
  jinshuju sms signature update 6512a1c2d3e4f5a6b7c8d9d3 --license ./license-clear.jpg
487
494
  jinshuju sms template update 6512a1c2d3e4f5a6b7c8d9e0 --content "你报名的课程后天上午 9 点开课。"
488
495
  jinshuju sms template delete 6512a1c2d3e4f5a6b7c8d9e0 --yes
@@ -507,13 +514,57 @@ sent again with `sms task resend` to the entries that got a result.
507
514
  ```bash
508
515
  jinshuju sms send --form Kp7mQ2 --field field_2 --template-id 6512a1c2d3e4f5a6b7c8d9e0 --filter 'field_5 eq 已报名' --estimate
509
516
  jinshuju sms send --form Kp7mQ2 --field field_2 --template-id 6512a1c2d3e4f5a6b7c8d9e0 --filter 'field_5 eq 已报名' --yes
510
- jinshuju sms task list --form Kp7mQ2
517
+ jinshuju sms task list --form Kp7mQ2 --from 2026-10-01 # each task with how many numbers succeeded or failed
511
518
  jinshuju sms task activities 6716f2a8c1d2e3f4a5b6c7d9 --form Kp7mQ2 --status FAILED
512
519
  jinshuju sms task resend 6716f2a8c1d2e3f4a5b6c7d9 --form Kp7mQ2 --status FAILED --yes
513
520
  jinshuju email smtp-account list
514
521
  jinshuju email send --form Kp7mQ2 --field field_3 --select-all --subject 上课提醒 --content '<p>明天上午 9 点开课</p>' --yes
515
522
  ```
516
523
 
524
+ ## Artifacts
525
+
526
+ An artifact is a file Jiri made for you; any of your conversations can revise
527
+ it. `artifact list` lists the ones Jiri made for you in the account you are in,
528
+ newest first, one row per artifact however many versions it has. Each row
529
+ carries `conversation_url`, the Jiri conversation that delivered its latest
530
+ version, and `audience`, who its link is open to (empty when it was never
531
+ shared). In `--output json` the first is `latest_version.conversation_url`,
532
+ beside `created_conversation_url` (where the artifact was made) and
533
+ `latest_version.download_url`; the second is
534
+ `published_artifact.allowed_audience`, beside the version the link shows
535
+ (`published_version`). The link itself comes from `artifact share get`.
536
+ `--name` keeps the artifacts whose title
537
+ contains the keyword, case-insensitive; `--limit`, `--next` and `--all` page as
538
+ other listings do.
539
+
540
+ An HTML version can be shared by a link, and `artifact share set` says who can
541
+ open it: `private` (only you, the default), `internal` (members of your
542
+ account) or `public` (anyone with the link). A plan without share links is
543
+ refused with 402 by `artifact share get` and by sharing beyond `private`;
544
+ `internal` needs a plan with members-only sharing, and `artifact share get`
545
+ says whether the plan has it. The first `get` or `set` creates the link.
546
+ `artifact share get` and `--audience private` take the `id` of an
547
+ `artifact list` row. `--audience internal` and `public`
548
+ bind the link to a version, so `<artifact>` names one: the row's
549
+ `latest_version.id` (`version_id` in text), a version token, or the address of
550
+ the page that shows the version (`https://…/artifacts/<token>`). The artifact
551
+ id is refused there, since its latest version can change before the share is
552
+ made. To share another version of the same artifact, name that one.
553
+ `--audience private` keeps the version the link shows, whichever version
554
+ `<artifact>` names.
555
+
556
+ An OAuth session needs the `artifacts` scope, which `jinshuju auth login`
557
+ asks for; a session from an older CLI has to log in again. An account access
558
+ token is refused with 400: an artifact belongs to a person.
559
+
560
+ ```bash
561
+ jinshuju artifact list --name 周报
562
+ jinshuju artifact share get https://next.jinshuju.net/artifacts/Xy7Qm2PaLk9W
563
+ jinshuju artifact share set Xy7Qm2PaLk9W --audience public
564
+ jinshuju artifact share set Pq4nR8sT2vWx --audience internal # now the link shows this version
565
+ jinshuju artifact share set Xy7Qm2PaLk9W --audience private # the link still shows Pq4nR8sT2vWx
566
+ ```
567
+
517
568
  ## Odds and ends
518
569
 
519
570
  ```bash
package/dist/cli.js CHANGED
@@ -74,8 +74,12 @@ async function runRemote(command, words, flags, runtime, stdin) {
74
74
  return { exitCode: 0, stdout: gathered, stderr: '' };
75
75
  }
76
76
  const rows = [];
77
- await readAllPages(client, request, command.paginate, progress(), (page) => rows.push(...page));
78
- const listing = { count: rows.length, data: rows };
77
+ let totals;
78
+ await readAllPages(client, request, command.paginate, progress(), (page, body) => {
79
+ totals ??= Object.fromEntries((command.paginate?.totals ?? []).map((key) => [key, body?.[key]]));
80
+ rows.push(...page);
81
+ });
82
+ const listing = { ...totals, count: rows.length, data: rows };
79
83
  // Every page read is still one listing, and reads the way a single page does.
80
84
  if (output === 'text' && command.render)
81
85
  return ok(format(command.render(listing), output, width, hints));
@@ -107,7 +111,7 @@ async function readAllPages(client, request, paginate, watching, onPage) {
107
111
  });
108
112
  const rows = body?.[paginate.items] ?? [];
109
113
  count += rows.length;
110
- onPage(rows);
114
+ onPage(rows, body);
111
115
  page += 1;
112
116
  watching.step(`read ${page} page${page === 1 ? '' : 's'}, ${count} rows…`);
113
117
  const next = body?.[paginate.cursor];
@@ -0,0 +1,2 @@
1
+ import type { Command } from './types.js';
2
+ export declare const ARTIFACT: readonly Command[];
@@ -0,0 +1,133 @@
1
+ import { PAGINATION_OPTIONS, UsageError } from '../options.js';
2
+ import { bodyChoices, call } from '../spec.js';
3
+ import { isRecord } from '../values.js';
4
+ import { LISTING, given, paging, requiredOption, rowsForReading } from './shared.js';
5
+ const ARTIFACT_ARG = {
6
+ name: 'artifact',
7
+ required: true,
8
+ description: 'Artifact id from `artifact list`, version id, version token, or the artifact address ' +
9
+ 'https://…/artifacts/<token>; sharing beyond private takes a version, not the artifact id'
10
+ };
11
+ /**
12
+ * The version an `<artifact>` names, as the path takes it. An address is the
13
+ * page a version is shown on, and its token is that version's; the share link
14
+ * on jinapp.net names the share, not a version, so it is refused here rather
15
+ * than sent and answered with a 404 that says nothing about why.
16
+ */
17
+ function artifactVersion(value) {
18
+ const text = value.trim();
19
+ if (!text.includes('/')) {
20
+ if (!text)
21
+ throw new UsageError('<artifact> is empty');
22
+ return text;
23
+ }
24
+ const notAnAddress = new UsageError(`${JSON.stringify(value)} is not an artifact address: expected https://…/artifacts/<token>, ` +
25
+ 'an artifact id, a version id or a version token');
26
+ try {
27
+ const { pathname } = new URL(/^[a-z][a-z0-9+.-]*:\/\//i.test(text) ? text : `https://${text}`);
28
+ const token = /^\/artifacts\/([^/]+)\/?$/.exec(pathname)?.[1];
29
+ if (!token)
30
+ throw notAnAddress;
31
+ return decodeURIComponent(token);
32
+ }
33
+ catch {
34
+ throw notAnAddress;
35
+ }
36
+ }
37
+ /**
38
+ * A row as a person scans it: what the file is, the version id the share
39
+ * commands take, who its link is open to, and the conversation that changed it
40
+ * last. The version's own page, its download link, the conversation that made
41
+ * the artifact and the published version are in `--output json`.
42
+ */
43
+ function artifactsForReading(body) {
44
+ return rowsForReading(body, (row) => ({
45
+ title: row.title,
46
+ version_id: isRecord(row.latest_version) ? row.latest_version.id : undefined,
47
+ media_type: isRecord(row.latest_version) ? row.latest_version.media_type : undefined,
48
+ versions: row.versions_count,
49
+ audience: isRecord(row.published_artifact) ? row.published_artifact.allowed_audience : undefined,
50
+ conversation_url: isRecord(row.latest_version) ? row.latest_version.conversation_url : undefined,
51
+ updated_at: isRecord(row.latest_version) ? row.latest_version.created_at : undefined
52
+ }));
53
+ }
54
+ export const ARTIFACT = [
55
+ {
56
+ path: ['artifact', 'list'],
57
+ summary: 'List the artifacts Jiri made for you, newest first, each with its conversation link and share state',
58
+ description: 'The artifacts Jiri made for you in the account you are in, newest first, one row per artifact however ' +
59
+ 'many versions it has. created_conversation_url opens the Jiri conversation it was made in, ' +
60
+ 'latest_version.conversation_url (conversation_url in text) the one that delivered its latest version, and ' +
61
+ 'latest_version.download_url downloads that version for ten minutes; published_artifact ' +
62
+ 'says who can open its link (allowed_audience, audience in text) and which version the link shows ' +
63
+ '(published_version), and is null when it was never shared; `artifact share get` gives the link. ' +
64
+ '`artifact share get` and `artifact share set --audience private` take the id; sharing beyond private ' +
65
+ 'takes latest_version.id (version_id in text), the version the link is bound to. ' +
66
+ 'Only an HTML artifact (latest_version.media_type text/html) has a share link; other files can only be ' +
67
+ 'downloaded.',
68
+ options: [
69
+ {
70
+ name: '--name',
71
+ type: 'string',
72
+ placeholder: '<kw>',
73
+ description: 'Match artifacts whose title contains the keyword, case-insensitive'
74
+ },
75
+ ...PAGINATION_OPTIONS
76
+ ],
77
+ request: (input) => call('listArtifacts', { query: { q: input.options.name, ...paging(input) } }),
78
+ paginate: LISTING,
79
+ render: artifactsForReading,
80
+ examples: ['jinshuju artifact list', 'jinshuju artifact list --name 周报 --limit 10']
81
+ },
82
+ {
83
+ path: ['artifact', 'share', 'get'],
84
+ summary: 'Show who can open an artifact’s share link, the link, and which version it shows',
85
+ description: 'The first get creates the link, open to you only (private); a plan without share links gets 402 ' +
86
+ '(paid_plan_required) instead. can_use_internal says whether the plan includes internal; account_name ' +
87
+ 'is the account whose members internal lets in; banned, whether the version the link shows was ' +
88
+ 'banned for its content, so the link opens to no one until another version is shared.',
89
+ args: [ARTIFACT_ARG],
90
+ request: (input) => call('getPublishedArtifact', { path: { artifact_id: artifactVersion(input.args.artifact) } }),
91
+ examples: [
92
+ 'jinshuju artifact share get https://next.jinshuju.net/artifacts/Xy7Qm2PaLk9W',
93
+ 'jinshuju artifact share get Xy7Qm2PaLk9W'
94
+ ]
95
+ },
96
+ {
97
+ path: ['artifact', 'share', 'set'],
98
+ summary: 'Change who can open an artifact’s share link, and which version it shows',
99
+ description: 'internal and public bind the link to the version <artifact> names: latest_version.id from ' +
100
+ '`artifact list` (version_id in text), a version token or the artifact address, not the artifact id. ' +
101
+ 'To share another version of the same artifact, name that one. private takes the artifact id too ' +
102
+ 'and keeps the version the link shows. Only an ' +
103
+ 'HTML version whose file is still there can be shared, and not a banned one; those are refused ' +
104
+ 'with 422. private: only you; internal: members of your account; public: anyone with the link. ' +
105
+ 'Beyond private needs a plan with share links, and internal one with members-only sharing; ' +
106
+ 'otherwise 402. Where sharing is not open to the account, beyond private is refused with 403.',
107
+ args: [ARTIFACT_ARG],
108
+ options: [
109
+ {
110
+ name: '--audience',
111
+ type: 'string',
112
+ choices: bodyChoices('updatePublishedArtifact', 'allowed_audience'),
113
+ placeholder: '<audience>',
114
+ description: 'Who can open the link: private, internal or public'
115
+ }
116
+ ],
117
+ request: (input) => {
118
+ const version = artifactVersion(input.args.artifact);
119
+ const audience = requiredOption(input, 'audience');
120
+ // Without version_id the API keeps the version the link shows, so taking a share back to
121
+ // private from an older version's receipt does not change what a later public share shows.
122
+ return call('updatePublishedArtifact', {
123
+ path: { artifact_id: version },
124
+ body: given({ allowed_audience: audience, version_id: audience === 'private' ? undefined : version })
125
+ });
126
+ },
127
+ examples: [
128
+ 'jinshuju artifact share set https://next.jinshuju.net/artifacts/Xy7Qm2PaLk9W --audience public',
129
+ 'jinshuju artifact share set Pq4nR8sT2vWx --audience internal',
130
+ 'jinshuju artifact share set Xy7Qm2PaLk9W --audience private'
131
+ ]
132
+ }
133
+ ];
@@ -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',
@@ -15,7 +15,8 @@ export const EMAIL = [
15
15
  description: 'Picks the entries the way `entry count` narrows them, or the whole form with --select-all, and sends to the ' +
16
16
  'email field --field names. --estimate answers how many entries and addresses it reaches, how many are ' +
17
17
  'missing an address and whether the quota covers them, and sends nothing; --yes sends, and wants --subject and ' +
18
- '--content. The entries are picked again when it sends.',
18
+ '--content. The entries are picked again when it sends. Sent email cannot be recalled: after a timeout or a ' +
19
+ 'dropped connection, look for the task in `email task list` before sending again, or it may go out twice.',
19
20
  options: [
20
21
  FORM_OPTION,
21
22
  {
@@ -62,8 +63,8 @@ export const EMAIL = [
62
63
  },
63
64
  {
64
65
  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.',
66
+ summary: "List a form's email tasks, newest first, with how many addresses succeeded or failed so far",
67
+ description: '--from and --to pick the tasks by the day they were created. A page holds at most 100 tasks.',
67
68
  options: [
68
69
  FORM_OPTION,
69
70
  {
@@ -73,14 +74,15 @@ export const EMAIL = [
73
74
  placeholder: '<status>',
74
75
  description: 'Only the tasks in this status'
75
76
  },
77
+ ...DAY_RANGE_OPTIONS,
76
78
  ...PAGINATION_OPTIONS
77
79
  ],
78
80
  request: (input) => call('listEmailTasks', {
79
81
  path: { form_token: requiredOption(input, 'form') },
80
- query: { status: input.options.status, ...paging(input) }
82
+ query: { status: input.options.status, ...dayRange(input), ...paging(input) }
81
83
  }),
82
84
  paginate: LISTING,
83
- examples: ['jinshuju email task list --form Kp7mQ2']
85
+ examples: ['jinshuju email task list --form Kp7mQ2', 'jinshuju email task list --form Kp7mQ2 --from 2026-10-01']
84
86
  },
85
87
  {
86
88
  path: ['email', 'task', 'get'],
@@ -8,6 +8,7 @@
8
8
  * without its help, nor accept a flag it never described.
9
9
  */
10
10
  import { ACCOUNT } from './account.js';
11
+ import { ARTIFACT } from './artifact.js';
11
12
  import { CHECKIN } from './checkin.js';
12
13
  import { COMMENT } from './comment.js';
13
14
  import { EMAIL } from './email.js';
@@ -49,7 +50,7 @@ export const RESOURCES = [
49
50
  {
50
51
  name: 'notification',
51
52
  summary: 'Notification rules: SMS, email and WeChat to submitters, bots and webhooks to your team',
52
- note: 'An SMS rule needs an approved template of your own, shared in the account or from the system (`sms status`). ' +
53
+ note: 'An SMS rule needs an approved template of your own, shared in the account or official (`sms template list`). ' +
53
54
  'A rule under review is saved but does not send; `notification get` says why a rule cannot send. ' +
54
55
  'Only a manager of the form can create, edit or delete its rules. `notification edit --disable` turns a rule off for now.'
55
56
  },
@@ -88,6 +89,12 @@ export const RESOURCES = [
88
89
  { name: 'payout', summary: 'Payouts to the settlement account' },
89
90
  { name: 'sms', summary: 'Manage SMS signatures and templates, and send SMS to entries' },
90
91
  { name: 'email', summary: 'Send email to entries' },
92
+ {
93
+ name: 'artifact',
94
+ summary: 'Artifacts Jiri made in a conversation: find and download them, and who can open an HTML one by its link',
95
+ note: 'OAuth sessions need the artifacts scope. `jinshuju auth login` asks for it; a session from ' +
96
+ 'an older CLI has to log in again. An account access token is refused: an artifact belongs to a person.'
97
+ },
91
98
  { name: 'config', summary: 'Manage CLI configuration' }
92
99
  ];
93
100
  export const COMMANDS = [
@@ -107,7 +114,8 @@ export const COMMANDS = [
107
114
  ...FILL,
108
115
  ...TRADE,
109
116
  ...SMS,
110
- ...EMAIL
117
+ ...EMAIL,
118
+ ...ARTIFACT
111
119
  ];
112
120
  /** The command whose path the words begin with, longest match first. */
113
121
  export function findCommand(words, commands = COMMANDS) {
@@ -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. */
@@ -18,12 +18,18 @@ const RULE_OPTIONS = [
18
18
  placeholder: '<mobile|email|api-code,...>',
19
19
  description: 'SMS and EMAIL: mobiles or emails, or api_codes of the fields holding them'
20
20
  },
21
- { name: '--sms-template', type: 'string', placeholder: '<id>', description: 'SMS template id (see `sms status`)' },
22
21
  {
23
- name: '--placeholders',
24
- type: 'list',
25
- placeholder: '<api-code,...>',
26
- description: "SMS: the field filling each of the template's $(...) placeholders, in order"
22
+ name: '--template-id',
23
+ type: 'string',
24
+ placeholder: '<id>',
25
+ description: 'SMS: template to send, from `sms template list`'
26
+ },
27
+ {
28
+ name: '--placeholder',
29
+ type: 'string',
30
+ repeatable: true,
31
+ placeholder: '<api_code>',
32
+ description: 'SMS: field filling the next template variable, repeatable in variable order'
27
33
  },
28
34
  { name: '--subject', type: 'string', placeholder: '<text>', description: 'EMAIL and WEIXIN_ONETIME subject' },
29
35
  { name: '--content', type: 'string', placeholder: '<text>', description: 'Message; $(api_code) inserts a field' },
@@ -40,8 +46,10 @@ function ruleBody(input) {
40
46
  return overriding(rest, {
41
47
  trigger_scope: input.options.trigger,
42
48
  recipients: input.options.recipients,
43
- sms_template_id: input.options.sms_template,
44
- placeholder_keys: input.options.placeholders,
49
+ sms_template_id: input.options.template_id,
50
+ placeholder_keys: input.options.placeholder?.length
51
+ ? input.options.placeholder
52
+ : undefined,
45
53
  subject: input.options.subject,
46
54
  content: input.options.content,
47
55
  url: input.options.url
@@ -65,7 +73,9 @@ export const NOTIFICATION = [
65
73
  path: ['notification', 'create'],
66
74
  summary: 'Create a notification rule',
67
75
  description: 'The rule is on once created and sends for the entries that match it from then on; --disable saves it off. ' +
68
- 'Each approach takes its own keys: SMS --recipients --sms-template --placeholders; ' +
76
+ 'An enabled schedule_time rule also schedules, each time it is saved, the entries already in the form ' +
77
+ 'whose send time is still ahead. ' +
78
+ 'Each approach takes its own keys: SMS --recipients --template-id --placeholder; ' +
69
79
  'EMAIL --recipients --subject --content; WEIXIN_ONETIME --subject --content; ' +
70
80
  'WXWORK and DING_TALK --url --content; WEBHOOK --url. ' +
71
81
  'scope_conditions, schedule_time_rule, smtp_account_id, weixin_onetime_url and mentioned_mobile_list go through --json.',
@@ -89,10 +99,13 @@ export const NOTIFICATION = [
89
99
  })
90
100
  }),
91
101
  examples: [
92
- 'jinshuju notification create --form Kp7mQ2 --approach SMS --recipients field_2 --sms-template 6650a1 --placeholders field_1',
93
- 'jinshuju notification create --form Kp7mQ2 --approach SMS --recipients field_2 --sms-template 6650a1 --placeholders field_1 ' +
102
+ 'jinshuju notification create --form Kp7mQ2 --approach SMS --recipients field_2 --template-id 6650a1 --placeholder field_1',
103
+ 'jinshuju notification create --form Kp7mQ2 --approach SMS --recipients field_2 --template-id 6650a1 --placeholder field_1 ' +
94
104
  '--trigger schedule_time --json \'{"schedule_time_rule":{"date_key":"field_5","date_offset_action":"before",' +
95
- '"date_offset_number":1,"date_offset_unit":"day","hour":9,"minute":0}}\''
105
+ '"date_offset_number":1,"date_offset_unit":"day","hour":9,"minute":0}}\'',
106
+ 'jinshuju notification create --form Kp7mQ2 --approach EMAIL --recipients field_3 --subject 报名成功 ' +
107
+ "--content '$(field_1) 你好,报名已收到' --trigger matched_new " +
108
+ '--json \'{"scope_conditions":[{"trigger":"field_5","operator":"any_in","value":["choice_1"]}]}\''
96
109
  ]
97
110
  },
98
111
  {
@@ -131,5 +144,34 @@ export const NOTIFICATION = [
131
144
  path: { form_token: requiredOption(input, 'form'), id: input.args.rule }
132
145
  });
133
146
  }
147
+ },
148
+ {
149
+ path: ['notification', 'log'],
150
+ summary: 'List what a notification rule sent, with how many succeeded or failed and why',
151
+ description: 'Covers the last 180 days, as the notification log page does; notifications scheduled for later are not listed. ' +
152
+ '--from and --to pick them by the day they were sent. The summary counts every match, not just the page; ' +
153
+ '--output jsonl carries the notifications alone, without it.',
154
+ args: [RULE_ARG],
155
+ options: [
156
+ FORM_OPTION,
157
+ {
158
+ name: '--status',
159
+ type: 'string',
160
+ choices: choices('listNotificationRuleNotifications', 'status'),
161
+ placeholder: '<status>',
162
+ description: 'Only the notifications in this status, e.g. FAILED'
163
+ },
164
+ ...DAY_RANGE_OPTIONS,
165
+ ...PAGINATION_OPTIONS
166
+ ],
167
+ request: (input) => call('listNotificationRuleNotifications', {
168
+ path: { form_token: requiredOption(input, 'form'), id: input.args.rule },
169
+ query: { status: input.options.status, ...dayRange(input), ...paging(input) }
170
+ }),
171
+ paginate: { ...LISTING, totals: ['triggered_count', 'summary'] },
172
+ examples: [
173
+ 'jinshuju notification log 6650b2 --form Kp7mQ2',
174
+ 'jinshuju notification log 6650b2 --form Kp7mQ2 --status FAILED --from 2026-10-01 --to 2026-10-31'
175
+ ]
134
176
  }
135
177
  ];
@@ -1,7 +1,7 @@
1
1
  import { JSON_OPTION, PAGINATION_OPTIONS, UsageError } from '../options.js';
2
2
  import { call, choices } from '../spec.js';
3
3
  import { isRecord } from '../values.js';
4
- import { LISTING, YES_OPTION, confirmed, overriding, paging } from './shared.js';
4
+ import { LISTING, YES_OPTION, confirmed, overriding, paging, rowsForReading } from './shared.js';
5
5
  /**
6
6
  * Routines (自动任务): an instruction Jiri carries out on a schedule, or when the
7
7
  * data of a form or table changes. The rules — how long a name may be, which
@@ -201,12 +201,6 @@ function routineBody(input) {
201
201
  schedule
202
202
  });
203
203
  }
204
- /** A listing's rows cut down to the given keys, each named as the row has it. */
205
- function rowsForReading(body, row) {
206
- if (!isRecord(body) || !Array.isArray(body.data))
207
- return body;
208
- return { ...body, data: body.data.map((item) => (isRecord(item) ? row(item) : item)) };
209
- }
210
204
  /**
211
205
  * A row of a listing as a person scans it: which routine and what it does,
212
206
  * whether it is on and why not, when it runs and when it runs next. The
@@ -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;
@@ -62,6 +68,8 @@ export declare function refuseWithMine(input: CommandInput, flags: readonly stri
62
68
  */
63
69
  export declare function keywords(value: unknown): readonly string[] | undefined;
64
70
  export declare const LISTING: Pagination;
71
+ /** A listing's rows cut down to the given keys, each named as the row has it. */
72
+ export declare function rowsForReading(body: unknown, row: (item: Record<string, unknown>) => Record<string, unknown>): unknown;
65
73
  export declare function payload(input: CommandInput): unknown;
66
74
  export declare function requiredOption(input: CommandInput, key: string): string;
67
75
  /** Sending to entries belongs to a form: the API has no table counterpart. */
@@ -1,5 +1,6 @@
1
1
  import { FILTER_OPTION, FILTERS_OPTION, UsageError, parseFilter, parseSort, resolveContainer } from '../options.js';
2
2
  import { call } from '../spec.js';
3
+ import { isRecord } from '../values.js';
3
4
  /** What more than one resource's commands build their requests from. */
4
5
  /**
5
6
  * The request for whichever container was named. openapi.yaml has a form's
@@ -42,6 +43,14 @@ export function sort(input, key) {
42
43
  export function paging(input) {
43
44
  return { limit: input.options.limit, next: input.options.next };
44
45
  }
46
+ /** A range of days, Asia/Shanghai; either end can be left open. */
47
+ export const DAY_RANGE_OPTIONS = [
48
+ { name: '--from', type: 'string', placeholder: '<YYYY-MM-DD>', description: 'First day, Asia/Shanghai' },
49
+ { name: '--to', type: 'string', placeholder: '<YYYY-MM-DD>', description: 'Last day, inclusive' }
50
+ ];
51
+ export function dayRange(input) {
52
+ return { start_date: input.options.from, end_date: input.options.to };
53
+ }
45
54
  /** The sort rules as the API's own objects, for a body. */
46
55
  export function sortRules(input) {
47
56
  const rules = input.options.sort ?? [];
@@ -112,6 +121,12 @@ export function keywords(value) {
112
121
  return values && values.length > 0 ? values : undefined;
113
122
  }
114
123
  export const LISTING = { items: 'data', cursor: 'next' };
124
+ /** A listing's rows cut down to the given keys, each named as the row has it. */
125
+ export function rowsForReading(body, row) {
126
+ if (!isRecord(body) || !Array.isArray(body.data))
127
+ return body;
128
+ return { ...body, data: body.data.map((item) => (isRecord(item) ? row(item) : item)) };
129
+ }
115
130
  export function payload(input) {
116
131
  const value = input.options.json;
117
132
  if (value === undefined)
@@ -1,9 +1,10 @@
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
- import { basename } from 'node:path';
6
+ import { statSync } from 'node:fs';
7
+ import { basename, extname } from 'node:path';
7
8
  /**
8
9
  * A signature is applied for with license images, which go up first as the
9
10
  * caller's own uploads and are then referred to by id. The review takes a
@@ -63,6 +64,29 @@ function requiredOption(input, key, flag) {
63
64
  function licensesOf(input) {
64
65
  return input.options.license ?? [];
65
66
  }
67
+ const LICENSE_EXTENSIONS = ['.jpg', '.jpeg', '.png', '.bmp'];
68
+ const LICENSE_MAX_BYTES = 5 * 1024 * 1024;
69
+ /**
70
+ * Every image is checked before the first goes up: once one is uploaded, a
71
+ * failure on the next leaves it behind, and running the command again sends
72
+ * the license and ID card images a second time.
73
+ */
74
+ function checkLicenseFiles(files) {
75
+ for (const file of files) {
76
+ if (!LICENSE_EXTENSIONS.includes(extname(file).toLowerCase())) {
77
+ throw new UsageError(`${file} is not a jpg, jpeg, png or bmp image`);
78
+ }
79
+ let size;
80
+ try {
81
+ size = statSync(file).size;
82
+ }
83
+ catch (error) {
84
+ throw new UsageError(`could not read ${file}: ${error.message}`);
85
+ }
86
+ if (size > LICENSE_MAX_BYTES)
87
+ throw new UsageError(`${file} is over 5 MB`);
88
+ }
89
+ }
66
90
  async function uploadLicense(client, file) {
67
91
  const watching = progress();
68
92
  watching.step(`uploading ${basename(file)}…`);
@@ -85,6 +109,8 @@ async function signatureMaterials(input, client) {
85
109
  body[key] = input.options[option];
86
110
  }
87
111
  const licenses = licensesOf(input);
112
+ const idCards = SIGNATURE_FILES.map(({ option }) => input.options[option]);
113
+ checkLicenseFiles([...licenses, ...idCards.filter((file) => Boolean(file))]);
88
114
  if (licenses.length > 0) {
89
115
  const ids = [];
90
116
  for (const license of licenses)
@@ -182,7 +208,8 @@ export const SMS = [
182
208
  path: ['sms', 'status'],
183
209
  summary: 'List SMS signatures and templates with their review status and why a review failed',
184
210
  description: 'Your own signatures and templates, not those of the rest of the account. ' +
185
- 'template_id is what `notification create --sms-template` takes.',
211
+ 'To pick a template to send, use `sms template list`, which also has the ones the account shares and the ' +
212
+ 'official ones.',
186
213
  request: () => call('listSmsAuditStatuses'),
187
214
  render: templatesForReading
188
215
  },
@@ -212,6 +239,8 @@ export const SMS = [
212
239
  summary: 'Apply for an SMS signature and submit it for review',
213
240
  description: 'Uploads the license images and applies with them in one command. Review takes a while: follow it with ' +
214
241
  '`sms signature list`. A signature the account already has under review or approved is answered as it is. ' +
242
+ "The materials replace your ID card information, and the account's business license unless the account " +
243
+ 'has passed license verification. ' +
215
244
  'For SMS notifications leave --type out. --type verification applies for a signature that only replaces ' +
216
245
  'the default 金数据 signature on the verification-code SMS of mobile fields: it cannot send notifications or ' +
217
246
  'have templates, and verification codes already work without one.',
@@ -278,22 +307,25 @@ export const SMS = [
278
307
  },
279
308
  {
280
309
  path: ['sms', 'template', 'list'],
281
- summary: 'List your SMS templates and the ones the account shares',
310
+ summary: 'List your SMS templates, the ones the account shares and the official ones',
282
311
  description: 'scope owned is yours and can be changed or deleted with the ids it carries; scope shared is shared by ' +
283
- 'another member and can only be sent.',
312
+ 'another member and can only be sent; scope official is approved already and can be sent right away, even ' +
313
+ 'while your own signature and templates are under review. Official ones come last, with scene marking the ' +
314
+ 'forms they are worded for: form ones suit any form, and any form can send with any of them. variables are ' +
315
+ 'in the order `--placeholder` fills them when sending.',
284
316
  options: [
285
317
  {
286
318
  name: '--keyword',
287
319
  type: 'string',
288
320
  placeholder: '<kw>',
289
- description: 'Match the content or the signature, case-insensitive and partial'
321
+ description: 'Match the content or the signature, case-insensitive and partial; only the content of official ones'
290
322
  },
291
323
  {
292
324
  name: '--scope',
293
325
  type: 'string',
294
326
  choices: choices('listSmsTemplates', 'scope'),
295
327
  placeholder: '<scope>',
296
- description: 'owned (yours) or shared (shared by another member); both when omitted'
328
+ description: 'owned (yours), shared (shared by another member) or official; all three when omitted'
297
329
  },
298
330
  {
299
331
  name: '--signature-id',
@@ -320,7 +352,11 @@ export const SMS = [
320
352
  }
321
353
  }),
322
354
  paginate: LISTING,
323
- examples: ['jinshuju sms template list --keyword 开课', 'jinshuju sms template list --scope owned --status FAIL']
355
+ examples: [
356
+ 'jinshuju sms template list --keyword 开课',
357
+ 'jinshuju sms template list --scope owned --status FAIL',
358
+ 'jinshuju sms template list --scope official'
359
+ ]
324
360
  },
325
361
  {
326
362
  path: ['sms', 'template', 'create'],
@@ -384,7 +420,8 @@ export const SMS = [
384
420
  'mobile field --field names. --estimate answers how many entries and numbers it reaches, how many are missing ' +
385
421
  'a number, the SMS it bills and whether the quota covers them, and sends nothing; --yes sends. The entries are ' +
386
422
  'picked again when it sends, so a change in between changes what goes out. A template still under review is ' +
387
- 'taken, and the task waits for it.',
423
+ 'taken, and the task waits for it. Sent SMS cannot be recalled: after a timeout or a dropped connection, ' +
424
+ 'look for the task in `sms task list` before sending again, or it may go out twice.',
388
425
  options: [
389
426
  FORM_OPTION,
390
427
  MOBILE_FIELD_OPTION,
@@ -431,8 +468,8 @@ export const SMS = [
431
468
  },
432
469
  {
433
470
  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.',
471
+ summary: "List a form's SMS tasks, newest first, with how many numbers succeeded or failed so far",
472
+ description: '--from and --to pick the tasks by the day they were created. A page holds at most 100 tasks.',
436
473
  options: [
437
474
  FORM_OPTION,
438
475
  {
@@ -442,14 +479,19 @@ export const SMS = [
442
479
  placeholder: '<status>',
443
480
  description: 'Only the tasks in this status'
444
481
  },
482
+ ...DAY_RANGE_OPTIONS,
445
483
  ...PAGINATION_OPTIONS
446
484
  ],
447
485
  request: (input) => call('listSmsTasks', {
448
486
  path: { form_token: required(input, 'form') },
449
- query: { status: input.options.status, ...paging(input) }
487
+ query: { status: input.options.status, ...dayRange(input), ...paging(input) }
450
488
  }),
451
489
  paginate: LISTING,
452
- examples: ['jinshuju sms task list --form Kp7mQ2', 'jinshuju sms task list --form Kp7mQ2 --status template_fail']
490
+ examples: [
491
+ 'jinshuju sms task list --form Kp7mQ2',
492
+ 'jinshuju sms task list --form Kp7mQ2 --status template_fail',
493
+ 'jinshuju sms task list --form Kp7mQ2 --from 2026-10-01 --to 2026-10-31'
494
+ ]
453
495
  },
454
496
  {
455
497
  path: ['sms', 'task', 'get'],
@@ -12,6 +12,11 @@ export interface ArgSpec {
12
12
  export interface Pagination {
13
13
  readonly items: string;
14
14
  readonly cursor: string;
15
+ /**
16
+ * Keys of a page that count the whole listing rather than the page, so the
17
+ * listing `--all` reads still answers them as the first page did.
18
+ */
19
+ readonly totals?: readonly string[];
15
20
  }
16
21
  export interface CommandInput {
17
22
  readonly args: Record<string, string>;
@@ -16,6 +16,7 @@ const UPLOAD_TYPES = {
16
16
  '.png': 'image/png',
17
17
  '.jpg': 'image/jpeg',
18
18
  '.jpeg': 'image/jpeg',
19
+ '.bmp': 'image/bmp',
19
20
  '.gif': 'image/gif',
20
21
  '.webp': 'image/webp',
21
22
  '.pdf': 'application/pdf'
package/dist/config.d.ts CHANGED
@@ -63,7 +63,7 @@ export declare const defaultConfigPath: string;
63
63
  export declare const defaultHost = "https://jinshuju.net";
64
64
  export declare const defaultAuthHost = "https://account.jinshuju.net";
65
65
  export declare const defaultOAuthClientId = "jinshuju_cli_public";
66
- export declare const defaultScopes = "public forms read_entries write_entries form_setting read_contacts users routines";
66
+ export declare const defaultScopes = "public forms read_entries write_entries form_setting artifacts read_contacts users routines";
67
67
  /**
68
68
  * One credential at a time: a login of either kind replaces whatever the last
69
69
  * one stored, so the file never holds two that disagree about who is calling.
package/dist/config.js CHANGED
@@ -6,7 +6,7 @@ export const defaultConfigPath = join(homedir(), '.jinshuju', 'config.json');
6
6
  export const defaultHost = 'https://jinshuju.net';
7
7
  export const defaultAuthHost = 'https://account.jinshuju.net';
8
8
  export const defaultOAuthClientId = 'jinshuju_cli_public';
9
- export const defaultScopes = 'public forms read_entries write_entries form_setting read_contacts users routines';
9
+ export const defaultScopes = 'public forms read_entries write_entries form_setting artifacts read_contacts users routines';
10
10
  function readConfigFile(configPath) {
11
11
  if (!existsSync(configPath))
12
12
  return {};
@@ -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' | 'getPublishedArtifact' | 'getRoutine' | 'getSmsTask' | 'getTable' | 'getTableEntry' | 'getTableView' | 'getTradeMerchant' | 'listArtifacts' | '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' | 'prepareEntryAttachmentUpload' | 'prepareFormImageUpload' | 'prepareImportFileUpload' | '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' | 'updatePublishedArtifact' | '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
  };
@@ -774,6 +774,11 @@ export const OPERATIONS = {
774
774
  path: '/opensearch/queries/{query_token}',
775
775
  parameters: [{ name: 'query_token', in: 'path', required: true, schema: { type: 'string' } }]
776
776
  },
777
+ getPublishedArtifact: {
778
+ method: 'GET',
779
+ path: '/artifacts/{artifact_id}/published_artifact',
780
+ parameters: [{ name: 'artifact_id', in: 'path', required: true, schema: { type: 'string' } }]
781
+ },
777
782
  getRoutine: {
778
783
  method: 'GET',
779
784
  path: '/routines/{id}',
@@ -814,6 +819,16 @@ export const OPERATIONS = {
814
819
  ]
815
820
  },
816
821
  getTradeMerchant: { method: 'GET', path: '/trade/merchant', parameters: [] },
822
+ listArtifacts: {
823
+ method: 'GET',
824
+ path: '/artifacts',
825
+ parameters: [
826
+ { name: 'q', in: 'query', schema: { type: 'string' } },
827
+ { name: 'limit', in: 'query', schema: { type: 'integer' } },
828
+ { name: 'next', in: 'query', schema: { type: 'integer', minimum: 0 } },
829
+ { name: 'skip', in: 'query', schema: { type: 'integer', minimum: 0, maximum: 10000 } }
830
+ ]
831
+ },
817
832
  listBillingAccountInvoices: { method: 'GET', path: '/billing_account/invoices', parameters: [] },
818
833
  listBillingAccountPaidFeatures: { method: 'GET', path: '/billing_account/paid_features', parameters: [] },
819
834
  listBillingAccountPaymentHistories: {
@@ -868,7 +883,9 @@ export const OPERATIONS = {
868
883
  in: 'query',
869
884
  schema: { type: 'string', enum: ['waiting_for_send', 'sending', 'all_sent', 'partial_sent', 'none_sent'] }
870
885
  },
871
- { name: 'limit', in: 'query', schema: { type: 'integer' } },
886
+ { name: 'start_date', in: 'query', schema: { type: 'string' } },
887
+ { name: 'end_date', in: 'query', schema: { type: 'string' } },
888
+ { name: 'limit', in: 'query', schema: { type: 'integer', minimum: 1, maximum: 100 } },
872
889
  { name: 'next', in: 'query', schema: { type: 'integer', minimum: 0 } },
873
890
  { name: 'skip', in: 'query', schema: { type: 'integer', minimum: 0, maximum: 10000 } }
874
891
  ]
@@ -998,6 +1015,27 @@ export const OPERATIONS = {
998
1015
  { name: 'skip', in: 'query', schema: { type: 'integer', minimum: 0, maximum: 10000 } }
999
1016
  ]
1000
1017
  },
1018
+ listNotificationRuleNotifications: {
1019
+ method: 'GET',
1020
+ path: '/forms/{form_token}/notification_rules/{id}/notifications',
1021
+ parameters: [
1022
+ { name: 'form_token', in: 'path', required: true, schema: { type: 'string' } },
1023
+ { name: 'id', in: 'path', required: true, schema: { type: 'string' } },
1024
+ { name: 'start_date', in: 'query', schema: { type: 'string' } },
1025
+ { name: 'end_date', in: 'query', schema: { type: 'string' } },
1026
+ {
1027
+ name: 'status',
1028
+ in: 'query',
1029
+ schema: {
1030
+ type: 'string',
1031
+ enum: ['SUCCESS', 'FAILED', 'WAITING', 'AUDITING', 'APPROVED', 'REJECTED', 'CANCELLED', 'REVOKED']
1032
+ }
1033
+ },
1034
+ { name: 'limit', in: 'query', schema: { type: 'integer', minimum: 1, maximum: 1000 } },
1035
+ { name: 'next', in: 'query', schema: { type: 'integer', minimum: 0 } },
1036
+ { name: 'skip', in: 'query', schema: { type: 'integer', minimum: 0, maximum: 10000 } }
1037
+ ]
1038
+ },
1001
1039
  listNotificationRules: {
1002
1040
  method: 'GET',
1003
1041
  path: '/forms/{form_token}/notification_rules',
@@ -1084,7 +1122,9 @@ export const OPERATIONS = {
1084
1122
  ]
1085
1123
  }
1086
1124
  },
1087
- { name: 'limit', in: 'query', schema: { type: 'integer' } },
1125
+ { name: 'start_date', in: 'query', schema: { type: 'string' } },
1126
+ { name: 'end_date', in: 'query', schema: { type: 'string' } },
1127
+ { name: 'limit', in: 'query', schema: { type: 'integer', minimum: 1, maximum: 100 } },
1088
1128
  { name: 'next', in: 'query', schema: { type: 'integer', minimum: 0 } },
1089
1129
  { name: 'skip', in: 'query', schema: { type: 'integer', minimum: 0, maximum: 10000 } }
1090
1130
  ]
@@ -1094,7 +1134,7 @@ export const OPERATIONS = {
1094
1134
  path: '/sms/templates',
1095
1135
  parameters: [
1096
1136
  { name: 'q', in: 'query', schema: { type: 'string' } },
1097
- { name: 'scope', in: 'query', schema: { type: 'string', enum: ['owned', 'shared'] } },
1137
+ { name: 'scope', in: 'query', schema: { type: 'string', enum: ['owned', 'shared', 'official'] } },
1098
1138
  { name: 'signature_id', in: 'query', schema: { type: 'string' } },
1099
1139
  { name: 'status', in: 'query', schema: { type: 'string', enum: ['CHECKING', 'SUCCESS', 'FAIL'] } },
1100
1140
  { name: 'limit', in: 'query', schema: { type: 'integer' } },
@@ -1266,6 +1306,57 @@ export const OPERATIONS = {
1266
1306
  path: '/routines/{routine_id}/pause',
1267
1307
  parameters: [{ name: 'routine_id', in: 'path', required: true, schema: { type: 'string' } }]
1268
1308
  },
1309
+ prepareEntryAttachmentUpload: {
1310
+ method: 'POST',
1311
+ path: '/forms/{form_token}/entry_attachment_upload_urls',
1312
+ parameters: [{ name: 'form_token', in: 'path', required: true, schema: { type: 'string' } }],
1313
+ body: {
1314
+ required: true,
1315
+ content: {
1316
+ 'application/json': {
1317
+ type: 'object',
1318
+ required: ['field_api_code'],
1319
+ properties: { field_api_code: { type: 'string' }, dimension_api_code: { type: 'string' } },
1320
+ additionalProperties: false
1321
+ }
1322
+ }
1323
+ }
1324
+ },
1325
+ prepareFormImageUpload: {
1326
+ method: 'POST',
1327
+ path: '/form_image_upload_urls',
1328
+ parameters: [],
1329
+ body: {
1330
+ required: true,
1331
+ content: {
1332
+ 'application/json': {
1333
+ type: 'object',
1334
+ required: ['image_type'],
1335
+ properties: {
1336
+ image_type: {
1337
+ type: 'string',
1338
+ enum: [
1339
+ 'field_choice',
1340
+ 'header',
1341
+ 'wallpaper',
1342
+ 'carousel',
1343
+ 'opensearch_header',
1344
+ 'description',
1345
+ 'goods_item',
1346
+ 'contact_widget'
1347
+ ]
1348
+ }
1349
+ },
1350
+ additionalProperties: false
1351
+ }
1352
+ }
1353
+ }
1354
+ },
1355
+ prepareImportFileUpload: {
1356
+ method: 'POST',
1357
+ path: '/forms/{form_token}/import_file_upload_urls',
1358
+ parameters: [{ name: 'form_token', in: 'path', required: true, schema: { type: 'string' } }]
1359
+ },
1269
1360
  previewFormFieldTypeChange: {
1270
1361
  method: 'GET',
1271
1362
  path: '/forms/{form_token}/fields/preview_convert',
@@ -1576,6 +1667,12 @@ export const OPERATIONS = {
1576
1667
  }
1577
1668
  }
1578
1669
  },
1670
+ updatePublishedArtifact: {
1671
+ method: 'PATCH',
1672
+ path: '/artifacts/{artifact_id}/published_artifact',
1673
+ parameters: [{ name: 'artifact_id', in: 'path', required: true, schema: { type: 'string' } }],
1674
+ body: { required: true, content: { 'application/json': { $ref: 'PublishedArtifactInput' } } }
1675
+ },
1579
1676
  updateRoutine: {
1580
1677
  method: 'PATCH',
1581
1678
  path: '/routines/{id}',
@@ -1669,12 +1766,9 @@ export const OPERATIONS = {
1669
1766
  properties: {
1670
1767
  field_api_code: { type: 'string' },
1671
1768
  dimension_api_code: { type: 'string' },
1672
- attachment_token: { type: 'string' },
1673
1769
  file: { type: 'string' },
1674
1770
  base64: { type: 'string' },
1675
- data: { type: 'string' },
1676
1771
  file_name: { type: 'string' },
1677
- filename: { type: 'string' },
1678
1772
  content_type: { type: 'string' }
1679
1773
  },
1680
1774
  additionalProperties: false
@@ -1692,13 +1786,21 @@ export const OPERATIONS = {
1692
1786
  content: {
1693
1787
  'multipart/form-data': {
1694
1788
  type: 'object',
1695
- required: ['file'],
1789
+ required: ['image_type', 'file'],
1696
1790
  properties: {
1697
1791
  image_type: {
1698
1792
  type: 'string',
1699
- enum: ['field_choice', 'header', 'wallpaper', 'carousel', 'opensearch_header', 'description']
1793
+ enum: [
1794
+ 'field_choice',
1795
+ 'header',
1796
+ 'wallpaper',
1797
+ 'carousel',
1798
+ 'opensearch_header',
1799
+ 'description',
1800
+ 'goods_item',
1801
+ 'contact_widget'
1802
+ ]
1700
1803
  },
1701
- form_image_token: { type: 'string' },
1702
1804
  file: { type: 'string' }
1703
1805
  },
1704
1806
  additionalProperties: false
@@ -1716,7 +1818,7 @@ export const OPERATIONS = {
1716
1818
  'multipart/form-data': {
1717
1819
  type: 'object',
1718
1820
  required: ['file'],
1719
- properties: { import_file_token: { type: 'string' }, file: { type: 'string' } },
1821
+ properties: { file: { type: 'string' } },
1720
1822
  additionalProperties: false
1721
1823
  }
1722
1824
  }
@@ -2122,7 +2224,6 @@ export const SCHEMAS = {
2122
2224
  label: { type: 'string', pattern: '\\S' },
2123
2225
  api_code: { type: 'string' },
2124
2226
  cid: { type: 'string' },
2125
- required: { type: 'boolean' },
2126
2227
  choices: { type: 'array', items: { $ref: 'ChoiceInput' } }
2127
2228
  }
2128
2229
  },
@@ -2266,11 +2367,8 @@ export const SCHEMAS = {
2266
2367
  properties: {
2267
2368
  field_api_code: { type: 'string' },
2268
2369
  dimension_api_code: { type: 'string' },
2269
- attachment_token: { type: 'string' },
2270
2370
  base64: { type: 'string' },
2271
- data: { type: 'string' },
2272
2371
  file_name: { type: 'string' },
2273
- filename: { type: 'string' },
2274
2372
  content_type: { type: 'string' }
2275
2373
  },
2276
2374
  additionalProperties: false
@@ -3031,7 +3129,7 @@ export const SCHEMAS = {
3031
3129
  },
3032
3130
  by_entries_close_rule: {
3033
3131
  type: 'object',
3034
- properties: { limit: { type: 'integer' } },
3132
+ properties: { limit: { type: 'integer', maximum: 2147483647 } },
3035
3133
  additionalProperties: false
3036
3134
  },
3037
3135
  fill_frequency: { $ref: 'FormFillFrequencyInput' }
@@ -3067,7 +3165,7 @@ export const SCHEMAS = {
3067
3165
  },
3068
3166
  by_entries_close_rule: {
3069
3167
  type: ['object', 'null'],
3070
- properties: { enabled: { type: 'boolean' }, limit: { type: 'integer' } },
3168
+ properties: { enabled: { type: 'boolean' }, limit: { type: 'integer', maximum: 2147483647 } },
3071
3169
  additionalProperties: false
3072
3170
  },
3073
3171
  fill_frequency: {
@@ -3326,7 +3424,8 @@ export const SCHEMAS = {
3326
3424
  }
3327
3425
  },
3328
3426
  image_urls: { type: 'array', items: { type: 'string' } },
3329
- image_base64s: { type: 'array', items: { type: 'string' } }
3427
+ image_base64s: { type: 'array', items: { type: 'string' } },
3428
+ attachment_ids: { type: 'array', items: { type: 'string' } }
3330
3429
  },
3331
3430
  dependentRequired: { dimensions: ['skus'], skus: ['dimensions'] },
3332
3431
  allOf: [
@@ -3339,7 +3438,8 @@ export const SCHEMAS = {
3339
3438
  then: {
3340
3439
  anyOf: [
3341
3440
  { required: ['image_urls'], properties: { image_urls: { minItems: 1 } } },
3342
- { required: ['image_base64s'], properties: { image_base64s: { minItems: 1 } } }
3441
+ { required: ['image_base64s'], properties: { image_base64s: { minItems: 1 } } },
3442
+ { required: ['attachment_ids'], properties: { attachment_ids: { minItems: 1 } } }
3343
3443
  ]
3344
3444
  }
3345
3445
  }
@@ -3405,7 +3505,8 @@ export const SCHEMAS = {
3405
3505
  }
3406
3506
  },
3407
3507
  image_urls: { type: 'array', items: { type: 'string' } },
3408
- image_base64s: { type: 'array', items: { type: 'string' } }
3508
+ image_base64s: { type: 'array', items: { type: 'string' } },
3509
+ attachment_ids: { type: 'array', items: { type: 'string' } }
3409
3510
  },
3410
3511
  dependentRequired: { dimensions: ['skus'], skus: ['dimensions'] },
3411
3512
  if: { not: { required: ['api_code'] } },
@@ -3421,7 +3522,8 @@ export const SCHEMAS = {
3421
3522
  then: {
3422
3523
  anyOf: [
3423
3524
  { required: ['image_urls'], properties: { image_urls: { minItems: 1 } } },
3424
- { required: ['image_base64s'], properties: { image_base64s: { minItems: 1 } } }
3525
+ { required: ['image_base64s'], properties: { image_base64s: { minItems: 1 } } },
3526
+ { required: ['attachment_ids'], properties: { attachment_ids: { minItems: 1 } } }
3425
3527
  ]
3426
3528
  }
3427
3529
  }
@@ -3499,7 +3601,7 @@ export const SCHEMAS = {
3499
3601
  additionalProperties: false,
3500
3602
  allOf: [
3501
3603
  { anyOf: [{ required: ['value'] }, { required: ['name'] }] },
3502
- { anyOf: [{ required: ['image_url'] }, { required: ['image_base64'] }, { required: ['image_upload_token'] }] }
3604
+ { anyOf: [{ required: ['image_url'] }, { required: ['image_base64'] }, { required: ['attachment_id'] }] }
3503
3605
  ],
3504
3606
  properties: {
3505
3607
  value: { type: 'string' },
@@ -3509,7 +3611,7 @@ export const SCHEMAS = {
3509
3611
  selected: { type: 'boolean' },
3510
3612
  image_url: { type: 'string' },
3511
3613
  image_base64: { type: 'string' },
3512
- image_upload_token: { type: 'string' }
3614
+ attachment_id: { type: 'string' }
3513
3615
  }
3514
3616
  },
3515
3617
  ImageMultiSelectInput: {
@@ -3973,7 +4075,6 @@ export const SCHEMAS = {
3973
4075
  type: 'object',
3974
4076
  properties: {
3975
4077
  attachment_id: { type: 'string' },
3976
- image_upload_token: { type: 'string' },
3977
4078
  position_x: { type: 'number' },
3978
4079
  position_y: { type: 'number' }
3979
4080
  },
@@ -4046,6 +4147,14 @@ export const SCHEMAS = {
4046
4147
  properties: { label: { type: 'string' }, choices: { type: 'array', items: { type: 'string' } } },
4047
4148
  additionalProperties: false
4048
4149
  },
4150
+ PublishedArtifactInput: {
4151
+ type: 'object',
4152
+ additionalProperties: false,
4153
+ properties: {
4154
+ allowed_audience: { type: 'string', enum: ['private', 'internal', 'public'] },
4155
+ version_id: { type: 'string' }
4156
+ }
4157
+ },
4049
4158
  RadioButtonInput: {
4050
4159
  type: 'object',
4051
4160
  additionalProperties: false,
@@ -4316,6 +4425,7 @@ export const SCHEMAS = {
4316
4425
  type: 'object',
4317
4426
  properties: {
4318
4427
  name: { type: ['string', 'null'] },
4428
+ name_set_by_user: { type: ['boolean', 'null'] },
4319
4429
  description: { type: ['string', 'null'] },
4320
4430
  instruction: { type: ['string', 'null'] },
4321
4431
  objects: {
@@ -4492,6 +4602,41 @@ export const SCHEMAS = {
4492
4602
  show_part_description: { type: 'boolean' }
4493
4603
  }
4494
4604
  },
4605
+ SequenceFieldInput: {
4606
+ type: 'object',
4607
+ additionalProperties: false,
4608
+ required: ['type', 'label'],
4609
+ properties: {
4610
+ type: { const: 'SequenceField' },
4611
+ label: { type: 'string' },
4612
+ cid: { type: 'string' },
4613
+ notes: { type: 'string' },
4614
+ private: { type: 'boolean' },
4615
+ required: { type: 'boolean' },
4616
+ position: { type: 'integer', minimum: 0 },
4617
+ segments: { type: 'array', minItems: 1, items: { $ref: 'SequenceSegmentInput' } }
4618
+ }
4619
+ },
4620
+ SequenceSegmentInput: {
4621
+ type: 'object',
4622
+ additionalProperties: false,
4623
+ required: ['kind'],
4624
+ properties: {
4625
+ kind: { type: 'string', enum: ['fixed_text', 'field_value', 'sequence_number'] },
4626
+ value: { type: 'string', minLength: 1, maxLength: 6 },
4627
+ api_code: { type: 'string' },
4628
+ cid: { type: 'string' },
4629
+ digits: { type: 'integer', minimum: 1, maximum: 12 }
4630
+ },
4631
+ allOf: [
4632
+ { if: { properties: { kind: { const: 'fixed_text' } } }, then: { required: ['value'] } },
4633
+ {
4634
+ if: { properties: { kind: { const: 'field_value' } } },
4635
+ then: { anyOf: [{ required: ['api_code'] }, { required: ['cid'] }] }
4636
+ },
4637
+ { if: { properties: { kind: { const: 'sequence_number' } } }, then: { required: ['digits'] } }
4638
+ ]
4639
+ },
4495
4640
  ShortAnswerInput: {
4496
4641
  type: 'object',
4497
4642
  additionalProperties: false,
@@ -4605,7 +4750,8 @@ export const SCHEMAS = {
4605
4750
  'LinkField',
4606
4751
  'AttachmentField',
4607
4752
  'FormulaField',
4608
- 'RelationField'
4753
+ 'RelationField',
4754
+ 'SequenceField'
4609
4755
  ]
4610
4756
  },
4611
4757
  label: { type: 'string' }
@@ -4622,7 +4768,8 @@ export const SCHEMAS = {
4622
4768
  { $ref: 'LinkFieldInput' },
4623
4769
  { $ref: 'AttachmentFieldInput' },
4624
4770
  { $ref: 'FormulaFieldInput' },
4625
- { $ref: 'RelationFieldInput' }
4771
+ { $ref: 'RelationFieldInput' },
4772
+ { $ref: 'SequenceFieldInput' }
4626
4773
  ]
4627
4774
  },
4628
4775
  TableCreateInput: {
@@ -4748,7 +4895,6 @@ export const SCHEMAS = {
4748
4895
  properties: {
4749
4896
  background_color: { type: 'string' },
4750
4897
  background_image_url: { type: 'string' },
4751
- background_image_upload_token: { type: 'string' },
4752
4898
  background_image_attachment_id: { type: ['string', 'null'] }
4753
4899
  },
4754
4900
  additionalProperties: false
@@ -4762,18 +4908,13 @@ export const SCHEMAS = {
4762
4908
  text_style: { type: 'object', additionalProperties: { type: 'string' } },
4763
4909
  header_image_url: { type: 'string' },
4764
4910
  header_image_base64: { type: 'string' },
4765
- header_image_upload_token: { type: 'string' },
4766
4911
  carousel_images: {
4767
4912
  type: 'array',
4768
4913
  minItems: 1,
4769
4914
  maxItems: 5,
4770
4915
  items: {
4771
4916
  type: 'object',
4772
- properties: {
4773
- image_upload_token: { type: 'string' },
4774
- image_url: { type: 'string' },
4775
- attachment_id: { type: 'string' }
4776
- },
4917
+ properties: { image_url: { type: 'string' }, attachment_id: { type: 'string' } },
4777
4918
  additionalProperties: false
4778
4919
  }
4779
4920
  },
@@ -4957,12 +5098,8 @@ export const SCHEMAS = {
4957
5098
  WidgetImageInput: {
4958
5099
  type: 'object',
4959
5100
  additionalProperties: false,
4960
- anyOf: [{ required: ['image_url'] }, { required: ['image_base64'] }, { required: ['image_upload_token'] }],
4961
- properties: {
4962
- image_url: { type: 'string' },
4963
- image_base64: { type: 'string' },
4964
- image_upload_token: { type: 'string' }
4965
- }
5101
+ anyOf: [{ required: ['image_url'] }, { required: ['image_base64'] }, { required: ['attachment_id'] }],
5102
+ properties: { image_url: { type: 'string' }, image_base64: { type: 'string' }, attachment_id: { type: 'string' } }
4966
5103
  },
4967
5104
  WidgetMapInput: {
4968
5105
  type: 'object',
package/dist/http.js CHANGED
@@ -60,9 +60,11 @@ function snippet(text) {
60
60
  /**
61
61
  * What to say about a request the server refused.
62
62
  *
63
- * A server that stated a reason has it repeated verbatim, which is the whole of
64
- * the message and reads as it always did. Everything else falls back through
65
- * what the body does carry rather than to the HTTP status text: answering
63
+ * A server that stated a reason has it repeated verbatim, followed by the error
64
+ * code the body names, if any: a caller reading text output, as Jiri does, acts
65
+ * on the code (`paid_plan_required`) and cannot act on the prose. Everything
66
+ * else falls back through what the body does carry rather than to the HTTP
67
+ * status text: answering
66
68
  * "Unprocessable Entity" to a batch whose response named the offending row and
67
69
  * field is throwing away the only useful part of the answer.
68
70
  */
@@ -76,9 +78,14 @@ function describeFailure(response, text, parsed) {
76
78
  const body = parsed.value;
77
79
  const stated = body.message ?? body.error_description;
78
80
  if (typeof stated === 'string' && stated.trim())
79
- return everyReason(body, stated) ?? stated;
81
+ return withCode(everyReason(body, stated) ?? stated, body.error);
80
82
  return rowErrors(body) ?? `${status}: ${snippet(JSON.stringify(parsed.value))}`;
81
83
  }
84
+ function withCode(reason, code) {
85
+ if (typeof code !== 'string' || !code.trim() || reason.includes(code))
86
+ return reason;
87
+ return `${reason} (${code})`;
88
+ }
82
89
  /**
83
90
  * A refusal with several reasons that states only the first: a routine against
84
91
  * two of the page's rules answers `{error_description, errors: [{code, message}]}`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jinshuju/cli",
3
- "version": "0.16.0",
3
+ "version": "0.18.0",
4
4
  "description": "Command line interface for Jinshuju Open API v1",
5
5
  "homepage": "https://github.com/jinshuju/cli#readme",
6
6
  "bugs": {