flowbase-cli 0.1.11__tar.gz → 0.1.12__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.11
3
+ Version: 0.1.12
4
4
  Summary: Command line client for the FlowBase OpenAPI
5
5
  Author: DeepFlowAI
6
6
  License: Apache-2.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "flowbase-cli"
7
- version = "0.1.11"
7
+ version = "0.1.12"
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.11"
3
+ __version__ = "0.1.12"
@@ -287,6 +287,7 @@ ENDPOINTS = (
287
287
  '{"baseRevision":3,"label":"Contract approval","enabled":true,'
288
288
  '"trigger":{"manual":true,"create":false,"update":false,"match":"all","conditions":[]},'
289
289
  '"displayFieldIds":["fld_xxx"],"lockRecord":true,"allowWithdraw":true,'
290
+ '"resubmit":{"enabled":true,"results":["rejected","withdrawn"],"limit":3},'
290
291
  '"nodes":['
291
292
  '{"id":"apn_trigger","type":"trigger"},'
292
293
  '{"id":"apn_review","type":"approval","label":"Manager review",'
@@ -304,6 +305,7 @@ ENDPOINTS = (
304
305
  '{"baseRevision":4,"label":"Contract approval","enabled":true,'
305
306
  '"trigger":{"manual":true,"create":false,"update":false,"match":"all","conditions":[]},'
306
307
  '"displayFieldIds":["fld_xxx"],"lockRecord":true,"allowWithdraw":true,'
308
+ '"resubmit":{"enabled":true,"results":["rejected","withdrawn"],"limit":3},'
307
309
  '"nodes":['
308
310
  '{"id":"apn_trigger","type":"trigger"},'
309
311
  '{"id":"apn_review","type":"approval","label":"Manager review",'
@@ -322,6 +324,29 @@ ENDPOINTS = (
322
324
  request_body='{"baseRevision":4,"enabled":true}'),
323
325
  Endpoint("approvals.delete", "flowbase_approvals_delete", "POST", "/objects/{object_id}/approvals/{approval_id}/delete", "metadata:write", "Logically delete an approval flow.", "flowbase approvals delete obj_xxx apr_xxx --base-revision 4 --yes", True,
324
326
  request_body='{"baseRevision":4}'),
327
+ Endpoint("print-templates.list", "flowbase_print_templates_list", "GET", "/objects/{object_id}/print-templates", "metadata:read", "List object print templates.", "flowbase print-templates list obj_xxx"),
328
+ Endpoint("print-templates.get", "flowbase_print_templates_get", "GET", "/objects/{object_id}/print-templates/{template_id}", "metadata:read", "Get a print template with HTML and data code.", "flowbase print-templates get obj_xxx ptp_xxx"),
329
+ Endpoint("print-templates.create", "flowbase_print_templates_create", "POST", "/objects/{object_id}/print-templates", "metadata:write", "Create a print template draft.", "flowbase print-templates create obj_xxx --json-file template.json",
330
+ request_body=(
331
+ '{"baseRevision":3,"name":"Sales order","key":"sales_order","description":"",'
332
+ '"paper":{"size":"A4","width":null,"height":null,"orientation":"portrait",'
333
+ '"margins":{"top":15,"right":15,"bottom":15,"left":15}},'
334
+ '"header":{"left":"","center":"","right":""},'
335
+ '"footer":{"left":"","center":"Page {page} / {pages}","right":""},'
336
+ '"html":"<h1>{{ record.summary }}</h1>\\n<p>{{ data.total | money(\\"CNY\\") }}</p>",'
337
+ '"code":"import flowbase\\n\\ndef run():\\n return {\\"total\\": 0}"}'
338
+ )),
339
+ Endpoint("print-templates.update", "flowbase_print_templates_update", "PUT", "/objects/{object_id}/print-templates/{template_id}", "metadata:write", "Update a print template; omitted fields keep their value.", "flowbase print-templates update obj_xxx ptp_xxx --json-file template.json",
340
+ request_body=(
341
+ '{"baseRevision":4,"baseUpdatedAt":"2026-10-13T08:00:00+00:00",'
342
+ '"html":"<h1>{{ record.summary }}</h1>"}'
343
+ )),
344
+ Endpoint("print-templates.reorder", "flowbase_print_templates_reorder", "PUT", "/objects/{object_id}/print-templates/order", "metadata:write", "Reorder object print templates.", "flowbase print-templates reorder obj_xxx --json '{\"baseRevision\":4,\"templateIds\":[\"ptp_a\",\"ptp_b\"]}'",
345
+ request_body='{"baseRevision":4,"templateIds":["ptp_a","ptp_b"]}'),
346
+ Endpoint("print-templates.set-enabled", "flowbase_print_templates_set_enabled", "POST", "/objects/{object_id}/print-templates/{template_id}/enabled", "metadata:write", "Enable or disable a print template.", "flowbase print-templates set-enabled obj_xxx ptp_xxx --base-revision 4 --enabled --yes", True,
347
+ request_body='{"baseRevision":4,"enabled":true}'),
348
+ Endpoint("print-templates.delete", "flowbase_print_templates_delete", "POST", "/objects/{object_id}/print-templates/{template_id}/delete", "metadata:write", "Logically delete a print template.", "flowbase print-templates delete obj_xxx ptp_xxx --base-revision 4 --yes", True,
349
+ request_body='{"baseRevision":4}'),
325
350
  Endpoint("pages.list", "flowbase_pages_list", "GET", "/pages", "metadata:read", "List custom Page metadata.", "flowbase pages list --object-id obj_xxx"),
326
351
  Endpoint("pages.options", "flowbase_pages_options", "GET", "/pages/options", "metadata:read", "Get custom Page design options.", "flowbase pages options"),
327
352
  Endpoint("pages.get", "flowbase_pages_get", "GET", "/pages/{page_id}", "metadata:read", "Get a custom Page.", "flowbase pages get pag_xxx"),
@@ -813,6 +838,7 @@ AUTHORING = {
813
838
  "dashboards.create": "{dashboardId,draftRevision}",
814
839
  "workflows.create": "{workflowId,draftRevision}",
815
840
  "approvals.create": "{approvalId,draftRevision}",
841
+ "print-templates.create": "{templateId,draftRevision}",
816
842
  "pages.list": "Page documents are in items. The pages field is the pagination page count.",
817
843
  "pages.create": "Returns {page:{id,key,...}, draftRevision}. There is no top-level pageId.",
818
844
  "objects.create": "Returns {objectId, draftRevision}.",
@@ -1263,7 +1289,8 @@ APPROVAL_RULES = {
1263
1289
  "selfPolicy": ["allow", "skip"],
1264
1290
  "unavailablePolicy": ["autoApprove", "autoReject", "fallback"],
1265
1291
  "constraints": "employees needs nonempty employeeIds; recordField needs an active lookup.employee; supervisor level is 1..10; fallback needs fallbackEmployeeId from employee discovery.",
1266
- "updateEnvelope": ["baseRevision", "label", "enabled", "trigger", "displayFieldIds", "lockRecord", "allowWithdraw", "nodes", "edges"],
1292
+ "resubmit": "{enabled,results,limit}: results subset of rejected/withdrawn/approved (nonempty when enabled); limit null (unlimited) or integer 2..99 counting every non-failed instance per record. Omitted means enabled, all results, unlimited.",
1293
+ "updateEnvelope": ["baseRevision", "label", "enabled", "trigger", "displayFieldIds", "lockRecord", "allowWithdraw", "resubmit", "nodes", "edges"],
1267
1294
  "note": "Use docs example approvals.create for a complete graph. Start disabled while authoring. Employee submit/decide is not a management CLI operation.",
1268
1295
  }
1269
1296
 
@@ -710,6 +710,37 @@ def handle_approvals(args: argparse.Namespace) -> int:
710
710
  )
711
711
 
712
712
 
713
+ def handle_print_templates(args: argparse.Namespace) -> int:
714
+ action = args.print_templates_action
715
+ path = {"object_id": args.object_id}
716
+ if hasattr(args, "template_id"):
717
+ path["template_id"] = args.template_id
718
+ if action in ("list", "get"):
719
+ return run_request(args, f"print-templates.{action}", path_params=path)
720
+ if action == "create":
721
+ body = load_json_payload(args.json, args.json_file)
722
+ require_fields(body, "name", "html")
723
+ return run_request(args, "print-templates.create", path_params=path, body=body)
724
+ if action == "update":
725
+ body = load_json_payload(args.json, args.json_file)
726
+ return run_request(args, "print-templates.update", path_params=path, body=body)
727
+ if action == "reorder":
728
+ body = load_json_payload(args.json, args.json_file)
729
+ require_fields(body, "baseRevision", "templateIds")
730
+ if not isinstance(body["templateIds"], list):
731
+ raise CliError("Request field 'templateIds' must be an array.")
732
+ return run_request(args, "print-templates.reorder", path_params=path, body=body)
733
+ if action == "set-enabled":
734
+ return run_request(
735
+ args, "print-templates.set-enabled", path_params=path,
736
+ body={"baseRevision": args.base_revision, "enabled": args.enabled},
737
+ )
738
+ return run_request(
739
+ args, "print-templates.delete", path_params=path,
740
+ body={"baseRevision": args.base_revision},
741
+ )
742
+
743
+
713
744
  def handle_pages(args: argparse.Namespace) -> int:
714
745
  action = args.pages_action
715
746
  if action == "evaluate":
@@ -1272,6 +1303,40 @@ def build_parser() -> argparse.ArgumentParser:
1272
1303
  add_yes(approval_delete)
1273
1304
  approvals.set_defaults(handler=handle_approvals)
1274
1305
 
1306
+ print_templates = groups.add_parser(
1307
+ "print-templates", help="Manage object print template metadata (HTML + data code).",
1308
+ )
1309
+ print_template_actions = print_templates.add_subparsers(
1310
+ dest="print_templates_action", required=True,
1311
+ )
1312
+ print_template_list = print_template_actions.add_parser("list")
1313
+ print_template_list.add_argument("object_id")
1314
+ print_template_get = print_template_actions.add_parser("get")
1315
+ print_template_get.add_argument("object_id")
1316
+ print_template_get.add_argument("template_id")
1317
+ for action in ("create", "reorder"):
1318
+ item = print_template_actions.add_parser(action)
1319
+ item.add_argument("object_id")
1320
+ add_json_args(item, endpoint_key=f"print-templates.{action}")
1321
+ print_template_update = print_template_actions.add_parser("update")
1322
+ print_template_update.add_argument("object_id")
1323
+ print_template_update.add_argument("template_id")
1324
+ add_json_args(print_template_update, endpoint_key="print-templates.update")
1325
+ print_template_enabled = print_template_actions.add_parser("set-enabled")
1326
+ print_template_enabled.add_argument("object_id")
1327
+ print_template_enabled.add_argument("template_id")
1328
+ print_template_enabled.add_argument("--base-revision", required=True, type=int)
1329
+ print_template_enabled.add_argument(
1330
+ "--enabled", action=argparse.BooleanOptionalAction, required=True,
1331
+ )
1332
+ add_yes(print_template_enabled)
1333
+ print_template_delete = print_template_actions.add_parser("delete")
1334
+ print_template_delete.add_argument("object_id")
1335
+ print_template_delete.add_argument("template_id")
1336
+ print_template_delete.add_argument("--base-revision", required=True, type=int)
1337
+ add_yes(print_template_delete)
1338
+ print_templates.set_defaults(handler=handle_print_templates)
1339
+
1275
1340
  pages = groups.add_parser("pages", help="Manage custom Page metadata.")
1276
1341
  page_actions = pages.add_subparsers(dest="pages_action", required=True)
1277
1342
  page_evaluate = page_actions.add_parser("evaluate", help="Evaluate sample rule effects, not visual rendering or record validation.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flowbase-cli
3
- Version: 0.1.11
3
+ Version: 0.1.12
4
4
  Summary: Command line client for the FlowBase OpenAPI
5
5
  Author: DeepFlowAI
6
6
  License: Apache-2.0
File without changes
File without changes