@jinshuju/cli 0.28.0 → 0.29.1

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
@@ -331,8 +331,9 @@ rejected when combined with `--mine`.
331
331
 
332
332
  ## Filling in someone else's form
333
333
 
334
- A fill link — `…/f/<token>` for a form, `…/v/<token>` for a table's form view —
335
- can be filled from the CLI the way anyone with the link fills it in a browser:
334
+ A fill link — `…/f/<token>` for a form, `…/v/<token>` for a table's form view,
335
+ `…/pf/<token>` for a pseudo form — can be filled from the CLI the way anyone with
336
+ the link fills it in a browser:
336
337
 
337
338
  ```bash
338
339
  jinshuju fill get https://acme.jinshuju.net/v/aB3dE9 # what it asks for, and whether you can submit
@@ -345,6 +346,26 @@ person at it can do — a captcha, an SMS code, WeChat, a payment — lists it u
345
346
  `blockers`, and is refused until it is filled in a browser. An OAuth session
346
347
  needs the `submit_entries` scope for these.
347
348
 
349
+ ## Prefilled links (pseudo forms)
350
+
351
+ A pseudo form (预填写) is a fill link that opens the form with some fields
352
+ already filled in, such as one link per person to be reviewed. An entry
353
+ submitted through it keeps the preset values whatever the filler types.
354
+
355
+ ```bash
356
+ jinshuju pseudo-form create --form Kp7mQ2 --name 张三-上司 --json '{"field_1":"张三","field_2":"上司"}'
357
+ jinshuju pseudo-form create --form Kp7mQ2 --batch @links.json # [{"name": "...", "values": {...}}], up to 200
358
+ jinshuju pseudo-form list --form Kp7mQ2 --all
359
+ jinshuju pseudo-form edit aB3dE9 --form Kp7mQ2 --json '{"field_2":null}' # null clears a preset; the rest keep theirs
360
+ jinshuju pseudo-form delete aB3dE9 Xy7Kp2 --form Kp7mQ2 --yes
361
+ ```
362
+
363
+ Each answer carries `fill_url`, the link to hand out. A batch makes the items it
364
+ can and lists the others in `errors` by index. Values are written as
365
+ `entry create` writes them, a choice by its code or its text. A field of a type
366
+ that cannot be preset, such as an attachment, is refused by name. Only a manager
367
+ of the form can, and the form's account needs 数据预填写 in its plan.
368
+
348
369
  ## Routines (自动任务)
349
370
 
350
371
  A routine is an instruction Jiri carries out on a schedule, or when the data of
@@ -2,20 +2,22 @@ import { UsageError } from '../errors.js';
2
2
  import { JSON_OPTION } from '../options.js';
3
3
  import { call } from '../spec.js';
4
4
  /**
5
- * The two kinds of fill page: `/f/<token>` for a form, `/v/<token>` for a
6
- * table's form view. The API mirrors them as two operations each, so a link is
7
- * all it takes to know which.
5
+ * The kinds of fill page: `/f/<token>` for a form, `/v/<token>` for a table's
6
+ * form view, `/pf/<token>` for a pseudo form, a form with some fields preset.
7
+ * The API mirrors them as two operations each, so a link is all it takes to
8
+ * know which.
8
9
  */
9
10
  const ROUTES = {
10
11
  f: { token: 'form_token', page: 'getFillFormPage', submit: 'createFillFormEntry' },
11
- v: { token: 'view_token', page: 'getFillViewPage', submit: 'createFillViewEntry' }
12
+ v: { token: 'view_token', page: 'getFillViewPage', submit: 'createFillViewEntry' },
13
+ pf: { token: 'pseudo_form_token', page: 'getFillPseudoFormPage', submit: 'createFillPseudoFormEntry' }
12
14
  };
13
15
  const PAGE_ARG = {
14
16
  name: 'page',
15
17
  required: true,
16
18
  description: 'The fill link as shared, e.g. https://example.jinshuju.net/v/aB3dE9, or just its path: v/aB3dE9'
17
19
  };
18
- /** The page's or the submit's request for a fill link, or for the `f/…` / `v/…` path of one. */
20
+ /** The page's or the submit's request for a fill link, or for the `f/…` / `v/…` / `pf/…` path of one. */
19
21
  function fillPage(input, what, parts = {}) {
20
22
  const page = input.args.page.trim();
21
23
  let path = page;
@@ -30,7 +32,7 @@ function fillPage(input, what, parts = {}) {
30
32
  const [route, token] = path.split('/').filter(Boolean);
31
33
  const kind = route !== undefined && Object.hasOwn(ROUTES, route) ? ROUTES[route] : undefined;
32
34
  if (!kind || !token) {
33
- throw new UsageError(`Not a fill link: ${page}. A fill link ends in /f/<token> or /v/<token>.`);
35
+ throw new UsageError(`Not a fill link: ${page}. A fill link ends in /f/<token>, /v/<token> or /pf/<token>.`);
34
36
  }
35
37
  return call(kind[what], { ...parts, path: { [kind.token]: token } });
36
38
  }
@@ -42,7 +44,8 @@ export const FILL = [
42
44
  'the page shows its fillers comes back. `status.key` is `open` when you can submit. `blockers` lists ' +
43
45
  'what only the person at the page can do — a captcha, an SMS code, WeChat, a payment — and while it is ' +
44
46
  'not empty the page has to be filled in a browser. `manageable` appears only when you could already ' +
45
- 'read the form or table behind the page.',
47
+ 'read the form or table behind the page. A `/pf/` link answers `predefined_values`: the fields already ' +
48
+ 'filled in, which a submission keeps whatever it says.',
46
49
  args: [PAGE_ARG],
47
50
  request: (input) => fillPage(input, 'page'),
48
51
  examples: ['jinshuju fill get https://example.jinshuju.net/v/aB3dE9', 'jinshuju fill get f/Kp7mQ2']
@@ -1,9 +1,29 @@
1
1
  import { FILTER_OPTION, FILTERS_OPTION, JSON_OPTION, MINE_OPTION, PAGINATION_OPTIONS, SORT_OPTION, UsageError } from '../options.js';
2
2
  import { FOLDER_OPTION, LISTING, PREVIEW_OPTION, YES_OPTION, confirmed, filters, given, keywords, overriding, paging, payload, refuseWithMine, requiredOption, sort, trash } from './shared.js';
3
3
  import { validateContainerPayload } from '../payload.js';
4
- import { bodyChoices, call } from '../spec.js';
4
+ import { bodyChoices, bodyKeys, call } from '../spec.js';
5
5
  import { readableSize, upload, uploadedId, uploadFormImage } from './upload.js';
6
6
  import { isRecord } from '../values.js';
7
+ /**
8
+ * Every key setting takes, from the spec. The paragraphs above explain a few;
9
+ * a key the help never names reads as one the CLI cannot write.
10
+ */
11
+ function settingKeys() {
12
+ const keys = bodyKeys('createForm', 'setting');
13
+ if (!keys)
14
+ return [];
15
+ const lines = ['Every key setting takes, in `form create` and `form edit` alike:'];
16
+ for (const key of keys) {
17
+ const last = lines.length - 1;
18
+ const joined = `${lines[last]} ${key},`;
19
+ if (last > 0 && joined.length <= 78)
20
+ lines[last] = joined;
21
+ else
22
+ lines.push(`${key},`);
23
+ }
24
+ lines[lines.length - 1] = lines[lines.length - 1].replace(/,$/, '.');
25
+ return [...lines, ''];
26
+ }
7
27
  /**
8
28
  * The shape behind `--json` on a form, shown rather than described: `fields` is
9
29
  * the part nothing else hints at, and one choice field carries more of the
@@ -47,6 +67,7 @@ const FORM_PAYLOAD = [
47
67
  'not-open and fill-limit messages. A key left out keeps its text, and ""',
48
68
  'puts the default back.',
49
69
  '',
70
+ ...settingKeys(),
50
71
  'A form reads its fields back in the shape written here, each with the',
51
72
  'api_code the backend assigned, and a field read goes back through',
52
73
  '`field update` as it came. `field types` lists the types to write, and',
@@ -536,7 +557,7 @@ export const FORM = [
536
557
  description: 'The payload carries the operations to apply: name, description, setting, layout, and fields as ' +
537
558
  '{add, update, update_choices, remove}. Only what is named changes. Switching layout keeps every ' +
538
559
  'field; the card layout hides the ones it cannot show and the classic layout shows them again. `form create --help` ' +
539
- 'shows what setting takes, the close rules among it; `form setting edit` writes the few settings this ' +
560
+ 'lists every key setting takes and explains the close rules among them; `form setting edit` writes the few settings this ' +
540
561
  'payload cannot, the WeChat share card among them. Display and redirect rules have commands of their ' +
541
562
  'own: `form rule edit` and `form redirect-rule edit`.',
542
563
  args: [{ name: 'form', required: true, description: 'Form token' }],
@@ -21,6 +21,7 @@ import { LOCAL } from './local.js';
21
21
  import { MESSAGE } from './message.js';
22
22
  import { NOTIFICATION } from './notification.js';
23
23
  import { OPENSEARCH } from './opensearch.js';
24
+ import { PSEUDO_FORM } from './pseudo-form.js';
24
25
  import { ROUTINE } from './routine.js';
25
26
  import { SMS } from './sms.js';
26
27
  import { TABLE } from './table.js';
@@ -43,6 +44,11 @@ export const RESOURCES = [
43
44
  { name: 'entry', summary: 'Manage entries' },
44
45
  { name: 'comment', summary: 'Manage entry comments' },
45
46
  { name: 'opensearch', summary: 'Manage public queries' },
47
+ {
48
+ name: 'pseudo-form',
49
+ summary: 'Pseudo forms (预填写): fill links with some fields already filled in, one per person or row',
50
+ note: 'Only a manager of the form can create, edit or delete them, and the form’s account needs 数据预填写 in its plan.'
51
+ },
46
52
  {
47
53
  name: 'notification',
48
54
  summary: 'Notification rules: SMS, email and WeChat to submitters, bots and webhooks to your team',
@@ -108,6 +114,7 @@ export const COMMANDS = [
108
114
  ...ENTRY,
109
115
  ...COMMENT,
110
116
  ...OPENSEARCH,
117
+ ...PSEUDO_FORM,
111
118
  ...NOTIFICATION,
112
119
  ...ROUTINE,
113
120
  ...CHECKIN,
@@ -0,0 +1,2 @@
1
+ import type { Command } from './types.js';
2
+ export declare const PSEUDO_FORM: readonly Command[];
@@ -0,0 +1,110 @@
1
+ import { UsageError } from '../errors.js';
2
+ import { JSON_OPTION, PAGINATION_OPTIONS } from '../options.js';
3
+ import { call } from '../spec.js';
4
+ import { FORM_OPTION, LISTING, YES_OPTION, confirmed, given, paging, requiredOption } from './shared.js';
5
+ const NAME_OPTION = {
6
+ name: '--name',
7
+ type: 'string',
8
+ placeholder: '<name>',
9
+ description: 'Name shown in the form’s pseudo form list, e.g. who the link is for'
10
+ };
11
+ const VALUES_PAYLOAD = [
12
+ '{ "field_1": "张三", "field_3": "研发部" }',
13
+ '',
14
+ 'Keyed by field api_code, as `jinshuju field list --form <token>` lists them, each value written as',
15
+ '`entry create` writes it: a choice by its code or its text. Not every type can be preset; one that',
16
+ 'cannot, such as an attachment, is refused by name.'
17
+ ];
18
+ function formPath(input) {
19
+ return { form_token: requiredOption(input, 'form') };
20
+ }
21
+ function batchItems(input) {
22
+ const items = input.options.batch;
23
+ if (input.options.json !== undefined || input.options.name !== undefined) {
24
+ throw new UsageError('--batch carries each item’s name and values; it does not go with --json or --name');
25
+ }
26
+ if (!Array.isArray(items))
27
+ throw new UsageError('--batch must be a list of {"name", "values"}');
28
+ return items;
29
+ }
30
+ export const PSEUDO_FORM = [
31
+ {
32
+ path: ['pseudo-form', 'list'],
33
+ summary: 'List the pseudo forms (prefilled links) of a form, newest first',
34
+ description: 'The ones made in the web app are listed too. fill_url is the link to hand out.',
35
+ options: [FORM_OPTION, ...PAGINATION_OPTIONS],
36
+ request: (input) => call('listPseudoForms', { path: formPath(input), query: paging(input) }),
37
+ paginate: LISTING,
38
+ examples: ['jinshuju pseudo-form list --form Kp7mQ2']
39
+ },
40
+ {
41
+ path: ['pseudo-form', 'create'],
42
+ summary: 'Create a pseudo form: a fill link with some fields already filled in',
43
+ description: 'The answer’s fill_url is the link to hand out; an entry submitted through it keeps the preset values ' +
44
+ 'whatever the filler types. --batch makes one link per item, up to 200 in a request: the items it ' +
45
+ 'could not make come back in errors by index, and the rest are made. Only a manager of the form can.',
46
+ options: [
47
+ FORM_OPTION,
48
+ NAME_OPTION,
49
+ JSON_OPTION,
50
+ {
51
+ name: '--batch',
52
+ type: 'json',
53
+ placeholder: '<json|@file|->',
54
+ description: 'One pseudo form per item, up to 200: [{"name": "...", "values": {...}}]'
55
+ }
56
+ ],
57
+ payload: VALUES_PAYLOAD,
58
+ request: (input) => {
59
+ if (input.options.batch !== undefined) {
60
+ return call('createPseudoFormsBatch', { path: formPath(input), body: { pseudo_forms: batchItems(input) } });
61
+ }
62
+ const values = input.options.json;
63
+ if (values === undefined)
64
+ throw new UsageError('--json is required: the preset values, keyed by api_code');
65
+ return call('createPseudoForm', { path: formPath(input), body: given({ name: input.options.name, values }) });
66
+ },
67
+ examples: [
68
+ 'jinshuju pseudo-form create --form Kp7mQ2 --name 张三-上司 --json \'{"field_1":"张三","field_2":"上司"}\'',
69
+ 'jinshuju pseudo-form create --form Kp7mQ2 --batch @links.json'
70
+ ]
71
+ },
72
+ {
73
+ path: ['pseudo-form', 'edit'],
74
+ summary: 'Rename a pseudo form or change its preset values',
75
+ description: 'Only what is named changes: the fields in --json take the new values, a field set to null loses its ' +
76
+ 'preset, and the fields left out keep theirs. The fill link stays the same.',
77
+ args: [
78
+ { name: 'pseudo-form', required: true, description: 'Pseudo form token, the end of its fill_url (/pf/<token>)' }
79
+ ],
80
+ options: [FORM_OPTION, NAME_OPTION, JSON_OPTION],
81
+ payload: VALUES_PAYLOAD,
82
+ request: (input) => {
83
+ const body = given({ name: input.options.name, values: input.options.json });
84
+ if (Object.keys(body).length === 0)
85
+ throw new UsageError('Nothing to change: pass --name, --json or both');
86
+ return call('updatePseudoForm', {
87
+ path: { ...formPath(input), pseudo_form_token: input.args['pseudo-form'] },
88
+ body
89
+ });
90
+ },
91
+ examples: ['jinshuju pseudo-form edit aB3dE9 --form Kp7mQ2 --json \'{"field_2":null}\'']
92
+ },
93
+ {
94
+ path: ['pseudo-form', 'delete'],
95
+ summary: 'Delete pseudo forms; their fill links stop working',
96
+ description: 'Several tokens go in one request, up to 200; the ones that name none of the form’s pseudo forms ' +
97
+ 'come back in not_found_tokens.',
98
+ args: [{ name: 'pseudo-form', required: true, variadic: true, description: 'Pseudo form token(s)' }],
99
+ options: [FORM_OPTION, YES_OPTION],
100
+ request: (input) => {
101
+ const tokens = input.rest;
102
+ confirmed(input, `Deleting ${tokens.length === 1 ? `pseudo form ${tokens[0]}` : `${tokens.length} pseudo forms`}`);
103
+ if (tokens.length === 1) {
104
+ return call('deletePseudoForm', { path: { ...formPath(input), pseudo_form_token: tokens[0] } });
105
+ }
106
+ return call('deletePseudoFormsBatch', { path: formPath(input), body: { tokens } });
107
+ },
108
+ examples: ['jinshuju pseudo-form delete aB3dE9 Xy7Kp2 --form Kp7mQ2 --yes']
109
+ }
110
+ ];
@@ -3,7 +3,7 @@ import type { Operation, Schema } from '../spec.js';
3
3
  export declare const BASE_PATH = "/api/v1";
4
4
  /** The day spec/openapi.yaml was fetched from the API, when scripts/fetch-spec.mjs recorded it. */
5
5
  export declare const SPEC_DATE: string | undefined;
6
- 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' | 'createFormCooperators' | 'createFormView' | 'createFormWebhook' | 'createMemoryNote' | 'createMessageChannel' | 'createNotificationRule' | 'createOpenResult' | 'createOpensearchQuery' | 'createRoutine' | 'createSmsSignature' | 'createSmsTask' | 'createSmsTemplate' | 'createTable' | 'createTableEntry' | 'createTableEntryComment' | 'createTableView' | 'createTemplateUsage' | 'createWeixinOauthSession' | 'deleteCheckinCampaign' | 'deleteEntry' | 'deleteEntryComment' | 'deleteForm' | 'deleteFormView' | 'deleteFormWebhook' | 'deleteMemoryNotes' | 'deleteMessageChannel' | 'deleteNotificationRule' | 'deleteOpenResult' | 'deleteRoutine' | 'deleteSmsSignature' | 'deleteSmsTemplate' | 'deleteTable' | 'deleteTableEntry' | 'deleteTableEntryComment' | 'deleteTableView' | 'estimateEmailTask' | 'estimateEmailTaskResend' | 'estimateMessage' | 'estimateSmsTask' | 'estimateSmsTaskChange' | 'estimateSmsTaskResend' | 'exportRemainingVouchers' | 'getBillingAccount' | 'getCheckinCampaign' | 'getCurrentUser' | 'getEmailTask' | 'getEntry' | 'getEntryImport' | 'getEntryStateFlow' | 'getEntryStats' | 'getEvaluationSetting' | 'getExamSetting' | 'getFieldType' | 'getFillFormPage' | 'getFillViewPage' | 'getFolder' | 'getForm' | 'getFormSetting' | 'getFormView' | 'getManuallyCloseRule' | 'getMemory' | 'getMessage' | 'getMessageChannel' | 'getNotificationRule' | 'getOpenResult' | 'getOpensearchQuery' | 'getPublishedArtifact' | 'getQuickpaySetting' | 'getRoutine' | 'getSmsTask' | 'getTable' | 'getTableEntry' | 'getTableView' | 'getTradeMerchant' | 'getUserFormSetting' | 'getWheelFortune' | 'listArtifactDataSources' | 'listArtifacts' | 'listBillingAccountInvoices' | 'listBillingAccountPaidFeatures' | 'listBillingAccountPaymentHistories' | 'listBillingAccountUsers' | 'listCheckinCampaigns' | 'listContacts' | 'listEmailTaskActivities' | 'listEmailTasks' | 'listEntries' | 'listEntryComments' | 'listExtendedAttributes' | 'listFieldRules' | 'listFieldTypes' | 'listFolders' | 'listFormConditionTriggerableFields' | 'listFormCooperators' | 'listFormPublishedArtifacts' | 'listFormViewEntries' | 'listFormViews' | 'listForms' | 'listMessageChannels' | 'listMessages' | 'listMyFilledForms' | 'listMySubmittedEntries' | 'listNotificationRuleNotifications' | 'listNotificationRules' | 'listOpenResults' | 'listOpensearchQueries' | 'listOpensearchQuerySuggestions' | 'listRedirectRules' | 'listRoutineRuns' | 'listRoutines' | 'listSmsAuditStatuses' | 'listSmsSignatures' | 'listSmsTaskActivities' | 'listSmsTasks' | 'listSmsTemplates' | 'listSmtpAccounts' | 'listTableConditionTriggerableFields' | 'listTableEntries' | 'listTableEntryComments' | 'listTablePublishedArtifacts' | 'listTableViewEntries' | 'listTableViews' | 'listTables' | 'listTradePayouts' | 'listTradeRefunds' | 'listTradeTransactions' | 'moveFormToFolder' | 'moveTableToFolder' | 'patchEntriesBatch' | 'pauseRoutine' | 'prepareEntryAttachmentUpload' | 'prepareFormImageUpload' | 'prepareGoodsDeliverableAttachmentUpload' | 'prepareImportFileUpload' | 'previewFormDeletion' | 'previewFormFieldTypeChange' | 'previewTableDeletion' | 'previewTableFieldTypeChange' | 'replaceEntry' | 'replaceTableEntry' | 'resendEmailTask' | 'resendSmsTask' | 'restoreFormPublishedArtifactDataGrant' | 'restoreTablePublishedArtifactDataGrant' | 'resumeRoutine' | 'revokeFormPublishedArtifactDataGrant' | 'revokeTablePublishedArtifactDataGrant' | 'runRoutine' | 'searchEntriesAcrossForms' | 'searchMySubmittedEntries' | 'sendMessage' | 'sendSmsTask' | 'summarizeEntries' | 'summarizeFormViewEntries' | 'summarizeTableEntries' | 'summarizeTableViewEntries' | 'updateAccessPolicy' | 'updateCheckinCampaign' | 'updateEntry' | 'updateEntryComment' | 'updateEntryStateFlow' | 'updateEntryViaPost' | 'updateEvaluationSetting' | 'updateExamSetting' | 'updateForm' | 'updateFormSetting' | 'updateFormTheme' | 'updateFormView' | 'updateManuallyCloseRule' | 'updateMemoryNote' | 'updateNotificationRule' | 'updateOpenResult' | 'updateOpensearchQuery' | 'updatePublishedArtifact' | 'updateQuickpaySetting' | 'updateRoutine' | 'updateSmsSignature' | 'updateSmsTask' | 'updateSmsTemplate' | 'updateTable' | 'updateTableEntry' | 'updateTableEntryComment' | 'updateTableEntryViaPost' | 'updateTableView' | 'updateUserFormSetting' | 'updateWheelFortune' | 'uploadEntryAttachment' | 'uploadFormImage' | 'uploadGoodsDeliverableAttachment' | 'uploadImportFile' | 'uploadUserLicenseAttachment' | 'verifyRedirectParams';
6
+ export type OperationId = 'aggregateEntries' | 'aggregateFormViewEntries' | 'aggregateTableEntries' | 'aggregateTableViewEntries' | 'aggregateTradeTransactions' | 'checkFormFieldData' | 'checkTableFieldData' | 'copyForm' | 'countEntries' | 'countEntriesAcrossForms' | 'countFormViewEntries' | 'countTableEntries' | 'countTableViewEntries' | 'createCheckinCampaign' | 'createEmailTask' | 'createEntriesBatch' | 'createEntry' | 'createEntryComment' | 'createEntryImport' | 'createEntryLegacy' | 'createFillFormEntry' | 'createFillPseudoFormEntry' | 'createFillViewEntry' | 'createFolder' | 'createForm' | 'createFormCooperators' | 'createFormView' | 'createFormWebhook' | 'createMemoryNote' | 'createMessageChannel' | 'createNotificationRule' | 'createOpenResult' | 'createOpensearchQuery' | 'createPseudoForm' | 'createPseudoFormsBatch' | 'createRoutine' | 'createSmsSignature' | 'createSmsTask' | 'createSmsTemplate' | 'createTable' | 'createTableEntry' | 'createTableEntryComment' | 'createTableView' | 'createTemplateUsage' | 'createWeixinOauthSession' | 'deleteCheckinCampaign' | 'deleteEntry' | 'deleteEntryComment' | 'deleteForm' | 'deleteFormView' | 'deleteFormWebhook' | 'deleteMemoryNotes' | 'deleteMessageChannel' | 'deleteNotificationRule' | 'deleteOpenResult' | 'deletePseudoForm' | 'deletePseudoFormsBatch' | 'deleteRoutine' | 'deleteSmsSignature' | 'deleteSmsTemplate' | 'deleteTable' | 'deleteTableEntry' | 'deleteTableEntryComment' | 'deleteTableView' | 'estimateEmailTask' | 'estimateEmailTaskResend' | 'estimateMessage' | 'estimateSmsTask' | 'estimateSmsTaskChange' | 'estimateSmsTaskResend' | 'exportRemainingVouchers' | 'getBillingAccount' | 'getCheckinCampaign' | 'getCurrentUser' | 'getEmailTask' | 'getEntry' | 'getEntryImport' | 'getEntryStateFlow' | 'getEntryStats' | 'getEvaluationSetting' | 'getExamSetting' | 'getFieldType' | 'getFillFormPage' | 'getFillPseudoFormPage' | 'getFillViewPage' | 'getFolder' | 'getForm' | 'getFormSetting' | 'getFormView' | 'getManuallyCloseRule' | 'getMemory' | 'getMessage' | 'getMessageChannel' | 'getNotificationRule' | 'getOpenResult' | 'getOpensearchQuery' | 'getPublishedArtifact' | 'getQuickpaySetting' | 'getRoutine' | 'getSmsTask' | 'getTable' | 'getTableEntry' | 'getTableView' | 'getTradeMerchant' | 'getUserFormSetting' | 'getWheelFortune' | 'listArtifactDataSources' | 'listArtifacts' | 'listBillingAccountInvoices' | 'listBillingAccountPaidFeatures' | 'listBillingAccountPaymentHistories' | 'listBillingAccountUsers' | 'listCheckinCampaigns' | 'listContacts' | 'listEmailTaskActivities' | 'listEmailTasks' | 'listEntries' | 'listEntryComments' | 'listExtendedAttributes' | 'listFieldRules' | 'listFieldTypes' | 'listFolders' | 'listFormConditionTriggerableFields' | 'listFormCooperators' | 'listFormPublishedArtifacts' | 'listFormViewEntries' | 'listFormViews' | 'listForms' | 'listMessageChannels' | 'listMessages' | 'listMyFilledForms' | 'listMySubmittedEntries' | 'listNotificationRuleNotifications' | 'listNotificationRules' | 'listOpenResults' | 'listOpensearchQueries' | 'listOpensearchQuerySuggestions' | 'listPseudoForms' | 'listRedirectRules' | 'listRoutineRuns' | 'listRoutines' | 'listSmsAuditStatuses' | 'listSmsSignatures' | 'listSmsTaskActivities' | 'listSmsTasks' | 'listSmsTemplates' | 'listSmtpAccounts' | 'listTableConditionTriggerableFields' | 'listTableEntries' | 'listTableEntryComments' | 'listTablePublishedArtifacts' | 'listTableViewEntries' | 'listTableViews' | 'listTables' | 'listTradePayouts' | 'listTradeRefunds' | 'listTradeTransactions' | 'moveFormToFolder' | 'moveTableToFolder' | 'patchEntriesBatch' | 'pauseRoutine' | 'prepareEntryAttachmentUpload' | 'prepareFormImageUpload' | 'prepareGoodsDeliverableAttachmentUpload' | 'prepareImportFileUpload' | 'previewFormDeletion' | 'previewFormFieldTypeChange' | 'previewTableDeletion' | 'previewTableFieldTypeChange' | 'replaceEntry' | 'replaceTableEntry' | 'resendEmailTask' | 'resendSmsTask' | 'restoreFormPublishedArtifactDataGrant' | 'restoreTablePublishedArtifactDataGrant' | 'resumeRoutine' | 'revokeFormPublishedArtifactDataGrant' | 'revokeTablePublishedArtifactDataGrant' | 'runRoutine' | 'searchEntriesAcrossForms' | 'searchMySubmittedEntries' | 'sendMessage' | 'sendSmsTask' | 'summarizeEntries' | 'summarizeFormViewEntries' | 'summarizeTableEntries' | 'summarizeTableViewEntries' | 'updateAccessPolicy' | 'updateCheckinCampaign' | 'updateEntry' | 'updateEntryComment' | 'updateEntryStateFlow' | 'updateEntryViaPost' | 'updateEvaluationSetting' | 'updateExamSetting' | 'updateForm' | 'updateFormSetting' | 'updateFormTheme' | 'updateFormView' | 'updateManuallyCloseRule' | 'updateMemoryNote' | 'updateNotificationRule' | 'updateOpenResult' | 'updateOpensearchQuery' | 'updatePseudoForm' | 'updatePublishedArtifact' | 'updateQuickpaySetting' | 'updateRoutine' | 'updateSmsSignature' | 'updateSmsTask' | 'updateSmsTemplate' | 'updateTable' | 'updateTableEntry' | 'updateTableEntryComment' | 'updateTableEntryViaPost' | 'updateTableView' | 'updateUserFormSetting' | 'updateWheelFortune' | 'uploadEntryAttachment' | 'uploadFormImage' | 'uploadGoodsDeliverableAttachment' | 'uploadImportFile' | 'uploadUserLicenseAttachment' | 'verifyRedirectParams';
7
7
  export declare const OPERATIONS: {
8
8
  readonly [id in OperationId]: Operation;
9
9
  };
@@ -306,6 +306,12 @@ export const OPERATIONS = {
306
306
  parameters: [{ name: 'form_token', in: 'path', required: true, schema: { type: 'string' } }],
307
307
  body: { required: true, content: { 'application/json': { $ref: 'FillEntryRequest' } } }
308
308
  },
309
+ createFillPseudoFormEntry: {
310
+ method: 'POST',
311
+ path: '/fill/pf/{pseudo_form_token}/entries',
312
+ parameters: [{ name: 'pseudo_form_token', in: 'path', required: true, schema: { type: 'string' } }],
313
+ body: { required: true, content: { 'application/json': { $ref: 'FillEntryRequest' } } }
314
+ },
309
315
  createFillViewEntry: {
310
316
  method: 'POST',
311
317
  path: '/fill/v/{view_token}/entries',
@@ -424,6 +430,28 @@ export const OPERATIONS = {
424
430
  }
425
431
  }
426
432
  },
433
+ createPseudoForm: {
434
+ method: 'POST',
435
+ path: '/forms/{form_token}/pseudo_forms',
436
+ parameters: [{ name: 'form_token', in: 'path', required: true, schema: { type: 'string' } }],
437
+ body: { required: true, content: { 'application/json': { $ref: 'PseudoFormCreateInput' } } }
438
+ },
439
+ createPseudoFormsBatch: {
440
+ method: 'POST',
441
+ path: '/forms/{form_token}/pseudo_forms/batch',
442
+ parameters: [{ name: 'form_token', in: 'path', required: true, schema: { type: 'string' } }],
443
+ body: {
444
+ required: true,
445
+ content: {
446
+ 'application/json': {
447
+ type: 'object',
448
+ required: ['pseudo_forms'],
449
+ properties: { pseudo_forms: { type: 'array', minItems: 1, maxItems: 200, items: {} } },
450
+ additionalProperties: false
451
+ }
452
+ }
453
+ }
454
+ },
427
455
  createRoutine: {
428
456
  method: 'POST',
429
457
  path: '/routines',
@@ -569,6 +597,30 @@ export const OPERATIONS = {
569
597
  { name: 'token', in: 'path', required: true, schema: { type: 'string' } }
570
598
  ]
571
599
  },
600
+ deletePseudoForm: {
601
+ method: 'DELETE',
602
+ path: '/forms/{form_token}/pseudo_forms/{pseudo_form_token}',
603
+ parameters: [
604
+ { name: 'form_token', in: 'path', required: true, schema: { type: 'string' } },
605
+ { name: 'pseudo_form_token', in: 'path', required: true, schema: { type: 'string' } }
606
+ ]
607
+ },
608
+ deletePseudoFormsBatch: {
609
+ method: 'DELETE',
610
+ path: '/forms/{form_token}/pseudo_forms/batch',
611
+ parameters: [{ name: 'form_token', in: 'path', required: true, schema: { type: 'string' } }],
612
+ body: {
613
+ required: true,
614
+ content: {
615
+ 'application/json': {
616
+ type: 'object',
617
+ required: ['tokens'],
618
+ properties: { tokens: { type: 'array', minItems: 1, maxItems: 200, items: { type: 'string' } } },
619
+ additionalProperties: false
620
+ }
621
+ }
622
+ }
623
+ },
572
624
  deleteRoutine: {
573
625
  method: 'DELETE',
574
626
  path: '/routines/{id}',
@@ -786,6 +838,11 @@ export const OPERATIONS = {
786
838
  path: '/fill/f/{form_token}',
787
839
  parameters: [{ name: 'form_token', in: 'path', required: true, schema: { type: 'string' } }]
788
840
  },
841
+ getFillPseudoFormPage: {
842
+ method: 'GET',
843
+ path: '/fill/pf/{pseudo_form_token}',
844
+ parameters: [{ name: 'pseudo_form_token', in: 'path', required: true, schema: { type: 'string' } }]
845
+ },
789
846
  getFillViewPage: {
790
847
  method: 'GET',
791
848
  path: '/fill/v/{view_token}',
@@ -1233,6 +1290,17 @@ export const OPERATIONS = {
1233
1290
  path: '/opensearch/query_suggestions',
1234
1291
  parameters: [{ name: 'form_token', in: 'query', required: true, schema: { type: 'string' } }]
1235
1292
  },
1293
+ listPseudoForms: {
1294
+ method: 'GET',
1295
+ path: '/forms/{form_token}/pseudo_forms',
1296
+ parameters: [
1297
+ { name: 'form_token', in: 'path', required: true, schema: { type: 'string' } },
1298
+ { name: 'limit', in: 'query', schema: { type: 'integer' } },
1299
+ { name: 'next', in: 'query', schema: { type: 'integer', minimum: 0 } },
1300
+ { name: 'page', in: 'query', schema: { type: 'integer', minimum: 1 } },
1301
+ { name: 'skip', in: 'query', schema: { type: 'integer', minimum: 0, maximum: 10000 } }
1302
+ ]
1303
+ },
1236
1304
  listRedirectRules: {
1237
1305
  method: 'GET',
1238
1306
  path: '/forms/{form_token}/redirect_rules',
@@ -1967,6 +2035,15 @@ export const OPERATIONS = {
1967
2035
  parameters: [{ name: 'query_token', in: 'path', required: true, schema: { type: 'string' } }],
1968
2036
  body: { required: true, content: { 'application/json': { $ref: 'OpensearchQueryInput' } } }
1969
2037
  },
2038
+ updatePseudoForm: {
2039
+ method: 'PATCH',
2040
+ path: '/forms/{form_token}/pseudo_forms/{pseudo_form_token}',
2041
+ parameters: [
2042
+ { name: 'form_token', in: 'path', required: true, schema: { type: 'string' } },
2043
+ { name: 'pseudo_form_token', in: 'path', required: true, schema: { type: 'string' } }
2044
+ ],
2045
+ body: { required: true, content: { 'application/json': { $ref: 'PseudoFormUpdateInput' } } }
2046
+ },
1970
2047
  updatePublishedArtifact: {
1971
2048
  method: 'PATCH',
1972
2049
  path: '/artifacts/{artifact_id}/published_artifact',
@@ -5763,6 +5840,17 @@ export const SCHEMAS = {
5763
5840
  count_down: { type: ['integer', 'null'], minimum: 0 }
5764
5841
  }
5765
5842
  },
5843
+ PseudoFormCreateInput: {
5844
+ type: 'object',
5845
+ properties: { name: { type: 'string' }, values: { $ref: 'PseudoFormValues' } },
5846
+ additionalProperties: false
5847
+ },
5848
+ PseudoFormUpdateInput: {
5849
+ type: 'object',
5850
+ properties: { name: { type: 'string' }, values: { $ref: 'PseudoFormValues' } },
5851
+ additionalProperties: false
5852
+ },
5853
+ PseudoFormValues: { type: 'object', additionalProperties: true },
5766
5854
  PublishedArtifactInput: {
5767
5855
  type: 'object',
5768
5856
  additionalProperties: false,
package/dist/spec.d.ts CHANGED
@@ -135,3 +135,9 @@ export declare function choices(id: OperationId, path: string): readonly string[
135
135
  * dots and steps into a list's items with `[]`: `fields[].type`.
136
136
  */
137
137
  export declare function bodyChoices(id: OperationId, path: string): readonly string[] | undefined;
138
+ /**
139
+ * The keys an object in a JSON body takes, walked to as `bodyChoices` walks:
140
+ * `setting`. For help that has to name every key, which a hand-kept list
141
+ * would name fewer of as the API learns more.
142
+ */
143
+ export declare function bodyKeys(id: OperationId, path: string): readonly string[] | undefined;
package/dist/spec.js CHANGED
@@ -208,6 +208,19 @@ export function choices(id, path) {
208
208
  export function bodyChoices(id, path) {
209
209
  return enumOf(walk(OPERATIONS[id].body?.content['application/json'], path.split('.')), `${id} ${path}`);
210
210
  }
211
+ /**
212
+ * The keys an object in a JSON body takes, walked to as `bodyChoices` walks:
213
+ * `setting`. For help that has to name every key, which a hand-kept list
214
+ * would name fewer of as the API learns more.
215
+ */
216
+ export function bodyKeys(id, path) {
217
+ const schema = walk(OPERATIONS[id].body?.content['application/json'], path.split('.'));
218
+ const keys = Object.keys((schema && resolved(schema).properties) ?? {});
219
+ if (keys.length > 0)
220
+ return keys;
221
+ unanswered.push(`${id} ${path}`);
222
+ return undefined;
223
+ }
211
224
  /** The schema the steps lead to: each names a property, and `[]` steps into a list's items. */
212
225
  function walk(from, steps) {
213
226
  let schema = from;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jinshuju/cli",
3
- "version": "0.28.0",
3
+ "version": "0.29.1",
4
4
  "description": "Command line interface for Jinshuju Open API v1",
5
5
  "homepage": "https://github.com/jinshuju/cli#readme",
6
6
  "bugs": {