@jinshuju/cli 0.17.0 → 0.19.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 +59 -2
- package/dist/cli.js +7 -3
- package/dist/commands/artifact.d.ts +2 -0
- package/dist/commands/artifact.js +133 -0
- package/dist/commands/email.js +2 -1
- package/dist/commands/index.js +10 -2
- package/dist/commands/notification.js +27 -13
- package/dist/commands/routine.js +1 -7
- package/dist/commands/shared.d.ts +2 -0
- package/dist/commands/shared.js +7 -0
- package/dist/commands/sms.js +77 -13
- package/dist/commands/types.d.ts +5 -0
- package/dist/commands/upload.js +1 -0
- package/dist/config.d.ts +1 -1
- package/dist/config.js +1 -1
- package/dist/generated/operations.d.ts +1 -1
- package/dist/generated/operations.js +162 -38
- package/dist/http.js +11 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -254,7 +254,7 @@ 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 --
|
|
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
259
|
jinshuju notification log 6650b2 --form Kp7mQ2 --from 2026-10-01 # what the rule sent: how many succeeded, failed, and why
|
|
260
260
|
```
|
|
@@ -466,7 +466,9 @@ how much a type conversion would keep and how much it would clear.
|
|
|
466
466
|
## SMS signatures and templates
|
|
467
467
|
|
|
468
468
|
An SMS notification needs a signature and a template, and both wait on a
|
|
469
|
-
review, so submit them as early as you can.
|
|
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
|
|
470
472
|
signature is still under review; `sms status` follows both, with the reason
|
|
471
473
|
when one is rejected.
|
|
472
474
|
|
|
@@ -477,13 +479,24 @@ review, can be changed and sent back to review; only the flags given change. The
|
|
|
477
479
|
same ones can be deleted with `--yes`; deleting a signature takes its templates
|
|
478
480
|
with it.
|
|
479
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
|
+
|
|
485
|
+
A template's variables are written `$(var_1)`, `$(var_2)` and so on, each once,
|
|
486
|
+
and each is declared with a `--variable <label>:<type>:<example>`;
|
|
487
|
+
the reviewer sees the examples, which take 6 characters or more. A notification or `sms send --placeholder` then
|
|
488
|
+
fills them from form fields in the order the content uses them.
|
|
489
|
+
|
|
480
490
|
```bash
|
|
481
491
|
jinshuju sms signature create 小金培训 --license ./license.jpg --company-name 小金培训有限公司 --company-id 91110000MA00000000 \
|
|
482
492
|
--id-card-front ./front.jpg --id-card-back ./back.jpg --id-card-name 张三 --id-card-number 110101199001011234 --mobile 13800000000
|
|
483
493
|
jinshuju sms template create --signature 小金培训 --content "你报名的课程明天上午 9 点开课,请准时参加。"
|
|
494
|
+
jinshuju sms template create --signature 小金培训 --content '$(var_1),你好,套餐 $(var_2) 到期。' \
|
|
495
|
+
--variable 姓名:name:姓名,示例:张三 --variable 到期日期:time:2026-10-25
|
|
484
496
|
jinshuju sms status
|
|
485
497
|
jinshuju sms signature list --status FAIL
|
|
486
498
|
jinshuju sms template list --keyword 开课 --scope owned
|
|
499
|
+
jinshuju sms template list --scope official
|
|
487
500
|
jinshuju sms signature update 6512a1c2d3e4f5a6b7c8d9d3 --license ./license-clear.jpg
|
|
488
501
|
jinshuju sms template update 6512a1c2d3e4f5a6b7c8d9e0 --content "你报名的课程后天上午 9 点开课。"
|
|
489
502
|
jinshuju sms template delete 6512a1c2d3e4f5a6b7c8d9e0 --yes
|
|
@@ -515,6 +528,50 @@ jinshuju email smtp-account list
|
|
|
515
528
|
jinshuju email send --form Kp7mQ2 --field field_3 --select-all --subject 上课提醒 --content '<p>明天上午 9 点开课</p>' --yes
|
|
516
529
|
```
|
|
517
530
|
|
|
531
|
+
## Artifacts
|
|
532
|
+
|
|
533
|
+
An artifact is a file Jiri made for you; any of your conversations can revise
|
|
534
|
+
it. `artifact list` lists the ones Jiri made for you in the account you are in,
|
|
535
|
+
newest first, one row per artifact however many versions it has. Each row
|
|
536
|
+
carries `conversation_url`, the Jiri conversation that delivered its latest
|
|
537
|
+
version, and `audience`, who its link is open to (empty when it was never
|
|
538
|
+
shared). In `--output json` the first is `latest_version.conversation_url`,
|
|
539
|
+
beside `created_conversation_url` (where the artifact was made) and
|
|
540
|
+
`latest_version.download_url`; the second is
|
|
541
|
+
`published_artifact.allowed_audience`, beside the version the link shows
|
|
542
|
+
(`published_version`). The link itself comes from `artifact share get`.
|
|
543
|
+
`--name` keeps the artifacts whose title
|
|
544
|
+
contains the keyword, case-insensitive; `--limit`, `--next` and `--all` page as
|
|
545
|
+
other listings do.
|
|
546
|
+
|
|
547
|
+
An HTML version can be shared by a link, and `artifact share set` says who can
|
|
548
|
+
open it: `private` (only you, the default), `internal` (members of your
|
|
549
|
+
account) or `public` (anyone with the link). A plan without share links is
|
|
550
|
+
refused with 402 by `artifact share get` and by sharing beyond `private`;
|
|
551
|
+
`internal` needs a plan with members-only sharing, and `artifact share get`
|
|
552
|
+
says whether the plan has it. The first `get` or `set` creates the link.
|
|
553
|
+
`artifact share get` and `--audience private` take the `id` of an
|
|
554
|
+
`artifact list` row. `--audience internal` and `public`
|
|
555
|
+
bind the link to a version, so `<artifact>` names one: the row's
|
|
556
|
+
`latest_version.id` (`version_id` in text), a version token, or the address of
|
|
557
|
+
the page that shows the version (`https://…/artifacts/<token>`). The artifact
|
|
558
|
+
id is refused there, since its latest version can change before the share is
|
|
559
|
+
made. To share another version of the same artifact, name that one.
|
|
560
|
+
`--audience private` keeps the version the link shows, whichever version
|
|
561
|
+
`<artifact>` names.
|
|
562
|
+
|
|
563
|
+
An OAuth session needs the `artifacts` scope, which `jinshuju auth login`
|
|
564
|
+
asks for; a session from an older CLI has to log in again. An account access
|
|
565
|
+
token is refused with 400: an artifact belongs to a person.
|
|
566
|
+
|
|
567
|
+
```bash
|
|
568
|
+
jinshuju artifact list --name 周报
|
|
569
|
+
jinshuju artifact share get https://next.jinshuju.net/artifacts/Xy7Qm2PaLk9W
|
|
570
|
+
jinshuju artifact share set Xy7Qm2PaLk9W --audience public
|
|
571
|
+
jinshuju artifact share set Pq4nR8sT2vWx --audience internal # now the link shows this version
|
|
572
|
+
jinshuju artifact share set Xy7Qm2PaLk9W --audience private # the link still shows Pq4nR8sT2vWx
|
|
573
|
+
```
|
|
574
|
+
|
|
518
575
|
## Odds and ends
|
|
519
576
|
|
|
520
577
|
```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
|
-
|
|
78
|
-
|
|
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,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
|
+
];
|
package/dist/commands/email.js
CHANGED
|
@@ -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
|
{
|
package/dist/commands/index.js
CHANGED
|
@@ -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
|
|
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) {
|
|
@@ -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: '--
|
|
24
|
-
type: '
|
|
25
|
-
placeholder: '<
|
|
26
|
-
description:
|
|
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.
|
|
44
|
-
placeholder_keys: input.options.
|
|
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
|
-
'
|
|
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 --
|
|
93
|
-
'jinshuju notification create --form Kp7mQ2 --approach SMS --recipients field_2 --
|
|
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
|
{
|
|
@@ -136,7 +149,8 @@ export const NOTIFICATION = [
|
|
|
136
149
|
path: ['notification', 'log'],
|
|
137
150
|
summary: 'List what a notification rule sent, with how many succeeded or failed and why',
|
|
138
151
|
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
|
|
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.',
|
|
140
154
|
args: [RULE_ARG],
|
|
141
155
|
options: [
|
|
142
156
|
FORM_OPTION,
|
|
@@ -154,7 +168,7 @@ export const NOTIFICATION = [
|
|
|
154
168
|
path: { form_token: requiredOption(input, 'form'), id: input.args.rule },
|
|
155
169
|
query: { status: input.options.status, ...dayRange(input), ...paging(input) }
|
|
156
170
|
}),
|
|
157
|
-
paginate: LISTING,
|
|
171
|
+
paginate: { ...LISTING, totals: ['triggered_count', 'summary'] },
|
|
158
172
|
examples: [
|
|
159
173
|
'jinshuju notification log 6650b2 --form Kp7mQ2',
|
|
160
174
|
'jinshuju notification log 6650b2 --form Kp7mQ2 --status FAILED --from 2026-10-01 --to 2026-10-31'
|
package/dist/commands/routine.js
CHANGED
|
@@ -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
|
|
@@ -68,6 +68,8 @@ export declare function refuseWithMine(input: CommandInput, flags: readonly stri
|
|
|
68
68
|
*/
|
|
69
69
|
export declare function keywords(value: unknown): readonly string[] | undefined;
|
|
70
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;
|
|
71
73
|
export declare function payload(input: CommandInput): unknown;
|
|
72
74
|
export declare function requiredOption(input: CommandInput, key: string): string;
|
|
73
75
|
/** Sending to entries belongs to a form: the API has no table counterpart. */
|
package/dist/commands/shared.js
CHANGED
|
@@ -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
|
|
@@ -120,6 +121,12 @@ export function keywords(value) {
|
|
|
120
121
|
return values && values.length > 0 ? values : undefined;
|
|
121
122
|
}
|
|
122
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
|
+
}
|
|
123
130
|
export function payload(input) {
|
|
124
131
|
const value = input.options.json;
|
|
125
132
|
if (value === undefined)
|
package/dist/commands/sms.js
CHANGED
|
@@ -3,7 +3,8 @@ import { progress } from '../progress.js';
|
|
|
3
3
|
import { bodyChoices, call, choices } from '../spec.js';
|
|
4
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 {
|
|
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
|
|
@@ -54,6 +55,23 @@ const TEMPLATE_DESCRIPTION_OPTION = {
|
|
|
54
55
|
placeholder: '<text>',
|
|
55
56
|
description: 'What the SMS is for, shown to the reviewer'
|
|
56
57
|
};
|
|
58
|
+
const TEMPLATE_VARIABLE_OPTION = {
|
|
59
|
+
name: '--variable',
|
|
60
|
+
type: 'string',
|
|
61
|
+
repeatable: true,
|
|
62
|
+
placeholder: '<label>:<type>:<example>',
|
|
63
|
+
description: 'Declare the next of $(var_1), $(var_2)... the content uses, repeatable in that order; type is one of ' +
|
|
64
|
+
'code, nickname, name, address, amount, link, time, other, e.g. 姓名:name:姓名,示例:张三; the example takes 6 characters or more'
|
|
65
|
+
};
|
|
66
|
+
const VARIABLE_SHAPE = "--variable must be '<label>:<type>:<example>'";
|
|
67
|
+
/** `姓名:name:姓名,示例:张三`; the example keeps any further `:`, as a time or a link has. */
|
|
68
|
+
function parseVariable(input) {
|
|
69
|
+
const [label, type, ...rest] = input.split(':');
|
|
70
|
+
const example = rest.join(':');
|
|
71
|
+
if (!label || !type || !example)
|
|
72
|
+
throw new UsageError(`${VARIABLE_SHAPE}, got ${JSON.stringify(input)}`);
|
|
73
|
+
return { label, type, example };
|
|
74
|
+
}
|
|
57
75
|
function requiredOption(input, key, flag) {
|
|
58
76
|
const value = input.options[key];
|
|
59
77
|
if (!value)
|
|
@@ -63,6 +81,29 @@ function requiredOption(input, key, flag) {
|
|
|
63
81
|
function licensesOf(input) {
|
|
64
82
|
return input.options.license ?? [];
|
|
65
83
|
}
|
|
84
|
+
const LICENSE_EXTENSIONS = ['.jpg', '.jpeg', '.png', '.bmp'];
|
|
85
|
+
const LICENSE_MAX_BYTES = 5 * 1024 * 1024;
|
|
86
|
+
/**
|
|
87
|
+
* Every image is checked before the first goes up: once one is uploaded, a
|
|
88
|
+
* failure on the next leaves it behind, and running the command again sends
|
|
89
|
+
* the license and ID card images a second time.
|
|
90
|
+
*/
|
|
91
|
+
function checkLicenseFiles(files) {
|
|
92
|
+
for (const file of files) {
|
|
93
|
+
if (!LICENSE_EXTENSIONS.includes(extname(file).toLowerCase())) {
|
|
94
|
+
throw new UsageError(`${file} is not a jpg, jpeg, png or bmp image`);
|
|
95
|
+
}
|
|
96
|
+
let size;
|
|
97
|
+
try {
|
|
98
|
+
size = statSync(file).size;
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
throw new UsageError(`could not read ${file}: ${error.message}`);
|
|
102
|
+
}
|
|
103
|
+
if (size > LICENSE_MAX_BYTES)
|
|
104
|
+
throw new UsageError(`${file} is over 5 MB`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
66
107
|
async function uploadLicense(client, file) {
|
|
67
108
|
const watching = progress();
|
|
68
109
|
watching.step(`uploading ${basename(file)}…`);
|
|
@@ -85,6 +126,8 @@ async function signatureMaterials(input, client) {
|
|
|
85
126
|
body[key] = input.options[option];
|
|
86
127
|
}
|
|
87
128
|
const licenses = licensesOf(input);
|
|
129
|
+
const idCards = SIGNATURE_FILES.map(({ option }) => input.options[option]);
|
|
130
|
+
checkLicenseFiles([...licenses, ...idCards.filter((file) => Boolean(file))]);
|
|
88
131
|
if (licenses.length > 0) {
|
|
89
132
|
const ids = [];
|
|
90
133
|
for (const license of licenses)
|
|
@@ -149,6 +192,9 @@ function templateBody(input) {
|
|
|
149
192
|
body.content = input.options.content;
|
|
150
193
|
if (input.options.description !== undefined)
|
|
151
194
|
body.apply_description = input.options.description;
|
|
195
|
+
const variables = input.options.variable;
|
|
196
|
+
if (variables?.length)
|
|
197
|
+
body.variables = variables.map(parseVariable);
|
|
152
198
|
return body;
|
|
153
199
|
}
|
|
154
200
|
/**
|
|
@@ -182,7 +228,8 @@ export const SMS = [
|
|
|
182
228
|
path: ['sms', 'status'],
|
|
183
229
|
summary: 'List SMS signatures and templates with their review status and why a review failed',
|
|
184
230
|
description: 'Your own signatures and templates, not those of the rest of the account. ' +
|
|
185
|
-
'
|
|
231
|
+
'To pick a template to send, use `sms template list`, which also has the ones the account shares and the ' +
|
|
232
|
+
'official ones.',
|
|
186
233
|
request: () => call('listSmsAuditStatuses'),
|
|
187
234
|
render: templatesForReading
|
|
188
235
|
},
|
|
@@ -212,6 +259,8 @@ export const SMS = [
|
|
|
212
259
|
summary: 'Apply for an SMS signature and submit it for review',
|
|
213
260
|
description: 'Uploads the license images and applies with them in one command. Review takes a while: follow it with ' +
|
|
214
261
|
'`sms signature list`. A signature the account already has under review or approved is answered as it is. ' +
|
|
262
|
+
"The materials replace your ID card information, and the account's business license unless the account " +
|
|
263
|
+
'has passed license verification. ' +
|
|
215
264
|
'For SMS notifications leave --type out. --type verification applies for a signature that only replaces ' +
|
|
216
265
|
'the default 金数据 signature on the verification-code SMS of mobile fields: it cannot send notifications or ' +
|
|
217
266
|
'have templates, and verification codes already work without one.',
|
|
@@ -278,22 +327,25 @@ export const SMS = [
|
|
|
278
327
|
},
|
|
279
328
|
{
|
|
280
329
|
path: ['sms', 'template', 'list'],
|
|
281
|
-
summary: 'List your SMS templates
|
|
330
|
+
summary: 'List your SMS templates, the ones the account shares and the official ones',
|
|
282
331
|
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
|
|
332
|
+
'another member and can only be sent; scope official is approved already and can be sent right away, even ' +
|
|
333
|
+
'while your own signature and templates are under review. Official ones come last, with scene marking the ' +
|
|
334
|
+
'forms they are worded for: form ones suit any form, and any form can send with any of them. variables are ' +
|
|
335
|
+
'in the order `--placeholder` fills them when sending.',
|
|
284
336
|
options: [
|
|
285
337
|
{
|
|
286
338
|
name: '--keyword',
|
|
287
339
|
type: 'string',
|
|
288
340
|
placeholder: '<kw>',
|
|
289
|
-
description: 'Match the content or the signature, case-insensitive and partial'
|
|
341
|
+
description: 'Match the content or the signature, case-insensitive and partial; only the content of official ones'
|
|
290
342
|
},
|
|
291
343
|
{
|
|
292
344
|
name: '--scope',
|
|
293
345
|
type: 'string',
|
|
294
346
|
choices: choices('listSmsTemplates', 'scope'),
|
|
295
347
|
placeholder: '<scope>',
|
|
296
|
-
description: 'owned (yours)
|
|
348
|
+
description: 'owned (yours), shared (shared by another member) or official; all three when omitted'
|
|
297
349
|
},
|
|
298
350
|
{
|
|
299
351
|
name: '--signature-id',
|
|
@@ -320,13 +372,18 @@ export const SMS = [
|
|
|
320
372
|
}
|
|
321
373
|
}),
|
|
322
374
|
paginate: LISTING,
|
|
323
|
-
examples: [
|
|
375
|
+
examples: [
|
|
376
|
+
'jinshuju sms template list --keyword 开课',
|
|
377
|
+
'jinshuju sms template list --scope owned --status FAIL',
|
|
378
|
+
'jinshuju sms template list --scope official'
|
|
379
|
+
]
|
|
324
380
|
},
|
|
325
381
|
{
|
|
326
382
|
path: ['sms', 'template', 'create'],
|
|
327
383
|
summary: 'Submit an SMS template for review',
|
|
328
384
|
description: 'The signature must have been applied for, though it need not be approved yet. Review takes a while: ' +
|
|
329
|
-
'follow it with `sms status`. Once approved, the template id is what a notification sends.'
|
|
385
|
+
'follow it with `sms status`. Once approved, the template id is what a notification sends. Variables are ' +
|
|
386
|
+
'written $(var_1), $(var_2)... in the content, each once, and each declared with --variable.',
|
|
330
387
|
options: [
|
|
331
388
|
{ name: '--signature', type: 'string', placeholder: '<signature>', description: 'Signature to send it under' },
|
|
332
389
|
{
|
|
@@ -335,7 +392,8 @@ export const SMS = [
|
|
|
335
392
|
placeholder: '<text>',
|
|
336
393
|
description: 'Template content, without the signature'
|
|
337
394
|
},
|
|
338
|
-
TEMPLATE_DESCRIPTION_OPTION
|
|
395
|
+
TEMPLATE_DESCRIPTION_OPTION,
|
|
396
|
+
TEMPLATE_VARIABLE_OPTION
|
|
339
397
|
],
|
|
340
398
|
request: (input) => {
|
|
341
399
|
requiredOption(input, 'signature', '--signature <signature>');
|
|
@@ -343,14 +401,18 @@ export const SMS = [
|
|
|
343
401
|
return call('createSmsTemplate', { body: templateBody(input) });
|
|
344
402
|
},
|
|
345
403
|
examples: [
|
|
346
|
-
'jinshuju sms template create --signature 小金培训 --content "你报名的课程明天上午 9 点开课,请准时参加。"'
|
|
404
|
+
'jinshuju sms template create --signature 小金培训 --content "你报名的课程明天上午 9 点开课,请准时参加。"',
|
|
405
|
+
"jinshuju sms template create --signature 小金培训 --content '$(var_1),你好,套餐 $(var_2) 到期。' " +
|
|
406
|
+
'--variable 姓名:name:姓名,示例:张三 --variable 到期日期:time:2026-10-25'
|
|
347
407
|
]
|
|
348
408
|
},
|
|
349
409
|
{
|
|
350
410
|
path: ['sms', 'template', 'update'],
|
|
351
411
|
summary: 'Change an SMS template and submit it for review again',
|
|
352
412
|
description: 'Not while it is under review. Only the flags given change; with none, it is submitted again as it is. ' +
|
|
353
|
-
'An approved template goes back to review and cannot be sent until approved again.'
|
|
413
|
+
'An approved template goes back to review and cannot be sent until approved again. Changing the variables ' +
|
|
414
|
+
'of the content takes a --variable for each; while a notification or an SMS task sends the template, only ' +
|
|
415
|
+
'the text around them can change.',
|
|
354
416
|
args: [{ name: 'id', required: true, description: 'Template id, from `sms template list`' }],
|
|
355
417
|
options: [
|
|
356
418
|
{
|
|
@@ -360,7 +422,8 @@ export const SMS = [
|
|
|
360
422
|
description: 'Send it under this signature instead'
|
|
361
423
|
},
|
|
362
424
|
{ name: '--content', type: 'string', placeholder: '<text>', description: 'New content, without the signature' },
|
|
363
|
-
TEMPLATE_DESCRIPTION_OPTION
|
|
425
|
+
TEMPLATE_DESCRIPTION_OPTION,
|
|
426
|
+
TEMPLATE_VARIABLE_OPTION
|
|
364
427
|
],
|
|
365
428
|
request: (input) => call('updateSmsTemplate', { path: { id: input.args.id }, body: templateBody(input) }),
|
|
366
429
|
examples: ['jinshuju sms template update 6512a1c2d3e4f5a6b7c8d9e0 --content "你报名的课程后天上午 9 点开课。"']
|
|
@@ -384,7 +447,8 @@ export const SMS = [
|
|
|
384
447
|
'mobile field --field names. --estimate answers how many entries and numbers it reaches, how many are missing ' +
|
|
385
448
|
'a number, the SMS it bills and whether the quota covers them, and sends nothing; --yes sends. The entries are ' +
|
|
386
449
|
'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.'
|
|
450
|
+
'taken, and the task waits for it. Sent SMS cannot be recalled: after a timeout or a dropped connection, ' +
|
|
451
|
+
'look for the task in `sms task list` before sending again, or it may go out twice.',
|
|
388
452
|
options: [
|
|
389
453
|
FORM_OPTION,
|
|
390
454
|
MOBILE_FIELD_OPTION,
|
package/dist/commands/types.d.ts
CHANGED
|
@@ -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>;
|
package/dist/commands/upload.js
CHANGED
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' | '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';
|
|
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: {
|
|
@@ -1119,7 +1134,7 @@ export const OPERATIONS = {
|
|
|
1119
1134
|
path: '/sms/templates',
|
|
1120
1135
|
parameters: [
|
|
1121
1136
|
{ name: 'q', in: 'query', schema: { type: 'string' } },
|
|
1122
|
-
{ name: 'scope', in: 'query', schema: { type: 'string', enum: ['owned', 'shared'] } },
|
|
1137
|
+
{ name: 'scope', in: 'query', schema: { type: 'string', enum: ['owned', 'shared', 'official'] } },
|
|
1123
1138
|
{ name: 'signature_id', in: 'query', schema: { type: 'string' } },
|
|
1124
1139
|
{ name: 'status', in: 'query', schema: { type: 'string', enum: ['CHECKING', 'SUCCESS', 'FAIL'] } },
|
|
1125
1140
|
{ name: 'limit', in: 'query', schema: { type: 'integer' } },
|
|
@@ -1291,6 +1306,57 @@ export const OPERATIONS = {
|
|
|
1291
1306
|
path: '/routines/{routine_id}/pause',
|
|
1292
1307
|
parameters: [{ name: 'routine_id', in: 'path', required: true, schema: { type: 'string' } }]
|
|
1293
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
|
+
},
|
|
1294
1360
|
previewFormFieldTypeChange: {
|
|
1295
1361
|
method: 'GET',
|
|
1296
1362
|
path: '/forms/{form_token}/fields/preview_convert',
|
|
@@ -1601,6 +1667,12 @@ export const OPERATIONS = {
|
|
|
1601
1667
|
}
|
|
1602
1668
|
}
|
|
1603
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
|
+
},
|
|
1604
1676
|
updateRoutine: {
|
|
1605
1677
|
method: 'PATCH',
|
|
1606
1678
|
path: '/routines/{id}',
|
|
@@ -1694,12 +1766,9 @@ export const OPERATIONS = {
|
|
|
1694
1766
|
properties: {
|
|
1695
1767
|
field_api_code: { type: 'string' },
|
|
1696
1768
|
dimension_api_code: { type: 'string' },
|
|
1697
|
-
attachment_token: { type: 'string' },
|
|
1698
1769
|
file: { type: 'string' },
|
|
1699
1770
|
base64: { type: 'string' },
|
|
1700
|
-
data: { type: 'string' },
|
|
1701
1771
|
file_name: { type: 'string' },
|
|
1702
|
-
filename: { type: 'string' },
|
|
1703
1772
|
content_type: { type: 'string' }
|
|
1704
1773
|
},
|
|
1705
1774
|
additionalProperties: false
|
|
@@ -1717,13 +1786,21 @@ export const OPERATIONS = {
|
|
|
1717
1786
|
content: {
|
|
1718
1787
|
'multipart/form-data': {
|
|
1719
1788
|
type: 'object',
|
|
1720
|
-
required: ['file'],
|
|
1789
|
+
required: ['image_type', 'file'],
|
|
1721
1790
|
properties: {
|
|
1722
1791
|
image_type: {
|
|
1723
1792
|
type: 'string',
|
|
1724
|
-
enum: [
|
|
1793
|
+
enum: [
|
|
1794
|
+
'field_choice',
|
|
1795
|
+
'header',
|
|
1796
|
+
'wallpaper',
|
|
1797
|
+
'carousel',
|
|
1798
|
+
'opensearch_header',
|
|
1799
|
+
'description',
|
|
1800
|
+
'goods_item',
|
|
1801
|
+
'contact_widget'
|
|
1802
|
+
]
|
|
1725
1803
|
},
|
|
1726
|
-
form_image_token: { type: 'string' },
|
|
1727
1804
|
file: { type: 'string' }
|
|
1728
1805
|
},
|
|
1729
1806
|
additionalProperties: false
|
|
@@ -1741,7 +1818,7 @@ export const OPERATIONS = {
|
|
|
1741
1818
|
'multipart/form-data': {
|
|
1742
1819
|
type: 'object',
|
|
1743
1820
|
required: ['file'],
|
|
1744
|
-
properties: {
|
|
1821
|
+
properties: { file: { type: 'string' } },
|
|
1745
1822
|
additionalProperties: false
|
|
1746
1823
|
}
|
|
1747
1824
|
}
|
|
@@ -2147,7 +2224,6 @@ export const SCHEMAS = {
|
|
|
2147
2224
|
label: { type: 'string', pattern: '\\S' },
|
|
2148
2225
|
api_code: { type: 'string' },
|
|
2149
2226
|
cid: { type: 'string' },
|
|
2150
|
-
required: { type: 'boolean' },
|
|
2151
2227
|
choices: { type: 'array', items: { $ref: 'ChoiceInput' } }
|
|
2152
2228
|
}
|
|
2153
2229
|
},
|
|
@@ -2291,11 +2367,8 @@ export const SCHEMAS = {
|
|
|
2291
2367
|
properties: {
|
|
2292
2368
|
field_api_code: { type: 'string' },
|
|
2293
2369
|
dimension_api_code: { type: 'string' },
|
|
2294
|
-
attachment_token: { type: 'string' },
|
|
2295
2370
|
base64: { type: 'string' },
|
|
2296
|
-
data: { type: 'string' },
|
|
2297
2371
|
file_name: { type: 'string' },
|
|
2298
|
-
filename: { type: 'string' },
|
|
2299
2372
|
content_type: { type: 'string' }
|
|
2300
2373
|
},
|
|
2301
2374
|
additionalProperties: false
|
|
@@ -3056,7 +3129,7 @@ export const SCHEMAS = {
|
|
|
3056
3129
|
},
|
|
3057
3130
|
by_entries_close_rule: {
|
|
3058
3131
|
type: 'object',
|
|
3059
|
-
properties: { limit: { type: 'integer' } },
|
|
3132
|
+
properties: { limit: { type: 'integer', maximum: 2147483647 } },
|
|
3060
3133
|
additionalProperties: false
|
|
3061
3134
|
},
|
|
3062
3135
|
fill_frequency: { $ref: 'FormFillFrequencyInput' }
|
|
@@ -3092,7 +3165,7 @@ export const SCHEMAS = {
|
|
|
3092
3165
|
},
|
|
3093
3166
|
by_entries_close_rule: {
|
|
3094
3167
|
type: ['object', 'null'],
|
|
3095
|
-
properties: { enabled: { type: 'boolean' }, limit: { type: 'integer' } },
|
|
3168
|
+
properties: { enabled: { type: 'boolean' }, limit: { type: 'integer', maximum: 2147483647 } },
|
|
3096
3169
|
additionalProperties: false
|
|
3097
3170
|
},
|
|
3098
3171
|
fill_frequency: {
|
|
@@ -3351,7 +3424,8 @@ export const SCHEMAS = {
|
|
|
3351
3424
|
}
|
|
3352
3425
|
},
|
|
3353
3426
|
image_urls: { type: 'array', items: { type: 'string' } },
|
|
3354
|
-
image_base64s: { type: 'array', items: { type: 'string' } }
|
|
3427
|
+
image_base64s: { type: 'array', items: { type: 'string' } },
|
|
3428
|
+
attachment_ids: { type: 'array', items: { type: 'string' } }
|
|
3355
3429
|
},
|
|
3356
3430
|
dependentRequired: { dimensions: ['skus'], skus: ['dimensions'] },
|
|
3357
3431
|
allOf: [
|
|
@@ -3364,7 +3438,8 @@ export const SCHEMAS = {
|
|
|
3364
3438
|
then: {
|
|
3365
3439
|
anyOf: [
|
|
3366
3440
|
{ required: ['image_urls'], properties: { image_urls: { minItems: 1 } } },
|
|
3367
|
-
{ 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 } } }
|
|
3368
3443
|
]
|
|
3369
3444
|
}
|
|
3370
3445
|
}
|
|
@@ -3430,7 +3505,8 @@ export const SCHEMAS = {
|
|
|
3430
3505
|
}
|
|
3431
3506
|
},
|
|
3432
3507
|
image_urls: { type: 'array', items: { type: 'string' } },
|
|
3433
|
-
image_base64s: { type: 'array', items: { type: 'string' } }
|
|
3508
|
+
image_base64s: { type: 'array', items: { type: 'string' } },
|
|
3509
|
+
attachment_ids: { type: 'array', items: { type: 'string' } }
|
|
3434
3510
|
},
|
|
3435
3511
|
dependentRequired: { dimensions: ['skus'], skus: ['dimensions'] },
|
|
3436
3512
|
if: { not: { required: ['api_code'] } },
|
|
@@ -3446,7 +3522,8 @@ export const SCHEMAS = {
|
|
|
3446
3522
|
then: {
|
|
3447
3523
|
anyOf: [
|
|
3448
3524
|
{ required: ['image_urls'], properties: { image_urls: { minItems: 1 } } },
|
|
3449
|
-
{ 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 } } }
|
|
3450
3527
|
]
|
|
3451
3528
|
}
|
|
3452
3529
|
}
|
|
@@ -3524,7 +3601,7 @@ export const SCHEMAS = {
|
|
|
3524
3601
|
additionalProperties: false,
|
|
3525
3602
|
allOf: [
|
|
3526
3603
|
{ anyOf: [{ required: ['value'] }, { required: ['name'] }] },
|
|
3527
|
-
{ anyOf: [{ required: ['image_url'] }, { required: ['image_base64'] }, { required: ['
|
|
3604
|
+
{ anyOf: [{ required: ['image_url'] }, { required: ['image_base64'] }, { required: ['attachment_id'] }] }
|
|
3528
3605
|
],
|
|
3529
3606
|
properties: {
|
|
3530
3607
|
value: { type: 'string' },
|
|
@@ -3534,7 +3611,7 @@ export const SCHEMAS = {
|
|
|
3534
3611
|
selected: { type: 'boolean' },
|
|
3535
3612
|
image_url: { type: 'string' },
|
|
3536
3613
|
image_base64: { type: 'string' },
|
|
3537
|
-
|
|
3614
|
+
attachment_id: { type: 'string' }
|
|
3538
3615
|
}
|
|
3539
3616
|
},
|
|
3540
3617
|
ImageMultiSelectInput: {
|
|
@@ -3998,7 +4075,6 @@ export const SCHEMAS = {
|
|
|
3998
4075
|
type: 'object',
|
|
3999
4076
|
properties: {
|
|
4000
4077
|
attachment_id: { type: 'string' },
|
|
4001
|
-
image_upload_token: { type: 'string' },
|
|
4002
4078
|
position_x: { type: 'number' },
|
|
4003
4079
|
position_y: { type: 'number' }
|
|
4004
4080
|
},
|
|
@@ -4071,6 +4147,14 @@ export const SCHEMAS = {
|
|
|
4071
4147
|
properties: { label: { type: 'string' }, choices: { type: 'array', items: { type: 'string' } } },
|
|
4072
4148
|
additionalProperties: false
|
|
4073
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
|
+
},
|
|
4074
4158
|
RadioButtonInput: {
|
|
4075
4159
|
type: 'object',
|
|
4076
4160
|
additionalProperties: false,
|
|
@@ -4341,6 +4425,7 @@ export const SCHEMAS = {
|
|
|
4341
4425
|
type: 'object',
|
|
4342
4426
|
properties: {
|
|
4343
4427
|
name: { type: ['string', 'null'] },
|
|
4428
|
+
name_set_by_user: { type: ['boolean', 'null'] },
|
|
4344
4429
|
description: { type: ['string', 'null'] },
|
|
4345
4430
|
instruction: { type: ['string', 'null'] },
|
|
4346
4431
|
objects: {
|
|
@@ -4454,7 +4539,8 @@ export const SCHEMAS = {
|
|
|
4454
4539
|
properties: {
|
|
4455
4540
|
signature: { type: 'string' },
|
|
4456
4541
|
content: { type: 'string' },
|
|
4457
|
-
apply_description: { type: 'string', maxLength: 200 }
|
|
4542
|
+
apply_description: { type: 'string', maxLength: 200 },
|
|
4543
|
+
variables: { type: 'array', minItems: 1, items: { $ref: 'SMSTemplateVariableInput' } }
|
|
4458
4544
|
},
|
|
4459
4545
|
additionalProperties: false
|
|
4460
4546
|
},
|
|
@@ -4463,7 +4549,18 @@ export const SCHEMAS = {
|
|
|
4463
4549
|
properties: {
|
|
4464
4550
|
signature: { type: 'string' },
|
|
4465
4551
|
content: { type: 'string' },
|
|
4466
|
-
apply_description: { type: 'string', maxLength: 200 }
|
|
4552
|
+
apply_description: { type: 'string', maxLength: 200 },
|
|
4553
|
+
variables: { type: 'array', minItems: 1, items: { $ref: 'SMSTemplateVariableInput' } }
|
|
4554
|
+
},
|
|
4555
|
+
additionalProperties: false
|
|
4556
|
+
},
|
|
4557
|
+
SMSTemplateVariableInput: {
|
|
4558
|
+
type: 'object',
|
|
4559
|
+
required: ['label', 'type', 'example'],
|
|
4560
|
+
properties: {
|
|
4561
|
+
label: { type: 'string', pattern: '\\S' },
|
|
4562
|
+
type: { type: 'string', enum: ['code', 'nickname', 'name', 'address', 'amount', 'link', 'time', 'other'] },
|
|
4563
|
+
example: { type: 'string', minLength: 6, pattern: '\\S' }
|
|
4467
4564
|
},
|
|
4468
4565
|
additionalProperties: false
|
|
4469
4566
|
},
|
|
@@ -4517,6 +4614,41 @@ export const SCHEMAS = {
|
|
|
4517
4614
|
show_part_description: { type: 'boolean' }
|
|
4518
4615
|
}
|
|
4519
4616
|
},
|
|
4617
|
+
SequenceFieldInput: {
|
|
4618
|
+
type: 'object',
|
|
4619
|
+
additionalProperties: false,
|
|
4620
|
+
required: ['type', 'label'],
|
|
4621
|
+
properties: {
|
|
4622
|
+
type: { const: 'SequenceField' },
|
|
4623
|
+
label: { type: 'string' },
|
|
4624
|
+
cid: { type: 'string' },
|
|
4625
|
+
notes: { type: 'string' },
|
|
4626
|
+
private: { type: 'boolean' },
|
|
4627
|
+
required: { type: 'boolean' },
|
|
4628
|
+
position: { type: 'integer', minimum: 0 },
|
|
4629
|
+
segments: { type: 'array', minItems: 1, items: { $ref: 'SequenceSegmentInput' } }
|
|
4630
|
+
}
|
|
4631
|
+
},
|
|
4632
|
+
SequenceSegmentInput: {
|
|
4633
|
+
type: 'object',
|
|
4634
|
+
additionalProperties: false,
|
|
4635
|
+
required: ['kind'],
|
|
4636
|
+
properties: {
|
|
4637
|
+
kind: { type: 'string', enum: ['fixed_text', 'field_value', 'sequence_number'] },
|
|
4638
|
+
value: { type: 'string', minLength: 1, maxLength: 6 },
|
|
4639
|
+
api_code: { type: 'string' },
|
|
4640
|
+
cid: { type: 'string' },
|
|
4641
|
+
digits: { type: 'integer', minimum: 1, maximum: 12 }
|
|
4642
|
+
},
|
|
4643
|
+
allOf: [
|
|
4644
|
+
{ if: { properties: { kind: { const: 'fixed_text' } } }, then: { required: ['value'] } },
|
|
4645
|
+
{
|
|
4646
|
+
if: { properties: { kind: { const: 'field_value' } } },
|
|
4647
|
+
then: { anyOf: [{ required: ['api_code'] }, { required: ['cid'] }] }
|
|
4648
|
+
},
|
|
4649
|
+
{ if: { properties: { kind: { const: 'sequence_number' } } }, then: { required: ['digits'] } }
|
|
4650
|
+
]
|
|
4651
|
+
},
|
|
4520
4652
|
ShortAnswerInput: {
|
|
4521
4653
|
type: 'object',
|
|
4522
4654
|
additionalProperties: false,
|
|
@@ -4630,7 +4762,8 @@ export const SCHEMAS = {
|
|
|
4630
4762
|
'LinkField',
|
|
4631
4763
|
'AttachmentField',
|
|
4632
4764
|
'FormulaField',
|
|
4633
|
-
'RelationField'
|
|
4765
|
+
'RelationField',
|
|
4766
|
+
'SequenceField'
|
|
4634
4767
|
]
|
|
4635
4768
|
},
|
|
4636
4769
|
label: { type: 'string' }
|
|
@@ -4647,7 +4780,8 @@ export const SCHEMAS = {
|
|
|
4647
4780
|
{ $ref: 'LinkFieldInput' },
|
|
4648
4781
|
{ $ref: 'AttachmentFieldInput' },
|
|
4649
4782
|
{ $ref: 'FormulaFieldInput' },
|
|
4650
|
-
{ $ref: 'RelationFieldInput' }
|
|
4783
|
+
{ $ref: 'RelationFieldInput' },
|
|
4784
|
+
{ $ref: 'SequenceFieldInput' }
|
|
4651
4785
|
]
|
|
4652
4786
|
},
|
|
4653
4787
|
TableCreateInput: {
|
|
@@ -4773,7 +4907,6 @@ export const SCHEMAS = {
|
|
|
4773
4907
|
properties: {
|
|
4774
4908
|
background_color: { type: 'string' },
|
|
4775
4909
|
background_image_url: { type: 'string' },
|
|
4776
|
-
background_image_upload_token: { type: 'string' },
|
|
4777
4910
|
background_image_attachment_id: { type: ['string', 'null'] }
|
|
4778
4911
|
},
|
|
4779
4912
|
additionalProperties: false
|
|
@@ -4787,18 +4920,13 @@ export const SCHEMAS = {
|
|
|
4787
4920
|
text_style: { type: 'object', additionalProperties: { type: 'string' } },
|
|
4788
4921
|
header_image_url: { type: 'string' },
|
|
4789
4922
|
header_image_base64: { type: 'string' },
|
|
4790
|
-
header_image_upload_token: { type: 'string' },
|
|
4791
4923
|
carousel_images: {
|
|
4792
4924
|
type: 'array',
|
|
4793
4925
|
minItems: 1,
|
|
4794
4926
|
maxItems: 5,
|
|
4795
4927
|
items: {
|
|
4796
4928
|
type: 'object',
|
|
4797
|
-
properties: {
|
|
4798
|
-
image_upload_token: { type: 'string' },
|
|
4799
|
-
image_url: { type: 'string' },
|
|
4800
|
-
attachment_id: { type: 'string' }
|
|
4801
|
-
},
|
|
4929
|
+
properties: { image_url: { type: 'string' }, attachment_id: { type: 'string' } },
|
|
4802
4930
|
additionalProperties: false
|
|
4803
4931
|
}
|
|
4804
4932
|
},
|
|
@@ -4982,12 +5110,8 @@ export const SCHEMAS = {
|
|
|
4982
5110
|
WidgetImageInput: {
|
|
4983
5111
|
type: 'object',
|
|
4984
5112
|
additionalProperties: false,
|
|
4985
|
-
anyOf: [{ required: ['image_url'] }, { required: ['image_base64'] }, { required: ['
|
|
4986
|
-
properties: {
|
|
4987
|
-
image_url: { type: 'string' },
|
|
4988
|
-
image_base64: { type: 'string' },
|
|
4989
|
-
image_upload_token: { type: 'string' }
|
|
4990
|
-
}
|
|
5113
|
+
anyOf: [{ required: ['image_url'] }, { required: ['image_base64'] }, { required: ['attachment_id'] }],
|
|
5114
|
+
properties: { image_url: { type: 'string' }, image_base64: { type: 'string' }, attachment_id: { type: 'string' } }
|
|
4991
5115
|
},
|
|
4992
5116
|
WidgetMapInput: {
|
|
4993
5117
|
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,
|
|
64
|
-
* the
|
|
65
|
-
*
|
|
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}]}`
|