flowbase-cli 0.1.8__tar.gz → 0.1.10__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flowbase-cli
3
- Version: 0.1.8
3
+ Version: 0.1.10
4
4
  Summary: Command line client for the FlowBase OpenAPI
5
5
  Author: DeepFlowAI
6
6
  License: Apache-2.0
@@ -9,7 +9,7 @@ Description-Content-Type: text/markdown
9
9
 
10
10
  # FlowBase CLI
11
11
 
12
- `flowbase` is the official command line client for the FlowBase OpenAPI. It manages apps, objects, fields, views, custom pages, workflows, dashboards, business records, roles, and configuration versions across the three FlowBase environments.
12
+ `flowbase` is the official command line client for the FlowBase OpenAPI. It manages apps, objects, fields, views, custom pages, workflows, approval flows, dashboards, business records, roles, and configuration versions across the three FlowBase environments.
13
13
 
14
14
  ## 1. Install and connect
15
15
 
@@ -47,7 +47,7 @@ Most commands run on every Host; `roles` is production-only and `changes commit/
47
47
 
48
48
  ### 3.1 Metadata vs records
49
49
 
50
- - **Metadata** (`metadata` scope): apps, objects, fields, views, pages, workflows, dashboards, roles, versions.
50
+ - **Metadata** (`metadata` scope): apps, objects, fields, views, pages, workflows, approvals, dashboards, roles, versions.
51
51
  - **Business records** (`records` scope): rows inside an object.
52
52
 
53
53
  Metadata changes are **drafts** against the current environment's configuration repository. They do not affect the running front-end until they are committed and released.
@@ -77,9 +77,11 @@ flowbase
77
77
  │ add-dashboards | remove-dashboard | set-dashboard-group | reorder-members
78
78
  ├── groups create | reorder | update | delete App groups (under an app)
79
79
  ├── objects list | get | create | update | delete | restore
80
+ │ cli-edit-policy get | update
80
81
  ├── fields create | update | delete | restore Fields under an object
81
82
  ├── views list | create | update | reorder | set-enabled | delete
82
83
  ├── workflows list | get | create | update | reorder | set-enabled | delete | executions
84
+ ├── approvals list | get | create | update | reorder | set-enabled | delete
83
85
  ├── pages list | options | get | create | update | set-default | delete | restore
84
86
  ├── dashboards list | get | create | update | copy | delete
85
87
  ├── changes commit | release | direct-release
@@ -89,7 +91,7 @@ flowbase
89
91
  └── roles list | options | get | create | update | delete (production only)
90
92
  ```
91
93
 
92
- Global flags: `--host`, `--api-key`, `--pretty`/`--no-pretty`, `--raw`.
94
+ Global flags: `--host`, `--api-key`, `--pretty`/`--no-pretty`, `--raw`. They may appear **before or after** the subcommand (`flowbase apps list --no-pretty` is valid).
93
95
 
94
96
  ## 5. Discovering request bodies
95
97
 
@@ -110,18 +112,24 @@ Complex bodies reference closed sets that are not guessable from examples. Query
110
112
 
111
113
  ```bash
112
114
  flowbase docs catalogs # list available catalogs
113
- flowbase docs catalogs field-types # field type names + allowed constraints
115
+ flowbase docs catalogs authoring # required fields, draftRevision sources, common mistakes
116
+ flowbase docs catalogs field-types # types, constraints, filter operators, record values, create examples
117
+ flowbase docs catalogs view-filters # view filter operators and value shapes (not page-rules)
118
+ flowbase docs catalogs record-values # how to write records.values by field type
114
119
  flowbase docs catalogs workflow-nodes # node types with in/out edge rules
115
120
  flowbase docs catalogs permissions # function permission points + data scopes
116
121
  flowbase docs catalogs dashboard-filters # filter types + date-range presets
117
- flowbase docs catalogs page-components # page region component kinds (field / relatedList)
122
+ flowbase docs catalogs page-components # Page component shapes, placement, fields, and enums
123
+ flowbase docs catalogs page-rules # Page condition operators and action shapes
118
124
  flowbase docs catalogs id-prefixes # resource ID prefix meanings
119
125
  flowbase docs catalogs icons # icon guidance + examples
120
126
  ```
121
127
 
128
+ Read `authoring` before composing any write. It lists the mistakes that most often make generated commands fail: missing `description`/`type`, select options without `id`+`lifecycle`, `defaultValue: null` (omit the key instead), boolean view filters using `eq`, `records.list` being a column projection, `pages.list.pages` being a page count, and `objects.get` not returning `draftRevision`.
129
+
122
130
  ### The read → modify → write loop
123
131
 
124
- Most `update` commands replace a **full snapshot** and accept an optional `baseRevision` for optimistic locking. The safe pattern is:
132
+ Most `update` commands replace a **full snapshot** and accept an optional `baseRevision` for optimistic locking. Check the relevant offline catalog for its exact update envelope and read-only response fields. The safe pattern is:
125
133
 
126
134
  ```bash
127
135
  flowbase dashboards get dsh_xxx > current.json # authoritative snapshot
@@ -129,16 +137,20 @@ flowbase dashboards get dsh_xxx > current.json # authoritative snapshot
129
137
  flowbase dashboards update dsh_xxx --json-file current.json
130
138
  ```
131
139
 
132
- Do not compose update bodies from scratch when an existing resource exists — `get` returns the server-valid shape, including `baseRevision`.
140
+ Do not compose update bodies from scratch when an existing resource exists. Start from `get`, then convert its read projection to the update envelope documented by the relevant catalog.
133
141
 
134
142
  ## 6. Recipes
135
143
 
136
144
  ### 6.1 Create an object with a field and a record
137
145
 
138
146
  ```bash
139
- flowbase objects create --label Customer --key customer --description "Customer records"
140
- flowbase fields create obj_xxx --json '{"label":"Name","key":"name","description":"Customer name","type":"text.singleLine","permission":"required"}'
147
+ flowbase docs catalogs authoring
148
+ flowbase docs catalogs field-types
149
+ flowbase objects create --json '{"label":"Customer","key":"customer","description":"Customer records","icon":"IconUsers"}'
150
+ flowbase fields create obj_xxx --json '{"label":"Name","key":"name","description":"Customer name","type":"text.singleLine","typeVersion":"v1","permission":"required","constraints":{"maxLength":120}}'
141
151
  flowbase records create obj_xxx --json '{"values":{"name":"Acme Corp"}}'
152
+ flowbase objects cli-edit-policy get obj_xxx
153
+ flowbase objects cli-edit-policy update obj_xxx --json '{"baseRevision":4,"policies":{"fld_xxx":"user_approval"}}' --yes
142
154
  ```
143
155
 
144
156
  Record `values` keys are **field keys** (`name`), not internal IDs (`fld_...`). IDs are `obj_`/`fld_`/`dsh_`/`wfl_`/`pag_`/`reg_`/`cmp_`-prefixed; see `docs catalogs id-prefixes`.
@@ -168,34 +180,60 @@ flowbase changes direct-release --message "Fix customer field" --yes
168
180
 
169
181
  `direct-release` always runs a server-side preflight, prints the current version, diff summary, checks and risk, and binds a one-time confirmation token. `--yes` accepts that reviewed result; it never skips validation.
170
182
 
171
- ### 6.4 Workflows and pages
183
+ On production, `records.*` sees **released** metadata only. Creating records on a brand-new object before `direct-release` returns `404 内容不存在或已被删除`. Finish metadata, release, then seed.
184
+
185
+ ### 6.4 Workflows, approvals, and pages
172
186
 
173
187
  A workflow graph must satisfy structural rules: exactly one `trigger` node, at least one `end` node, a DAG, and valid per-type edges. See `docs catalogs workflow-nodes` before composing `nodes`/`edges`.
174
188
 
189
+ Workflow conditions use `fieldId` for current-object fields and add `relationFieldId` for a one-hop related field. Field-value references use `valueRef` plus optional `valueRefRelationFieldId`. An `updateRelated` node selects the target record with its required `relationFieldId`; its assignment `fieldId` values belong to that related object. Use `workflows list` to retrieve the current object fields and the available `relations` with target fields.
190
+
191
+ Approval flow graphs are separate metadata: exactly one `trigger`, at least one `approval` node, both `approvedEnd` and `rejectedEnd`, and dual outcome edges from each approval node. Employee task decisions are not available via API key / CLI. See `docs catalogs approval-nodes`.
192
+
175
193
  ```bash
176
194
  flowbase docs catalogs workflow-nodes
177
195
  flowbase workflows create obj_xxx --json '{"label":"Set owner","enabled":true,"trigger":{"event":"create","match":"all","conditions":[]},"nodes":[],"edges":[]}'
178
196
  flowbase workflows update obj_xxx wfl_xxx --json-file workflow.json
179
197
  flowbase workflows executions obj_xxx wfl_xxx --result failure
180
198
 
181
- flowbase docs catalogs page-components # field + relatedList keys
199
+ flowbase docs catalogs approval-nodes
200
+ flowbase docs example approvals.create --output approval.json
201
+ flowbase approvals create obj_xxx --json-file approval.json
202
+ flowbase approvals set-enabled obj_xxx apr_xxx --base-revision 4 --enabled --yes
203
+
204
+ flowbase docs catalogs page-components # all component shapes and placement rules
205
+ flowbase docs catalogs page-rules # conditions, operators, and actions
206
+ flowbase pages options # objects, fields, and lookup constraints
182
207
  flowbase docs example pages.create --output page.json # create-page layout template
183
208
  flowbase pages create --json-file page.json
184
209
  flowbase pages set-default pag_xxx --base-revision 4 --yes
185
210
 
186
- # Detail pages may embed relatedList components (reverse lookup lists).
187
- flowbase pages get pag_xxx > page.json # prefer get → edit → update
188
- # or: flowbase docs example pages.update --output page.json
211
+ # Detail pages support detailSummary, stageBar, tabs, relatedSummary,
212
+ # attachmentCard, noticeBlock, relatedList, and approval components.
213
+ # A placed field uses sourcePath=[] for the Page object, or 1-2
214
+ # {relationFieldId,targetObjectId} hops for a related object field.
215
+ # Component visibility uses a page-rules setComponentVisibility action
216
+ # targeting the stable cmp_ ID returned by pages get.
217
+ # Save and read back a newly added component before adding a rule for it.
218
+ flowbase pages get pag_xxx > page-read.json
219
+ # Build page.json as {baseRevision: page-read.draftRevision, page: page-read.page},
220
+ # then remove the read-only Page keys listed by page-components.
221
+ # Or start from the complete offline example:
222
+ flowbase docs example pages.update --output page.json
189
223
  flowbase pages update pag_xxx --json-file page.json
190
224
  ```
191
225
 
192
226
  ### 6.5 Records and attachments
193
227
 
228
+ `records.list` is a **column projection** of the current view (often only the title field). Use `records.get` for the full `values` object. `values` keys are field keys; select/lookup values are option/record IDs.
229
+
194
230
  ```bash
195
231
  flowbase records list obj_xxx --page 1
196
232
  flowbase records get obj_xxx rec_xxx
233
+ flowbase docs catalogs record-values
234
+ flowbase records create obj_xxx --json '{"values":{"name":"Ada","status":"opt_xxx","class":"rec_xxx"}}'
197
235
  flowbase records upload-attachment obj_xxx fld_xxx ./contract.pdf
198
- flowbase records update obj_xxx rec_xxx --json '{"values":{"fld_contract":["att_xxx"]}}'
236
+ flowbase records update obj_xxx rec_xxx --json '{"values":{"attachments":["att_xxx"]}}'
199
237
  flowbase records download-attachment obj_xxx rec_xxx att_xxx --output ./contract.pdf
200
238
  ```
201
239
 
@@ -1,6 +1,6 @@
1
1
  # FlowBase CLI
2
2
 
3
- `flowbase` is the official command line client for the FlowBase OpenAPI. It manages apps, objects, fields, views, custom pages, workflows, dashboards, business records, roles, and configuration versions across the three FlowBase environments.
3
+ `flowbase` is the official command line client for the FlowBase OpenAPI. It manages apps, objects, fields, views, custom pages, workflows, approval flows, dashboards, business records, roles, and configuration versions across the three FlowBase environments.
4
4
 
5
5
  ## 1. Install and connect
6
6
 
@@ -38,7 +38,7 @@ Most commands run on every Host; `roles` is production-only and `changes commit/
38
38
 
39
39
  ### 3.1 Metadata vs records
40
40
 
41
- - **Metadata** (`metadata` scope): apps, objects, fields, views, pages, workflows, dashboards, roles, versions.
41
+ - **Metadata** (`metadata` scope): apps, objects, fields, views, pages, workflows, approvals, dashboards, roles, versions.
42
42
  - **Business records** (`records` scope): rows inside an object.
43
43
 
44
44
  Metadata changes are **drafts** against the current environment's configuration repository. They do not affect the running front-end until they are committed and released.
@@ -68,9 +68,11 @@ flowbase
68
68
  │ add-dashboards | remove-dashboard | set-dashboard-group | reorder-members
69
69
  ├── groups create | reorder | update | delete App groups (under an app)
70
70
  ├── objects list | get | create | update | delete | restore
71
+ │ cli-edit-policy get | update
71
72
  ├── fields create | update | delete | restore Fields under an object
72
73
  ├── views list | create | update | reorder | set-enabled | delete
73
74
  ├── workflows list | get | create | update | reorder | set-enabled | delete | executions
75
+ ├── approvals list | get | create | update | reorder | set-enabled | delete
74
76
  ├── pages list | options | get | create | update | set-default | delete | restore
75
77
  ├── dashboards list | get | create | update | copy | delete
76
78
  ├── changes commit | release | direct-release
@@ -80,7 +82,7 @@ flowbase
80
82
  └── roles list | options | get | create | update | delete (production only)
81
83
  ```
82
84
 
83
- Global flags: `--host`, `--api-key`, `--pretty`/`--no-pretty`, `--raw`.
85
+ Global flags: `--host`, `--api-key`, `--pretty`/`--no-pretty`, `--raw`. They may appear **before or after** the subcommand (`flowbase apps list --no-pretty` is valid).
84
86
 
85
87
  ## 5. Discovering request bodies
86
88
 
@@ -101,18 +103,24 @@ Complex bodies reference closed sets that are not guessable from examples. Query
101
103
 
102
104
  ```bash
103
105
  flowbase docs catalogs # list available catalogs
104
- flowbase docs catalogs field-types # field type names + allowed constraints
106
+ flowbase docs catalogs authoring # required fields, draftRevision sources, common mistakes
107
+ flowbase docs catalogs field-types # types, constraints, filter operators, record values, create examples
108
+ flowbase docs catalogs view-filters # view filter operators and value shapes (not page-rules)
109
+ flowbase docs catalogs record-values # how to write records.values by field type
105
110
  flowbase docs catalogs workflow-nodes # node types with in/out edge rules
106
111
  flowbase docs catalogs permissions # function permission points + data scopes
107
112
  flowbase docs catalogs dashboard-filters # filter types + date-range presets
108
- flowbase docs catalogs page-components # page region component kinds (field / relatedList)
113
+ flowbase docs catalogs page-components # Page component shapes, placement, fields, and enums
114
+ flowbase docs catalogs page-rules # Page condition operators and action shapes
109
115
  flowbase docs catalogs id-prefixes # resource ID prefix meanings
110
116
  flowbase docs catalogs icons # icon guidance + examples
111
117
  ```
112
118
 
119
+ Read `authoring` before composing any write. It lists the mistakes that most often make generated commands fail: missing `description`/`type`, select options without `id`+`lifecycle`, `defaultValue: null` (omit the key instead), boolean view filters using `eq`, `records.list` being a column projection, `pages.list.pages` being a page count, and `objects.get` not returning `draftRevision`.
120
+
113
121
  ### The read → modify → write loop
114
122
 
115
- Most `update` commands replace a **full snapshot** and accept an optional `baseRevision` for optimistic locking. The safe pattern is:
123
+ Most `update` commands replace a **full snapshot** and accept an optional `baseRevision` for optimistic locking. Check the relevant offline catalog for its exact update envelope and read-only response fields. The safe pattern is:
116
124
 
117
125
  ```bash
118
126
  flowbase dashboards get dsh_xxx > current.json # authoritative snapshot
@@ -120,16 +128,20 @@ flowbase dashboards get dsh_xxx > current.json # authoritative snapshot
120
128
  flowbase dashboards update dsh_xxx --json-file current.json
121
129
  ```
122
130
 
123
- Do not compose update bodies from scratch when an existing resource exists — `get` returns the server-valid shape, including `baseRevision`.
131
+ Do not compose update bodies from scratch when an existing resource exists. Start from `get`, then convert its read projection to the update envelope documented by the relevant catalog.
124
132
 
125
133
  ## 6. Recipes
126
134
 
127
135
  ### 6.1 Create an object with a field and a record
128
136
 
129
137
  ```bash
130
- flowbase objects create --label Customer --key customer --description "Customer records"
131
- flowbase fields create obj_xxx --json '{"label":"Name","key":"name","description":"Customer name","type":"text.singleLine","permission":"required"}'
138
+ flowbase docs catalogs authoring
139
+ flowbase docs catalogs field-types
140
+ flowbase objects create --json '{"label":"Customer","key":"customer","description":"Customer records","icon":"IconUsers"}'
141
+ flowbase fields create obj_xxx --json '{"label":"Name","key":"name","description":"Customer name","type":"text.singleLine","typeVersion":"v1","permission":"required","constraints":{"maxLength":120}}'
132
142
  flowbase records create obj_xxx --json '{"values":{"name":"Acme Corp"}}'
143
+ flowbase objects cli-edit-policy get obj_xxx
144
+ flowbase objects cli-edit-policy update obj_xxx --json '{"baseRevision":4,"policies":{"fld_xxx":"user_approval"}}' --yes
133
145
  ```
134
146
 
135
147
  Record `values` keys are **field keys** (`name`), not internal IDs (`fld_...`). IDs are `obj_`/`fld_`/`dsh_`/`wfl_`/`pag_`/`reg_`/`cmp_`-prefixed; see `docs catalogs id-prefixes`.
@@ -159,34 +171,60 @@ flowbase changes direct-release --message "Fix customer field" --yes
159
171
 
160
172
  `direct-release` always runs a server-side preflight, prints the current version, diff summary, checks and risk, and binds a one-time confirmation token. `--yes` accepts that reviewed result; it never skips validation.
161
173
 
162
- ### 6.4 Workflows and pages
174
+ On production, `records.*` sees **released** metadata only. Creating records on a brand-new object before `direct-release` returns `404 内容不存在或已被删除`. Finish metadata, release, then seed.
175
+
176
+ ### 6.4 Workflows, approvals, and pages
163
177
 
164
178
  A workflow graph must satisfy structural rules: exactly one `trigger` node, at least one `end` node, a DAG, and valid per-type edges. See `docs catalogs workflow-nodes` before composing `nodes`/`edges`.
165
179
 
180
+ Workflow conditions use `fieldId` for current-object fields and add `relationFieldId` for a one-hop related field. Field-value references use `valueRef` plus optional `valueRefRelationFieldId`. An `updateRelated` node selects the target record with its required `relationFieldId`; its assignment `fieldId` values belong to that related object. Use `workflows list` to retrieve the current object fields and the available `relations` with target fields.
181
+
182
+ Approval flow graphs are separate metadata: exactly one `trigger`, at least one `approval` node, both `approvedEnd` and `rejectedEnd`, and dual outcome edges from each approval node. Employee task decisions are not available via API key / CLI. See `docs catalogs approval-nodes`.
183
+
166
184
  ```bash
167
185
  flowbase docs catalogs workflow-nodes
168
186
  flowbase workflows create obj_xxx --json '{"label":"Set owner","enabled":true,"trigger":{"event":"create","match":"all","conditions":[]},"nodes":[],"edges":[]}'
169
187
  flowbase workflows update obj_xxx wfl_xxx --json-file workflow.json
170
188
  flowbase workflows executions obj_xxx wfl_xxx --result failure
171
189
 
172
- flowbase docs catalogs page-components # field + relatedList keys
190
+ flowbase docs catalogs approval-nodes
191
+ flowbase docs example approvals.create --output approval.json
192
+ flowbase approvals create obj_xxx --json-file approval.json
193
+ flowbase approvals set-enabled obj_xxx apr_xxx --base-revision 4 --enabled --yes
194
+
195
+ flowbase docs catalogs page-components # all component shapes and placement rules
196
+ flowbase docs catalogs page-rules # conditions, operators, and actions
197
+ flowbase pages options # objects, fields, and lookup constraints
173
198
  flowbase docs example pages.create --output page.json # create-page layout template
174
199
  flowbase pages create --json-file page.json
175
200
  flowbase pages set-default pag_xxx --base-revision 4 --yes
176
201
 
177
- # Detail pages may embed relatedList components (reverse lookup lists).
178
- flowbase pages get pag_xxx > page.json # prefer get → edit → update
179
- # or: flowbase docs example pages.update --output page.json
202
+ # Detail pages support detailSummary, stageBar, tabs, relatedSummary,
203
+ # attachmentCard, noticeBlock, relatedList, and approval components.
204
+ # A placed field uses sourcePath=[] for the Page object, or 1-2
205
+ # {relationFieldId,targetObjectId} hops for a related object field.
206
+ # Component visibility uses a page-rules setComponentVisibility action
207
+ # targeting the stable cmp_ ID returned by pages get.
208
+ # Save and read back a newly added component before adding a rule for it.
209
+ flowbase pages get pag_xxx > page-read.json
210
+ # Build page.json as {baseRevision: page-read.draftRevision, page: page-read.page},
211
+ # then remove the read-only Page keys listed by page-components.
212
+ # Or start from the complete offline example:
213
+ flowbase docs example pages.update --output page.json
180
214
  flowbase pages update pag_xxx --json-file page.json
181
215
  ```
182
216
 
183
217
  ### 6.5 Records and attachments
184
218
 
219
+ `records.list` is a **column projection** of the current view (often only the title field). Use `records.get` for the full `values` object. `values` keys are field keys; select/lookup values are option/record IDs.
220
+
185
221
  ```bash
186
222
  flowbase records list obj_xxx --page 1
187
223
  flowbase records get obj_xxx rec_xxx
224
+ flowbase docs catalogs record-values
225
+ flowbase records create obj_xxx --json '{"values":{"name":"Ada","status":"opt_xxx","class":"rec_xxx"}}'
188
226
  flowbase records upload-attachment obj_xxx fld_xxx ./contract.pdf
189
- flowbase records update obj_xxx rec_xxx --json '{"values":{"fld_contract":["att_xxx"]}}'
227
+ flowbase records update obj_xxx rec_xxx --json '{"values":{"attachments":["att_xxx"]}}'
190
228
  flowbase records download-attachment obj_xxx rec_xxx att_xxx --output ./contract.pdf
191
229
  ```
192
230
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "flowbase-cli"
7
- version = "0.1.8"
7
+ version = "0.1.10"
8
8
  description = "Command line client for the FlowBase OpenAPI"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -1,3 +1,3 @@
1
1
  """FlowBase OpenAPI CLI."""
2
2
 
3
- __version__ = "0.1.8"
3
+ __version__ = "0.1.10"