flowbase-cli 0.1.9__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.9
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
@@ -91,7 +91,7 @@ flowbase
91
91
  └── roles list | options | get | create | update | delete (production only)
92
92
  ```
93
93
 
94
- 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).
95
95
 
96
96
  ## 5. Discovering request bodies
97
97
 
@@ -112,18 +112,24 @@ Complex bodies reference closed sets that are not guessable from examples. Query
112
112
 
113
113
  ```bash
114
114
  flowbase docs catalogs # list available catalogs
115
- 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
116
119
  flowbase docs catalogs workflow-nodes # node types with in/out edge rules
117
120
  flowbase docs catalogs permissions # function permission points + data scopes
118
121
  flowbase docs catalogs dashboard-filters # filter types + date-range presets
119
- flowbase docs catalogs page-components # page region component kinds (field / relatedList / approval)
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
120
124
  flowbase docs catalogs id-prefixes # resource ID prefix meanings
121
125
  flowbase docs catalogs icons # icon guidance + examples
122
126
  ```
123
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
+
124
130
  ### The read → modify → write loop
125
131
 
126
- 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:
127
133
 
128
134
  ```bash
129
135
  flowbase dashboards get dsh_xxx > current.json # authoritative snapshot
@@ -131,15 +137,17 @@ flowbase dashboards get dsh_xxx > current.json # authoritative snapshot
131
137
  flowbase dashboards update dsh_xxx --json-file current.json
132
138
  ```
133
139
 
134
- 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.
135
141
 
136
142
  ## 6. Recipes
137
143
 
138
144
  ### 6.1 Create an object with a field and a record
139
145
 
140
146
  ```bash
141
- flowbase objects create --label Customer --key customer --description "Customer records"
142
- 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}}'
143
151
  flowbase records create obj_xxx --json '{"values":{"name":"Acme Corp"}}'
144
152
  flowbase objects cli-edit-policy get obj_xxx
145
153
  flowbase objects cli-edit-policy update obj_xxx --json '{"baseRevision":4,"policies":{"fld_xxx":"user_approval"}}' --yes
@@ -172,10 +180,14 @@ flowbase changes direct-release --message "Fix customer field" --yes
172
180
 
173
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.
174
182
 
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
+
175
185
  ### 6.4 Workflows, approvals, and pages
176
186
 
177
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`.
178
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
+
179
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`.
180
192
 
181
193
  ```bash
@@ -189,24 +201,39 @@ flowbase docs example approvals.create --output approval.json
189
201
  flowbase approvals create obj_xxx --json-file approval.json
190
202
  flowbase approvals set-enabled obj_xxx apr_xxx --base-revision 4 --enabled --yes
191
203
 
192
- flowbase docs catalogs page-components # field + relatedList + approval keys
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
193
207
  flowbase docs example pages.create --output page.json # create-page layout template
194
208
  flowbase pages create --json-file page.json
195
209
  flowbase pages set-default pag_xxx --base-revision 4 --yes
196
210
 
197
- # Detail pages may embed relatedList and at most one approval component.
198
- flowbase pages get pag_xxx > page.json # prefer get → edit → update
199
- # 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
200
223
  flowbase pages update pag_xxx --json-file page.json
201
224
  ```
202
225
 
203
226
  ### 6.5 Records and attachments
204
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
+
205
230
  ```bash
206
231
  flowbase records list obj_xxx --page 1
207
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"}}'
208
235
  flowbase records upload-attachment obj_xxx fld_xxx ./contract.pdf
209
- 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"]}}'
210
237
  flowbase records download-attachment obj_xxx rec_xxx att_xxx --output ./contract.pdf
211
238
  ```
212
239
 
@@ -82,7 +82,7 @@ flowbase
82
82
  └── roles list | options | get | create | update | delete (production only)
83
83
  ```
84
84
 
85
- 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).
86
86
 
87
87
  ## 5. Discovering request bodies
88
88
 
@@ -103,18 +103,24 @@ Complex bodies reference closed sets that are not guessable from examples. Query
103
103
 
104
104
  ```bash
105
105
  flowbase docs catalogs # list available catalogs
106
- 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
107
110
  flowbase docs catalogs workflow-nodes # node types with in/out edge rules
108
111
  flowbase docs catalogs permissions # function permission points + data scopes
109
112
  flowbase docs catalogs dashboard-filters # filter types + date-range presets
110
- flowbase docs catalogs page-components # page region component kinds (field / relatedList / approval)
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
111
115
  flowbase docs catalogs id-prefixes # resource ID prefix meanings
112
116
  flowbase docs catalogs icons # icon guidance + examples
113
117
  ```
114
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
+
115
121
  ### The read → modify → write loop
116
122
 
117
- 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:
118
124
 
119
125
  ```bash
120
126
  flowbase dashboards get dsh_xxx > current.json # authoritative snapshot
@@ -122,15 +128,17 @@ flowbase dashboards get dsh_xxx > current.json # authoritative snapshot
122
128
  flowbase dashboards update dsh_xxx --json-file current.json
123
129
  ```
124
130
 
125
- 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.
126
132
 
127
133
  ## 6. Recipes
128
134
 
129
135
  ### 6.1 Create an object with a field and a record
130
136
 
131
137
  ```bash
132
- flowbase objects create --label Customer --key customer --description "Customer records"
133
- 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}}'
134
142
  flowbase records create obj_xxx --json '{"values":{"name":"Acme Corp"}}'
135
143
  flowbase objects cli-edit-policy get obj_xxx
136
144
  flowbase objects cli-edit-policy update obj_xxx --json '{"baseRevision":4,"policies":{"fld_xxx":"user_approval"}}' --yes
@@ -163,10 +171,14 @@ flowbase changes direct-release --message "Fix customer field" --yes
163
171
 
164
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.
165
173
 
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
+
166
176
  ### 6.4 Workflows, approvals, and pages
167
177
 
168
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`.
169
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
+
170
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`.
171
183
 
172
184
  ```bash
@@ -180,24 +192,39 @@ flowbase docs example approvals.create --output approval.json
180
192
  flowbase approvals create obj_xxx --json-file approval.json
181
193
  flowbase approvals set-enabled obj_xxx apr_xxx --base-revision 4 --enabled --yes
182
194
 
183
- flowbase docs catalogs page-components # field + relatedList + approval keys
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
184
198
  flowbase docs example pages.create --output page.json # create-page layout template
185
199
  flowbase pages create --json-file page.json
186
200
  flowbase pages set-default pag_xxx --base-revision 4 --yes
187
201
 
188
- # Detail pages may embed relatedList and at most one approval component.
189
- flowbase pages get pag_xxx > page.json # prefer get → edit → update
190
- # 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
191
214
  flowbase pages update pag_xxx --json-file page.json
192
215
  ```
193
216
 
194
217
  ### 6.5 Records and attachments
195
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
+
196
221
  ```bash
197
222
  flowbase records list obj_xxx --page 1
198
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"}}'
199
226
  flowbase records upload-attachment obj_xxx fld_xxx ./contract.pdf
200
- 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"]}}'
201
228
  flowbase records download-attachment obj_xxx rec_xxx att_xxx --output ./contract.pdf
202
229
  ```
203
230
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "flowbase-cli"
7
- version = "0.1.9"
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.9"
3
+ __version__ = "0.1.10"