makea-cli 0.2.34__py3-none-any.whl → 0.2.37__py3-none-any.whl
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.
- makea_cli/__init__.py +1 -1
- makea_cli/api_client.py +164 -0
- makea_cli/commands/__init__.py +2 -0
- makea_cli/commands/order_flow/__init__.py +3 -0
- makea_cli/commands/order_flow/cmd.py +723 -0
- makea_cli/commands/shipping/cmd.py +215 -0
- {makea_cli-0.2.34.dist-info → makea_cli-0.2.37.dist-info}/METADATA +20 -1
- {makea_cli-0.2.34.dist-info → makea_cli-0.2.37.dist-info}/RECORD +10 -8
- {makea_cli-0.2.34.dist-info → makea_cli-0.2.37.dist-info}/WHEEL +0 -0
- {makea_cli-0.2.34.dist-info → makea_cli-0.2.37.dist-info}/entry_points.txt +0 -0
makea_cli/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.2.
|
|
1
|
+
__version__ = "0.2.37"
|
makea_cli/api_client.py
CHANGED
|
@@ -811,6 +811,56 @@ def admin_update_shipping_order_cargo(shipping_order_id: str, cargo: dict[str, A
|
|
|
811
811
|
return put_json(f"/admin/shipping_orders/{shipping_order_id}/cargo", cargo)
|
|
812
812
|
|
|
813
813
|
|
|
814
|
+
def _consignments_path(shipping_order_id: str | None, production_order_id: str | None) -> str:
|
|
815
|
+
if bool(shipping_order_id) == bool(production_order_id):
|
|
816
|
+
raise ValueError("pass exactly one of shipping_order_id / production_order_id")
|
|
817
|
+
if shipping_order_id:
|
|
818
|
+
return f"/admin/shipping_orders/{shipping_order_id}/consignments"
|
|
819
|
+
return f"/admin/production_orders/{production_order_id}/consignments"
|
|
820
|
+
|
|
821
|
+
|
|
822
|
+
def admin_list_consignments(
|
|
823
|
+
*, shipping_order_id: str | None = None, production_order_id: str | None = None
|
|
824
|
+
) -> Any:
|
|
825
|
+
"""GET .../consignments — the lots a shipment left in, with counts.
|
|
826
|
+
|
|
827
|
+
A production order id resolves to the shipping order its goods ride on."""
|
|
828
|
+
return get_json(_consignments_path(shipping_order_id, production_order_id))
|
|
829
|
+
|
|
830
|
+
|
|
831
|
+
def admin_add_consignment(
|
|
832
|
+
body: dict[str, Any],
|
|
833
|
+
*,
|
|
834
|
+
shipping_order_id: str | None = None,
|
|
835
|
+
production_order_id: str | None = None,
|
|
836
|
+
) -> Any:
|
|
837
|
+
"""POST .../consignments — one lot leaving the factory, with its tracking number."""
|
|
838
|
+
return post_json(_consignments_path(shipping_order_id, production_order_id), body)
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
def admin_update_consignment(
|
|
842
|
+
consignment_id: str,
|
|
843
|
+
body: dict[str, Any],
|
|
844
|
+
*,
|
|
845
|
+
shipping_order_id: str | None = None,
|
|
846
|
+
production_order_id: str | None = None,
|
|
847
|
+
) -> Any:
|
|
848
|
+
"""PUT .../consignments/{cid} — edit a lot; {"status": "DELIVERED"} marks it delivered."""
|
|
849
|
+
path = _consignments_path(shipping_order_id, production_order_id)
|
|
850
|
+
return put_json(f"{path}/{consignment_id}", body)
|
|
851
|
+
|
|
852
|
+
|
|
853
|
+
def admin_delete_consignment(
|
|
854
|
+
consignment_id: str,
|
|
855
|
+
*,
|
|
856
|
+
shipping_order_id: str | None = None,
|
|
857
|
+
production_order_id: str | None = None,
|
|
858
|
+
) -> Any:
|
|
859
|
+
"""DELETE .../consignments/{cid} — remove a lot that has not been delivered."""
|
|
860
|
+
path = _consignments_path(shipping_order_id, production_order_id)
|
|
861
|
+
return delete_json(f"{path}/{consignment_id}")
|
|
862
|
+
|
|
863
|
+
|
|
814
864
|
def admin_delete_shipping_order(shipping_order_id: str) -> Any:
|
|
815
865
|
"""DELETE /admin/shipping_orders/{id}/delete — soft delete; unlinks its orders."""
|
|
816
866
|
return delete_json(f"/admin/shipping_orders/{shipping_order_id}/delete")
|
|
@@ -1382,6 +1432,120 @@ def admin_change_step(product_id: str, supplier_id: str, body: dict[str, Any]) -
|
|
|
1382
1432
|
return post_json(f"/admin/products/{product_id}/suppliers/{supplier_id}/change_step", body)
|
|
1383
1433
|
|
|
1384
1434
|
|
|
1435
|
+
def admin_get_order_flow(product_id: str) -> Any:
|
|
1436
|
+
"""GET /admin/products/{id}/order_flow — the order's steps read for makea, the
|
|
1437
|
+
factories' names and the brand's user id."""
|
|
1438
|
+
return get_json(f"/admin/products/{product_id}/order_flow")
|
|
1439
|
+
|
|
1440
|
+
|
|
1441
|
+
def _custom_step_path(product_id: str, step_id: str | None = None) -> str:
|
|
1442
|
+
path = f"/admin/products/{product_id}/order_flow/custom_steps"
|
|
1443
|
+
# A step id carries "#" and "@": encoded whole, as one path segment.
|
|
1444
|
+
return f"{path}/{quote(step_id, safe='')}" if step_id else path
|
|
1445
|
+
|
|
1446
|
+
|
|
1447
|
+
def admin_add_custom_step(product_id: str, body: dict[str, Any]) -> Any:
|
|
1448
|
+
"""POST .../order_flow/custom_steps — {label, after, who, completion, due, hold, note,
|
|
1449
|
+
supplier_id?, placement?, joins?}."""
|
|
1450
|
+
return post_json(_custom_step_path(product_id), body)
|
|
1451
|
+
|
|
1452
|
+
|
|
1453
|
+
def admin_update_custom_step(product_id: str, step_id: str, body: dict[str, Any]) -> Any:
|
|
1454
|
+
"""PATCH .../order_flow/custom_steps/{step_id} — only the fields given."""
|
|
1455
|
+
return patch_json(_custom_step_path(product_id, step_id), body)
|
|
1456
|
+
|
|
1457
|
+
|
|
1458
|
+
def admin_delete_custom_step(product_id: str, step_id: str) -> Any:
|
|
1459
|
+
"""DELETE .../order_flow/custom_steps/{step_id} — only while nothing happened on it."""
|
|
1460
|
+
return delete_json(_custom_step_path(product_id, step_id))
|
|
1461
|
+
|
|
1462
|
+
|
|
1463
|
+
def admin_custom_step_move(product_id: str, step_id: str, move: str, body: dict[str, Any]) -> Any:
|
|
1464
|
+
"""POST .../order_flow/custom_steps/{step_id}/{move} — done | upload | submit |
|
|
1465
|
+
approve | send_back | skip, {"as": "makea" | "supplier", files?, note?, comment?,
|
|
1466
|
+
reason?}."""
|
|
1467
|
+
return post_json(f"{_custom_step_path(product_id, step_id)}/{move}", body)
|
|
1468
|
+
|
|
1469
|
+
|
|
1470
|
+
# --- an order's steps from the brand's and the factory's own seats -----------------
|
|
1471
|
+
|
|
1472
|
+
|
|
1473
|
+
def _designer_step_path(product_id: str, step_id: str | None = None) -> str:
|
|
1474
|
+
path = f"/designer/products/{product_id}/order_flow/custom_steps"
|
|
1475
|
+
return f"{path}/{quote(step_id, safe='')}" if step_id else path
|
|
1476
|
+
|
|
1477
|
+
|
|
1478
|
+
def designer_get_order_flow(product_id: str) -> Any:
|
|
1479
|
+
"""GET /designer/products/{id}/order_flow — the order's steps as the brand reads them."""
|
|
1480
|
+
return get_json(f"/designer/products/{product_id}/order_flow")
|
|
1481
|
+
|
|
1482
|
+
|
|
1483
|
+
def designer_add_custom_step(product_id: str, body: dict[str, Any]) -> Any:
|
|
1484
|
+
"""POST /designer/products/{id}/order_flow/custom_steps — {label, after, who,
|
|
1485
|
+
completion, due, hold, note, placement?, joins?}."""
|
|
1486
|
+
return post_json(_designer_step_path(product_id), body)
|
|
1487
|
+
|
|
1488
|
+
|
|
1489
|
+
def designer_update_custom_step(product_id: str, step_id: str, body: dict[str, Any]) -> Any:
|
|
1490
|
+
"""PATCH /designer/products/{id}/order_flow/custom_steps/{step_id} — the fields given."""
|
|
1491
|
+
return patch_json(_designer_step_path(product_id, step_id), body)
|
|
1492
|
+
|
|
1493
|
+
|
|
1494
|
+
def designer_delete_custom_step(product_id: str, step_id: str) -> Any:
|
|
1495
|
+
"""DELETE /designer/products/{id}/order_flow/custom_steps/{step_id}."""
|
|
1496
|
+
return delete_json(_designer_step_path(product_id, step_id))
|
|
1497
|
+
|
|
1498
|
+
|
|
1499
|
+
def designer_custom_step_move(
|
|
1500
|
+
product_id: str, step_id: str, move: str, body: dict[str, Any]
|
|
1501
|
+
) -> Any:
|
|
1502
|
+
"""POST /designer/products/{id}/order_flow/custom_steps/{step_id}/{move} — done |
|
|
1503
|
+
upload | approve | send_back | skip."""
|
|
1504
|
+
return post_json(f"{_designer_step_path(product_id, step_id)}/{move}", body)
|
|
1505
|
+
|
|
1506
|
+
|
|
1507
|
+
def supplier_get_order_flow(product_id: str) -> Any:
|
|
1508
|
+
"""GET /supplier/products/{id}/order_flow — the factory's own read of the order."""
|
|
1509
|
+
return get_json(f"/supplier/products/{product_id}/order_flow")
|
|
1510
|
+
|
|
1511
|
+
|
|
1512
|
+
def supplier_list_custom_steps(product_id: str) -> Any:
|
|
1513
|
+
"""GET /supplier/products/{id}/custom_steps — the added steps the factory does."""
|
|
1514
|
+
return get_json(f"/supplier/products/{product_id}/custom_steps")
|
|
1515
|
+
|
|
1516
|
+
|
|
1517
|
+
def supplier_custom_step_move(
|
|
1518
|
+
product_id: str, step_id: str, move: str, body: dict[str, Any]
|
|
1519
|
+
) -> Any:
|
|
1520
|
+
"""POST /supplier/products/{id}/custom_steps/{step_id}/{move} — done | upload | submit."""
|
|
1521
|
+
return post_json(
|
|
1522
|
+
f"/supplier/products/{product_id}/custom_steps/{quote(step_id, safe='')}/{move}", body
|
|
1523
|
+
)
|
|
1524
|
+
|
|
1525
|
+
|
|
1526
|
+
def supplier_ship_sample(sampling_order_id: str, body: dict[str, Any]) -> Any:
|
|
1527
|
+
"""POST /supplier/sampling_orders/{id}/ship — {carrier, tracking_number, tracking_url?}."""
|
|
1528
|
+
return post_json(f"/supplier/sampling_orders/{sampling_order_id}/ship", body)
|
|
1529
|
+
|
|
1530
|
+
|
|
1531
|
+
def supplier_confirm_production_date(production_order_id: str, body: dict[str, Any]) -> Any:
|
|
1532
|
+
"""POST /supplier/production_orders/{id}/lead_time — {completion_date, note?}: accept
|
|
1533
|
+
the order with the date bulk will be done."""
|
|
1534
|
+
return post_json(f"/supplier/production_orders/{production_order_id}/lead_time", body)
|
|
1535
|
+
|
|
1536
|
+
|
|
1537
|
+
def supplier_upload_document(
|
|
1538
|
+
file_path: Path, *, product_id: str, doc_type: str = "NOTE_ATTACHMENT"
|
|
1539
|
+
) -> Any:
|
|
1540
|
+
"""POST /supplier/upload_document — multipart ``file`` with ``product_id`` and
|
|
1541
|
+
``doc_type``; returns the document id."""
|
|
1542
|
+
return post_multipart_with_file(
|
|
1543
|
+
"/supplier/upload_document",
|
|
1544
|
+
file_path=file_path,
|
|
1545
|
+
form_fields={"product_id": product_id, "doc_type": doc_type},
|
|
1546
|
+
)
|
|
1547
|
+
|
|
1548
|
+
|
|
1385
1549
|
def admin_list_product_notes(product_id: str) -> Any:
|
|
1386
1550
|
"""GET /admin/products/{id}/notes — the product's customer notes."""
|
|
1387
1551
|
return get_json(f"/admin/products/{product_id}/notes")
|
makea_cli/commands/__init__.py
CHANGED
|
@@ -15,6 +15,7 @@ from makea_cli.commands.files.cmd import register as register_files
|
|
|
15
15
|
from makea_cli.commands.flags.cmd import register as register_flags
|
|
16
16
|
from makea_cli.commands.library.cmd import register as register_library
|
|
17
17
|
from makea_cli.commands.metrics.cmd import register as register_metrics
|
|
18
|
+
from makea_cli.commands.order_flow.cmd import register as register_order_flow
|
|
18
19
|
from makea_cli.commands.orders.cmd import register as register_orders
|
|
19
20
|
from makea_cli.commands.playbook.cmd import register as register_playbook
|
|
20
21
|
from makea_cli.commands.product.cmd import register as register_product
|
|
@@ -31,6 +32,7 @@ def register_all(app: typer.Typer) -> None:
|
|
|
31
32
|
register_document(app)
|
|
32
33
|
register_supplier(app)
|
|
33
34
|
register_orders(app)
|
|
35
|
+
register_order_flow(app)
|
|
34
36
|
register_product(app)
|
|
35
37
|
register_production(app)
|
|
36
38
|
register_shipping(app)
|
|
@@ -0,0 +1,723 @@
|
|
|
1
|
+
"""An order's steps (its flow) and the steps added to it, from each seat.
|
|
2
|
+
|
|
3
|
+
admin ``admin get order-flow`` reads every step by stage with whose move it
|
|
4
|
+
is. Added (custom) steps are set up with ``admin create|update|delete
|
|
5
|
+
custom-step`` and completed with ``admin submit custom-step --move``,
|
|
6
|
+
as makea or as the step's factory. A step makea adds is makea's.
|
|
7
|
+
designer The brand's own: ``designer get order-flow`` and ``designer
|
|
8
|
+
create|update|delete|submit custom-step``.
|
|
9
|
+
supplier The factory's own read (``supplier get order-flow``), its added steps
|
|
10
|
+
(``supplier list|submit custom-step``: done, upload, submit a round),
|
|
11
|
+
sending its sample and accepting the order. Factories do not add or
|
|
12
|
+
change steps.
|
|
13
|
+
|
|
14
|
+
Where a step goes (``--placement``): ``inline`` on the line (the next step
|
|
15
|
+
waits for it), ``alongside`` on a line of its own beside the next step, with
|
|
16
|
+
``--joins`` the step that waits for it (default: the step after that one;
|
|
17
|
+
``--no-joins`` for none), or ``beside`` a side line's step (``--after`` that
|
|
18
|
+
step): a new line from where that line starts. ``--after`` a side line's step
|
|
19
|
+
with ``inline`` continues that line; the step it joins waits for the whole
|
|
20
|
+
line. Standard steps are moved by their own commands; this group only reads
|
|
21
|
+
them.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
from __future__ import annotations
|
|
25
|
+
|
|
26
|
+
from pathlib import Path
|
|
27
|
+
from typing import Any
|
|
28
|
+
|
|
29
|
+
import typer
|
|
30
|
+
from rich.console import Console
|
|
31
|
+
|
|
32
|
+
from makea_cli import api_client
|
|
33
|
+
from makea_cli.commands._util import print_json_or_exit
|
|
34
|
+
from makea_cli.registry import command
|
|
35
|
+
|
|
36
|
+
console = Console()
|
|
37
|
+
|
|
38
|
+
WHO = ("BRAND", "SUPPLIER", "MAKEA", "3PL")
|
|
39
|
+
DONE_WHEN = ("check", "upload", "send")
|
|
40
|
+
DUE_KEYS = ("sample_ready", "sample_approved", "bulk_done", "delivery")
|
|
41
|
+
MOVES = ("done", "upload", "submit", "approve", "send-back", "skip")
|
|
42
|
+
AS_SUPPLIER_MOVES = ("done", "upload", "submit")
|
|
43
|
+
BRAND_MOVES = ("done", "upload", "approve", "send-back", "skip")
|
|
44
|
+
FACTORY_MOVES = ("done", "upload", "submit")
|
|
45
|
+
PLACEMENTS = ("inline", "alongside", "beside")
|
|
46
|
+
_PLACEMENT_HELP = (
|
|
47
|
+
"inline (on the line: the next step waits for it), alongside (a line of its own, at "
|
|
48
|
+
"the same time as the next step) or beside (--after a side line's step: a new line "
|
|
49
|
+
"from where that line starts)."
|
|
50
|
+
)
|
|
51
|
+
_JOINS_HELP = (
|
|
52
|
+
"Alongside: id of the step that waits for it (a later step). Default: the step after "
|
|
53
|
+
"the one it runs with."
|
|
54
|
+
)
|
|
55
|
+
_NO_JOINS_HELP = "Alongside: nothing waits for it."
|
|
56
|
+
_HOLD_HELP = (
|
|
57
|
+
"A check inside Pre-production or Bulk production (--after one of them): the step "
|
|
58
|
+
"after it waits for this one."
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
_PRODUCT_HELP = "Product id (the order)."
|
|
62
|
+
_STEP_HELP = (
|
|
63
|
+
"Step id from admin get order-flow, e.g. 'custom.lab-test-1a2b3c@main#1' (quote it: "
|
|
64
|
+
"it has a #)."
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def _choice(value: str | None, allowed: tuple[str, ...], flag: str) -> str | None:
|
|
69
|
+
if value is None:
|
|
70
|
+
return None
|
|
71
|
+
v = value.strip()
|
|
72
|
+
v = v.upper() if v.upper() in allowed else v.lower()
|
|
73
|
+
if v not in allowed:
|
|
74
|
+
raise typer.BadParameter(f"{flag} must be one of {', '.join(allowed)}")
|
|
75
|
+
return v
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _due(
|
|
79
|
+
due_date: str | None, due_days: int | None, due_before: str | None, no_due: bool
|
|
80
|
+
) -> dict[str, Any] | None | bool:
|
|
81
|
+
"""The due rule, None for no date, False when nothing was said."""
|
|
82
|
+
if no_due:
|
|
83
|
+
if due_date or due_days is not None or due_before:
|
|
84
|
+
raise typer.BadParameter("--no-due cannot be combined with a due date")
|
|
85
|
+
return None
|
|
86
|
+
if due_date and (due_days is not None or due_before):
|
|
87
|
+
raise typer.BadParameter("pass --due-date, or --due-days with --due-before, not both")
|
|
88
|
+
if due_date:
|
|
89
|
+
return {"mode": "date", "date": due_date}
|
|
90
|
+
if due_days is not None or due_before:
|
|
91
|
+
if due_days is None or not due_before:
|
|
92
|
+
raise typer.BadParameter("--due-days and --due-before go together")
|
|
93
|
+
return {
|
|
94
|
+
"mode": "before",
|
|
95
|
+
"days": due_days,
|
|
96
|
+
"key": _choice(due_before, DUE_KEYS, "--due-before"),
|
|
97
|
+
}
|
|
98
|
+
return False
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def _step_body(
|
|
102
|
+
*,
|
|
103
|
+
label: str | None,
|
|
104
|
+
after: str | None,
|
|
105
|
+
who: str | None,
|
|
106
|
+
supplier: str | None,
|
|
107
|
+
done_when: str | None,
|
|
108
|
+
due: dict[str, Any] | None | bool,
|
|
109
|
+
hold: bool | None,
|
|
110
|
+
note: str | None,
|
|
111
|
+
placement: str | None = None,
|
|
112
|
+
joins: str | None = None,
|
|
113
|
+
no_joins: bool = False,
|
|
114
|
+
) -> dict[str, Any]:
|
|
115
|
+
body: dict[str, Any] = {}
|
|
116
|
+
if joins and no_joins:
|
|
117
|
+
raise typer.BadParameter("pass --joins or --no-joins, not both")
|
|
118
|
+
if placement is not None:
|
|
119
|
+
body["placement"] = _choice(placement, PLACEMENTS, "--placement")
|
|
120
|
+
if joins:
|
|
121
|
+
body["joins"] = joins
|
|
122
|
+
elif no_joins:
|
|
123
|
+
body["joins"] = None
|
|
124
|
+
for key, value in (
|
|
125
|
+
("label", label),
|
|
126
|
+
("after", after),
|
|
127
|
+
("who", _choice(who, WHO, "--who")),
|
|
128
|
+
("supplier_id", supplier),
|
|
129
|
+
("completion", _choice(done_when, DONE_WHEN, "--done-when")),
|
|
130
|
+
("hold", hold),
|
|
131
|
+
("note", note),
|
|
132
|
+
):
|
|
133
|
+
if value is not None:
|
|
134
|
+
body[key] = value
|
|
135
|
+
if due is not False:
|
|
136
|
+
body["due"] = due
|
|
137
|
+
return body
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def _files(product_id: str, paths: list[Path] | None, document_ids: list[str] | None) -> list[dict]:
|
|
141
|
+
"""Upload local files under the brand, and add documents already on the platform."""
|
|
142
|
+
files: list[dict[str, Any]] = [{"document_id": d} for d in document_ids or []]
|
|
143
|
+
if not paths:
|
|
144
|
+
return files
|
|
145
|
+
flow = api_client.admin_get_order_flow(product_id)
|
|
146
|
+
owner = (flow or {}).get("owner_user_id")
|
|
147
|
+
if not owner:
|
|
148
|
+
raise typer.BadParameter("could not tell whose order this is to file the upload under")
|
|
149
|
+
for p in paths:
|
|
150
|
+
res = api_client.upload_admin_document_to_product(
|
|
151
|
+
user_id=owner, product_id=product_id, file_path=p, doc_type="NOTE_ATTACHMENT"
|
|
152
|
+
)
|
|
153
|
+
doc = (res or {}).get("result") or res or {}
|
|
154
|
+
doc = doc.get("document") if isinstance(doc.get("document"), dict) else doc
|
|
155
|
+
doc_id = doc.get("document_id")
|
|
156
|
+
if not doc_id:
|
|
157
|
+
raise typer.BadParameter(f"upload of {p.name} returned no document id")
|
|
158
|
+
files.append({"document_id": doc_id, "name": p.name})
|
|
159
|
+
return files
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def register(app: typer.Typer) -> None:
|
|
163
|
+
@command(
|
|
164
|
+
app,
|
|
165
|
+
"admin",
|
|
166
|
+
"get",
|
|
167
|
+
"order-flow",
|
|
168
|
+
api="GET /admin/products/{product_id}/order_flow",
|
|
169
|
+
help=(
|
|
170
|
+
"An order's steps: stages, sample lanes, every step with its state (pending, "
|
|
171
|
+
"active, done, skipped, stopped), whose move it is (owner) and when, the key "
|
|
172
|
+
"dates, and the factories' names. Added steps carry `custom` (who does it, how "
|
|
173
|
+
"it is done, due, hold, rounds, files). Use a step's `id` as --after or STEP_ID."
|
|
174
|
+
),
|
|
175
|
+
)
|
|
176
|
+
def get_order_flow(product_id: str = typer.Argument(..., help=_PRODUCT_HELP)) -> None:
|
|
177
|
+
"""Show an order's steps."""
|
|
178
|
+
print_json_or_exit(console, lambda: api_client.admin_get_order_flow(product_id))
|
|
179
|
+
|
|
180
|
+
_WHO_HELP = "Who does it: BRAND, SUPPLIER (the factory), MAKEA or 3PL (the warehouse)."
|
|
181
|
+
_DONE_WHEN_HELP = (
|
|
182
|
+
"How it is done: check (ticked off), upload (a file is uploaded) or send (the doer "
|
|
183
|
+
"sends it, the brand approves or sends it back; not for BRAND)."
|
|
184
|
+
)
|
|
185
|
+
_DUE_KEYS_HELP = f"Key date it is due before: {', '.join(DUE_KEYS)}."
|
|
186
|
+
|
|
187
|
+
@command(
|
|
188
|
+
app,
|
|
189
|
+
"admin",
|
|
190
|
+
"create",
|
|
191
|
+
"custom-step",
|
|
192
|
+
api="POST /admin/products/{product_id}/order_flow/custom_steps",
|
|
193
|
+
side_effects=[
|
|
194
|
+
"the step shows on the brand's order page (and the factory's, when it does it)",
|
|
195
|
+
"once the step before it has started, whoever does it gets an action card",
|
|
196
|
+
"in line, the next step waits for it; alongside, the step it --joins does",
|
|
197
|
+
],
|
|
198
|
+
approval="ask",
|
|
199
|
+
help=(
|
|
200
|
+
"Add a step to one order, as makea (recorded as makea whoever does it): a name, "
|
|
201
|
+
"the step it comes after, where it goes (--placement inline, alongside with "
|
|
202
|
+
"--joins, or beside a side line's step), who does it and how it is done, with "
|
|
203
|
+
"an optional due date and note. A factory step goes to the factory of the step "
|
|
204
|
+
"it follows unless --supplier says."
|
|
205
|
+
),
|
|
206
|
+
)
|
|
207
|
+
def create_custom_step(
|
|
208
|
+
product_id: str = typer.Argument(..., help=_PRODUCT_HELP),
|
|
209
|
+
label: str = typer.Option(..., "--label", help="The step's name, e.g. Lab test report."),
|
|
210
|
+
after: str = typer.Option(..., "--after", help="Id of the step it comes after."),
|
|
211
|
+
who: str = typer.Option("SUPPLIER", "--who", help=_WHO_HELP),
|
|
212
|
+
done_when: str = typer.Option("check", "--done-when", help=_DONE_WHEN_HELP),
|
|
213
|
+
supplier: str | None = typer.Option(
|
|
214
|
+
None, "--supplier", help="With --who SUPPLIER: the factory, when not the step's own."
|
|
215
|
+
),
|
|
216
|
+
due_date: str | None = typer.Option(None, "--due-date", help="Due on YYYY-MM-DD."),
|
|
217
|
+
due_days: int | None = typer.Option(
|
|
218
|
+
None, "--due-days", help="Due this many days before --due-before.", min=0, max=365
|
|
219
|
+
),
|
|
220
|
+
due_before: str | None = typer.Option(None, "--due-before", help=_DUE_KEYS_HELP),
|
|
221
|
+
placement: str = typer.Option("inline", "--placement", help=_PLACEMENT_HELP),
|
|
222
|
+
joins: str | None = typer.Option(None, "--joins", help=_JOINS_HELP),
|
|
223
|
+
no_joins: bool = typer.Option(False, "--no-joins", help=_NO_JOINS_HELP),
|
|
224
|
+
hold: bool = typer.Option(False, "--hold", help=_HOLD_HELP),
|
|
225
|
+
note: str | None = typer.Option(None, "--note", help="For whoever does it."),
|
|
226
|
+
) -> None:
|
|
227
|
+
"""Add a step to an order."""
|
|
228
|
+
body = _step_body(
|
|
229
|
+
label=label,
|
|
230
|
+
after=after,
|
|
231
|
+
who=who,
|
|
232
|
+
supplier=supplier,
|
|
233
|
+
done_when=done_when,
|
|
234
|
+
due=_due(due_date, due_days, due_before, False),
|
|
235
|
+
hold=hold,
|
|
236
|
+
note=note,
|
|
237
|
+
placement=placement,
|
|
238
|
+
joins=joins,
|
|
239
|
+
no_joins=no_joins,
|
|
240
|
+
)
|
|
241
|
+
print_json_or_exit(console, lambda: api_client.admin_add_custom_step(product_id, body))
|
|
242
|
+
|
|
243
|
+
@command(
|
|
244
|
+
app,
|
|
245
|
+
"admin",
|
|
246
|
+
"update",
|
|
247
|
+
"custom-step",
|
|
248
|
+
api="PATCH /admin/products/{product_id}/order_flow/custom_steps/{step_id}",
|
|
249
|
+
side_effects=["the brand's and the factory's order pages show the change"],
|
|
250
|
+
approval="ask",
|
|
251
|
+
reversible=True,
|
|
252
|
+
help=(
|
|
253
|
+
"Change an added step that is not done or skipped: only the options given, "
|
|
254
|
+
"including where it goes (--after, --placement, --joins / --no-joins). Once "
|
|
255
|
+
"something was sent or uploaded on it, who does it and how it is done stay."
|
|
256
|
+
),
|
|
257
|
+
)
|
|
258
|
+
def update_custom_step(
|
|
259
|
+
product_id: str = typer.Argument(..., help=_PRODUCT_HELP),
|
|
260
|
+
step_id: str = typer.Argument(..., help=_STEP_HELP),
|
|
261
|
+
label: str | None = typer.Option(None, "--label"),
|
|
262
|
+
after: str | None = typer.Option(None, "--after", help="Move it after another step."),
|
|
263
|
+
who: str | None = typer.Option(None, "--who", help=_WHO_HELP),
|
|
264
|
+
done_when: str | None = typer.Option(None, "--done-when", help=_DONE_WHEN_HELP),
|
|
265
|
+
supplier: str | None = typer.Option(None, "--supplier"),
|
|
266
|
+
due_date: str | None = typer.Option(None, "--due-date", help="Due on YYYY-MM-DD."),
|
|
267
|
+
due_days: int | None = typer.Option(None, "--due-days", min=0, max=365),
|
|
268
|
+
due_before: str | None = typer.Option(None, "--due-before", help=_DUE_KEYS_HELP),
|
|
269
|
+
no_due: bool = typer.Option(False, "--no-due", help="Take the due date off."),
|
|
270
|
+
placement: str | None = typer.Option(None, "--placement", help=_PLACEMENT_HELP),
|
|
271
|
+
joins: str | None = typer.Option(None, "--joins", help=_JOINS_HELP),
|
|
272
|
+
no_joins: bool = typer.Option(False, "--no-joins", help=_NO_JOINS_HELP),
|
|
273
|
+
hold: bool | None = typer.Option(None, "--hold/--no-hold", help=_HOLD_HELP),
|
|
274
|
+
note: str | None = typer.Option(None, "--note"),
|
|
275
|
+
) -> None:
|
|
276
|
+
"""Change an added step."""
|
|
277
|
+
body = _step_body(
|
|
278
|
+
label=label,
|
|
279
|
+
after=after,
|
|
280
|
+
who=who,
|
|
281
|
+
supplier=supplier,
|
|
282
|
+
done_when=done_when,
|
|
283
|
+
due=_due(due_date, due_days, due_before, no_due),
|
|
284
|
+
hold=hold,
|
|
285
|
+
note=note,
|
|
286
|
+
placement=placement,
|
|
287
|
+
joins=joins,
|
|
288
|
+
no_joins=no_joins,
|
|
289
|
+
)
|
|
290
|
+
if not body:
|
|
291
|
+
raise typer.BadParameter("nothing to change")
|
|
292
|
+
print_json_or_exit(
|
|
293
|
+
console, lambda: api_client.admin_update_custom_step(product_id, step_id, body)
|
|
294
|
+
)
|
|
295
|
+
|
|
296
|
+
@command(
|
|
297
|
+
app,
|
|
298
|
+
"admin",
|
|
299
|
+
"delete",
|
|
300
|
+
"custom-step",
|
|
301
|
+
api="DELETE /admin/products/{product_id}/order_flow/custom_steps/{step_id}",
|
|
302
|
+
side_effects=["the step and its action card leave the order"],
|
|
303
|
+
approval="ask",
|
|
304
|
+
help=(
|
|
305
|
+
"Remove an added step as if it was never added: only while nothing was sent or "
|
|
306
|
+
"uploaded on it; the steps added after it follow the step it followed (a side "
|
|
307
|
+
"line's next step takes over its fork and join). Otherwise skip it (admin "
|
|
308
|
+
"submit custom-step --move skip), which also stops it holding a step."
|
|
309
|
+
),
|
|
310
|
+
)
|
|
311
|
+
def delete_custom_step(
|
|
312
|
+
product_id: str = typer.Argument(..., help=_PRODUCT_HELP),
|
|
313
|
+
step_id: str = typer.Argument(..., help=_STEP_HELP),
|
|
314
|
+
) -> None:
|
|
315
|
+
"""Remove an added step."""
|
|
316
|
+
print_json_or_exit(
|
|
317
|
+
console, lambda: api_client.admin_delete_custom_step(product_id, step_id)
|
|
318
|
+
)
|
|
319
|
+
|
|
320
|
+
@command(
|
|
321
|
+
app,
|
|
322
|
+
"admin",
|
|
323
|
+
"submit",
|
|
324
|
+
"custom-step",
|
|
325
|
+
api="POST /admin/products/{product_id}/order_flow/custom_steps/{step_id}/{move}",
|
|
326
|
+
side_effects=[
|
|
327
|
+
"the step moves on the brand's and the factory's order pages",
|
|
328
|
+
"the action card moves to whoever's turn it is next, or closes",
|
|
329
|
+
"--as supplier records the move as the step's factory",
|
|
330
|
+
],
|
|
331
|
+
approval="ask",
|
|
332
|
+
help=(
|
|
333
|
+
"Make an added step's move: done (tick off), upload (--file / --document), "
|
|
334
|
+
"submit (send a round: files and/or --note), approve or send-back (--comment "
|
|
335
|
+
"needed), skip (--reason). --as supplier makes done, upload or submit for the "
|
|
336
|
+
"step's own factory; makea may make every move."
|
|
337
|
+
),
|
|
338
|
+
)
|
|
339
|
+
def submit_custom_step(
|
|
340
|
+
product_id: str = typer.Argument(..., help=_PRODUCT_HELP),
|
|
341
|
+
step_id: str = typer.Argument(..., help=_STEP_HELP),
|
|
342
|
+
move: str = typer.Option(..., "--move", help=f"One of {', '.join(MOVES)}."),
|
|
343
|
+
as_who: str = typer.Option(
|
|
344
|
+
"makea", "--as", help="makea, or supplier (the step's factory)."
|
|
345
|
+
),
|
|
346
|
+
file: list[Path] | None = typer.Option(
|
|
347
|
+
None,
|
|
348
|
+
"--file",
|
|
349
|
+
"-f",
|
|
350
|
+
exists=True,
|
|
351
|
+
dir_okay=False,
|
|
352
|
+
readable=True,
|
|
353
|
+
help="Local file to upload with upload or submit; repeat.",
|
|
354
|
+
),
|
|
355
|
+
document: list[str] | None = typer.Option(
|
|
356
|
+
None, "--document", help="Document id already on the platform; repeat."
|
|
357
|
+
),
|
|
358
|
+
note: str | None = typer.Option(None, "--note", help="With upload or submit."),
|
|
359
|
+
comment: str | None = typer.Option(
|
|
360
|
+
None, "--comment", help="With approve or send-back: what to change."
|
|
361
|
+
),
|
|
362
|
+
reason: str | None = typer.Option(None, "--reason", help="With skip: why."),
|
|
363
|
+
) -> None:
|
|
364
|
+
"""Make an added step's move as makea or the factory."""
|
|
365
|
+
m = _choice(move, MOVES, "--move")
|
|
366
|
+
actor = (as_who or "").strip().lower()
|
|
367
|
+
if actor not in ("makea", "supplier"):
|
|
368
|
+
raise typer.BadParameter("--as must be makea or supplier")
|
|
369
|
+
if actor == "supplier" and m not in AS_SUPPLIER_MOVES:
|
|
370
|
+
raise typer.BadParameter(f"--as supplier makes {', '.join(AS_SUPPLIER_MOVES)} only")
|
|
371
|
+
if m == "send-back" and not (comment and comment.strip()):
|
|
372
|
+
raise typer.BadParameter("--comment says what to change")
|
|
373
|
+
|
|
374
|
+
def run() -> Any:
|
|
375
|
+
body: dict[str, Any] = {"as": actor}
|
|
376
|
+
if m in ("upload", "submit"):
|
|
377
|
+
files = _files(product_id, file, document)
|
|
378
|
+
if files:
|
|
379
|
+
body["files"] = files
|
|
380
|
+
for key, value in (("note", note), ("comment", comment), ("reason", reason)):
|
|
381
|
+
if value and value.strip():
|
|
382
|
+
body[key] = value.strip()
|
|
383
|
+
return api_client.admin_custom_step_move(
|
|
384
|
+
product_id, step_id, str(m).replace("-", "_"), body
|
|
385
|
+
)
|
|
386
|
+
|
|
387
|
+
print_json_or_exit(console, run)
|
|
388
|
+
|
|
389
|
+
_register_designer(app)
|
|
390
|
+
_register_supplier(app)
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
def _brand_files(
|
|
394
|
+
product_id: str, paths: list[Path] | None, document_ids: list[str] | None
|
|
395
|
+
) -> list[dict]:
|
|
396
|
+
"""Upload local files to the brand's product, and add documents already there."""
|
|
397
|
+
files: list[dict[str, Any]] = [{"document_id": d} for d in document_ids or []]
|
|
398
|
+
for p in paths or []:
|
|
399
|
+
res = api_client.designer_upload_document(product_id=product_id, file_path=p)
|
|
400
|
+
files.append({"document_id": _doc_id(res, p), "name": p.name})
|
|
401
|
+
return files
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
def _factory_files(
|
|
405
|
+
product_id: str, paths: list[Path] | None, document_ids: list[str] | None
|
|
406
|
+
) -> list[dict]:
|
|
407
|
+
files: list[dict[str, Any]] = [{"document_id": d} for d in document_ids or []]
|
|
408
|
+
for p in paths or []:
|
|
409
|
+
res = api_client.supplier_upload_document(p, product_id=product_id)
|
|
410
|
+
files.append({"document_id": _doc_id(res, p), "name": p.name})
|
|
411
|
+
return files
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
def _doc_id(res: Any, path: Path) -> str:
|
|
415
|
+
doc = (res or {}).get("result") or res or {}
|
|
416
|
+
for key in ("document", "data"):
|
|
417
|
+
if isinstance(doc.get(key), dict):
|
|
418
|
+
doc = doc[key]
|
|
419
|
+
doc_id = doc.get("document_id") or doc.get("id")
|
|
420
|
+
if not doc_id:
|
|
421
|
+
raise typer.BadParameter(f"upload of {path.name} returned no document id")
|
|
422
|
+
return str(doc_id)
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
_FILE_OPT = dict(exists=True, dir_okay=False, readable=True, help="Local file to upload; repeat.")
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
def _register_designer(app: typer.Typer) -> None:
|
|
429
|
+
@command(
|
|
430
|
+
app,
|
|
431
|
+
"designer",
|
|
432
|
+
"get",
|
|
433
|
+
"order-flow",
|
|
434
|
+
api="GET /designer/products/{product_id}/order_flow",
|
|
435
|
+
help=(
|
|
436
|
+
"Your order's steps: stages, every step with its state and whose move it is, "
|
|
437
|
+
"the moves between them (a line added alongside branches off with kind "
|
|
438
|
+
"'branch' and rejoins with 'join'), the key dates, and on each step "
|
|
439
|
+
"`waits_for`: the added steps it waits for."
|
|
440
|
+
),
|
|
441
|
+
)
|
|
442
|
+
def designer_get_order_flow(product_id: str = typer.Argument(..., help=_PRODUCT_HELP)) -> None:
|
|
443
|
+
"""Show your order's steps."""
|
|
444
|
+
print_json_or_exit(console, lambda: api_client.designer_get_order_flow(product_id))
|
|
445
|
+
|
|
446
|
+
@command(
|
|
447
|
+
app,
|
|
448
|
+
"designer",
|
|
449
|
+
"create",
|
|
450
|
+
"custom-step",
|
|
451
|
+
api="POST /designer/products/{product_id}/order_flow/custom_steps",
|
|
452
|
+
side_effects=[
|
|
453
|
+
"the step shows on your order page, and the factory's when it does it",
|
|
454
|
+
"whoever does it gets an action card once it opens",
|
|
455
|
+
"in line, the next step waits for it; alongside, the step it --joins does",
|
|
456
|
+
],
|
|
457
|
+
approval="ask",
|
|
458
|
+
help=(
|
|
459
|
+
"Add a step to your order: a name, the step it comes after, where it goes "
|
|
460
|
+
"(--placement inline, alongside with --joins, or beside a side line's step), "
|
|
461
|
+
"who does it (BRAND, SUPPLIER, MAKEA, 3PL) and how it is done."
|
|
462
|
+
),
|
|
463
|
+
)
|
|
464
|
+
def designer_create_custom_step(
|
|
465
|
+
product_id: str = typer.Argument(..., help=_PRODUCT_HELP),
|
|
466
|
+
label: str = typer.Option(..., "--label", help="The step's name."),
|
|
467
|
+
after: str = typer.Option(..., "--after", help="Id of the step it comes after."),
|
|
468
|
+
placement: str = typer.Option("alongside", "--placement", help=_PLACEMENT_HELP),
|
|
469
|
+
joins: str | None = typer.Option(None, "--joins", help=_JOINS_HELP),
|
|
470
|
+
no_joins: bool = typer.Option(False, "--no-joins", help=_NO_JOINS_HELP),
|
|
471
|
+
who: str = typer.Option("SUPPLIER", "--who", help="BRAND, SUPPLIER, MAKEA or 3PL."),
|
|
472
|
+
done_when: str = typer.Option("check", "--done-when", help="check, upload or send."),
|
|
473
|
+
due_date: str | None = typer.Option(None, "--due-date", help="Due on YYYY-MM-DD."),
|
|
474
|
+
due_days: int | None = typer.Option(None, "--due-days", min=0, max=365),
|
|
475
|
+
due_before: str | None = typer.Option(None, "--due-before", help=", ".join(DUE_KEYS)),
|
|
476
|
+
hold: bool = typer.Option(False, "--hold", help=_HOLD_HELP),
|
|
477
|
+
note: str | None = typer.Option(None, "--note", help="For whoever does it."),
|
|
478
|
+
) -> None:
|
|
479
|
+
"""Add a step to your order."""
|
|
480
|
+
body = _step_body(
|
|
481
|
+
label=label,
|
|
482
|
+
after=after,
|
|
483
|
+
who=who,
|
|
484
|
+
supplier=None,
|
|
485
|
+
done_when=done_when,
|
|
486
|
+
due=_due(due_date, due_days, due_before, False),
|
|
487
|
+
hold=hold,
|
|
488
|
+
note=note,
|
|
489
|
+
placement=placement,
|
|
490
|
+
joins=joins,
|
|
491
|
+
no_joins=no_joins,
|
|
492
|
+
)
|
|
493
|
+
print_json_or_exit(console, lambda: api_client.designer_add_custom_step(product_id, body))
|
|
494
|
+
|
|
495
|
+
@command(
|
|
496
|
+
app,
|
|
497
|
+
"designer",
|
|
498
|
+
"update",
|
|
499
|
+
"custom-step",
|
|
500
|
+
api="PATCH /designer/products/{product_id}/order_flow/custom_steps/{step_id}",
|
|
501
|
+
side_effects=["your order page and the factory's show the change"],
|
|
502
|
+
approval="ask",
|
|
503
|
+
reversible=True,
|
|
504
|
+
help="Change a step you added that is not done or skipped: only the options given.",
|
|
505
|
+
)
|
|
506
|
+
def designer_update_custom_step(
|
|
507
|
+
product_id: str = typer.Argument(..., help=_PRODUCT_HELP),
|
|
508
|
+
step_id: str = typer.Argument(..., help=_STEP_HELP),
|
|
509
|
+
label: str | None = typer.Option(None, "--label"),
|
|
510
|
+
after: str | None = typer.Option(None, "--after"),
|
|
511
|
+
placement: str | None = typer.Option(None, "--placement", help=_PLACEMENT_HELP),
|
|
512
|
+
joins: str | None = typer.Option(None, "--joins", help=_JOINS_HELP),
|
|
513
|
+
no_joins: bool = typer.Option(False, "--no-joins", help=_NO_JOINS_HELP),
|
|
514
|
+
who: str | None = typer.Option(None, "--who"),
|
|
515
|
+
done_when: str | None = typer.Option(None, "--done-when"),
|
|
516
|
+
due_date: str | None = typer.Option(None, "--due-date"),
|
|
517
|
+
due_days: int | None = typer.Option(None, "--due-days", min=0, max=365),
|
|
518
|
+
due_before: str | None = typer.Option(None, "--due-before"),
|
|
519
|
+
no_due: bool = typer.Option(False, "--no-due"),
|
|
520
|
+
hold: bool | None = typer.Option(None, "--hold/--no-hold", help=_HOLD_HELP),
|
|
521
|
+
note: str | None = typer.Option(None, "--note"),
|
|
522
|
+
) -> None:
|
|
523
|
+
"""Change a step you added."""
|
|
524
|
+
body = _step_body(
|
|
525
|
+
label=label,
|
|
526
|
+
after=after,
|
|
527
|
+
who=who,
|
|
528
|
+
supplier=None,
|
|
529
|
+
done_when=done_when,
|
|
530
|
+
due=_due(due_date, due_days, due_before, no_due),
|
|
531
|
+
hold=hold,
|
|
532
|
+
note=note,
|
|
533
|
+
placement=placement,
|
|
534
|
+
joins=joins,
|
|
535
|
+
no_joins=no_joins,
|
|
536
|
+
)
|
|
537
|
+
if not body:
|
|
538
|
+
raise typer.BadParameter("nothing to change")
|
|
539
|
+
print_json_or_exit(
|
|
540
|
+
console, lambda: api_client.designer_update_custom_step(product_id, step_id, body)
|
|
541
|
+
)
|
|
542
|
+
|
|
543
|
+
@command(
|
|
544
|
+
app,
|
|
545
|
+
"designer",
|
|
546
|
+
"delete",
|
|
547
|
+
"custom-step",
|
|
548
|
+
api="DELETE /designer/products/{product_id}/order_flow/custom_steps/{step_id}",
|
|
549
|
+
side_effects=["the step and its action card leave the order"],
|
|
550
|
+
approval="ask",
|
|
551
|
+
help=(
|
|
552
|
+
"Remove a step you added, only while nothing was sent or uploaded on it. "
|
|
553
|
+
"Otherwise skip it (designer submit custom-step --move skip)."
|
|
554
|
+
),
|
|
555
|
+
)
|
|
556
|
+
def designer_delete_custom_step(
|
|
557
|
+
product_id: str = typer.Argument(..., help=_PRODUCT_HELP),
|
|
558
|
+
step_id: str = typer.Argument(..., help=_STEP_HELP),
|
|
559
|
+
) -> None:
|
|
560
|
+
"""Remove a step you added."""
|
|
561
|
+
print_json_or_exit(
|
|
562
|
+
console, lambda: api_client.designer_delete_custom_step(product_id, step_id)
|
|
563
|
+
)
|
|
564
|
+
|
|
565
|
+
@command(
|
|
566
|
+
app,
|
|
567
|
+
"designer",
|
|
568
|
+
"submit",
|
|
569
|
+
"custom-step",
|
|
570
|
+
api="POST /designer/products/{product_id}/order_flow/custom_steps/{step_id}/{move}",
|
|
571
|
+
side_effects=["the step moves on your order page and the factory's"],
|
|
572
|
+
approval="ask",
|
|
573
|
+
help=(
|
|
574
|
+
"Make your move on an added step: done, upload (--file / --document), approve "
|
|
575
|
+
"or send-back a round the factory sent (--comment needed to send back), or "
|
|
576
|
+
"skip (--reason; it stops holding the step that waited for it)."
|
|
577
|
+
),
|
|
578
|
+
)
|
|
579
|
+
def designer_submit_custom_step(
|
|
580
|
+
product_id: str = typer.Argument(..., help=_PRODUCT_HELP),
|
|
581
|
+
step_id: str = typer.Argument(..., help=_STEP_HELP),
|
|
582
|
+
move: str = typer.Option(..., "--move", help=", ".join(BRAND_MOVES)),
|
|
583
|
+
file: list[Path] | None = typer.Option(None, "--file", "-f", **_FILE_OPT),
|
|
584
|
+
document: list[str] | None = typer.Option(None, "--document"),
|
|
585
|
+
comment: str | None = typer.Option(None, "--comment"),
|
|
586
|
+
reason: str | None = typer.Option(None, "--reason"),
|
|
587
|
+
) -> None:
|
|
588
|
+
"""Make your move on an added step."""
|
|
589
|
+
m = _choice(move, BRAND_MOVES, "--move")
|
|
590
|
+
if m == "send-back" and not (comment and comment.strip()):
|
|
591
|
+
raise typer.BadParameter("--comment says what to change")
|
|
592
|
+
|
|
593
|
+
def run() -> Any:
|
|
594
|
+
body: dict[str, Any] = {}
|
|
595
|
+
if m == "upload":
|
|
596
|
+
body["files"] = _brand_files(product_id, file, document)
|
|
597
|
+
for key, value in (("comment", comment), ("reason", reason)):
|
|
598
|
+
if value and value.strip():
|
|
599
|
+
body[key] = value.strip()
|
|
600
|
+
return api_client.designer_custom_step_move(
|
|
601
|
+
product_id, step_id, str(m).replace("-", "_"), body
|
|
602
|
+
)
|
|
603
|
+
|
|
604
|
+
print_json_or_exit(console, run)
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
def _register_supplier(app: typer.Typer) -> None:
|
|
608
|
+
@command(
|
|
609
|
+
app,
|
|
610
|
+
"supplier",
|
|
611
|
+
"get",
|
|
612
|
+
"order-flow",
|
|
613
|
+
api="GET /supplier/products/{product_id}/order_flow",
|
|
614
|
+
help=(
|
|
615
|
+
"Your read of an order: the request, one row per quote you sent, the sample "
|
|
616
|
+
"and bulk steps that are yours, the brand's steps you wait on, and the steps "
|
|
617
|
+
"the brand added for you. A step that `waits_for` added steps is on hold."
|
|
618
|
+
),
|
|
619
|
+
)
|
|
620
|
+
def supplier_get_order_flow(product_id: str = typer.Argument(..., help=_PRODUCT_HELP)) -> None:
|
|
621
|
+
"""Show your read of an order."""
|
|
622
|
+
print_json_or_exit(console, lambda: api_client.supplier_get_order_flow(product_id))
|
|
623
|
+
|
|
624
|
+
@command(
|
|
625
|
+
app,
|
|
626
|
+
"supplier",
|
|
627
|
+
"list",
|
|
628
|
+
"custom-step",
|
|
629
|
+
api="GET /supplier/products/{product_id}/custom_steps",
|
|
630
|
+
help="The steps the brand added that you do, with whose turn it is and what they hold.",
|
|
631
|
+
)
|
|
632
|
+
def supplier_list_custom_steps(
|
|
633
|
+
product_id: str = typer.Argument(..., help=_PRODUCT_HELP),
|
|
634
|
+
) -> None:
|
|
635
|
+
"""List the added steps you do."""
|
|
636
|
+
print_json_or_exit(console, lambda: api_client.supplier_list_custom_steps(product_id))
|
|
637
|
+
|
|
638
|
+
@command(
|
|
639
|
+
app,
|
|
640
|
+
"supplier",
|
|
641
|
+
"submit",
|
|
642
|
+
"custom-step",
|
|
643
|
+
api="POST /supplier/products/{product_id}/custom_steps/{step_id}/{move}",
|
|
644
|
+
side_effects=["the brand sees the step move; a sent round waits for its approval"],
|
|
645
|
+
approval="ask",
|
|
646
|
+
help=(
|
|
647
|
+
"Your move on a step the brand added: done (tick off), upload (--file / "
|
|
648
|
+
"--document), or submit a round for the brand to approve (files and/or --note). "
|
|
649
|
+
"Adding, changing or skipping steps is the brand's."
|
|
650
|
+
),
|
|
651
|
+
)
|
|
652
|
+
def supplier_submit_custom_step(
|
|
653
|
+
product_id: str = typer.Argument(..., help=_PRODUCT_HELP),
|
|
654
|
+
step_id: str = typer.Argument(..., help=_STEP_HELP),
|
|
655
|
+
move: str = typer.Option(..., "--move", help=", ".join(FACTORY_MOVES)),
|
|
656
|
+
file: list[Path] | None = typer.Option(None, "--file", "-f", **_FILE_OPT),
|
|
657
|
+
document: list[str] | None = typer.Option(None, "--document"),
|
|
658
|
+
note: str | None = typer.Option(None, "--note"),
|
|
659
|
+
) -> None:
|
|
660
|
+
"""Make your move on an added step."""
|
|
661
|
+
m = _choice(move, FACTORY_MOVES, "--move")
|
|
662
|
+
|
|
663
|
+
def run() -> Any:
|
|
664
|
+
body: dict[str, Any] = {}
|
|
665
|
+
if m in ("upload", "submit"):
|
|
666
|
+
files = _factory_files(product_id, file, document)
|
|
667
|
+
if files:
|
|
668
|
+
body["files"] = files
|
|
669
|
+
if note and note.strip():
|
|
670
|
+
body["note"] = note.strip()
|
|
671
|
+
return api_client.supplier_custom_step_move(product_id, step_id, str(m), body)
|
|
672
|
+
|
|
673
|
+
print_json_or_exit(console, run)
|
|
674
|
+
|
|
675
|
+
@command(
|
|
676
|
+
app,
|
|
677
|
+
"supplier",
|
|
678
|
+
"submit",
|
|
679
|
+
"sample-shipment",
|
|
680
|
+
api="POST /supplier/sampling_orders/{sampling_order_id}/ship",
|
|
681
|
+
side_effects=["the sample shows as sent and the brand gets the shipped email"],
|
|
682
|
+
approval="ask",
|
|
683
|
+
help="Send the sample: the courier and its tracking number (and link).",
|
|
684
|
+
)
|
|
685
|
+
def supplier_ship_sample(
|
|
686
|
+
sampling_order_id: str = typer.Argument(..., help="The sample order."),
|
|
687
|
+
carrier: str = typer.Option(..., "--carrier", help="Courier, e.g. DHL Express."),
|
|
688
|
+
tracking_number: str = typer.Option(..., "--tracking-number"),
|
|
689
|
+
tracking_url: str | None = typer.Option(None, "--tracking-url"),
|
|
690
|
+
) -> None:
|
|
691
|
+
"""Send the sample."""
|
|
692
|
+
body: dict[str, Any] = {"carrier": carrier, "tracking_number": tracking_number}
|
|
693
|
+
if tracking_url:
|
|
694
|
+
body["tracking_url"] = tracking_url
|
|
695
|
+
print_json_or_exit(
|
|
696
|
+
console, lambda: api_client.supplier_ship_sample(sampling_order_id, body)
|
|
697
|
+
)
|
|
698
|
+
|
|
699
|
+
@command(
|
|
700
|
+
app,
|
|
701
|
+
"supplier",
|
|
702
|
+
"submit",
|
|
703
|
+
"order-acceptance",
|
|
704
|
+
api="POST /supplier/production_orders/{production_order_id}/lead_time",
|
|
705
|
+
side_effects=[
|
|
706
|
+
"the order is accepted with the date bulk will be done",
|
|
707
|
+
"the production milestones are set up",
|
|
708
|
+
],
|
|
709
|
+
approval="ask",
|
|
710
|
+
help="Accept the order after the deposit: the date bulk production will be done.",
|
|
711
|
+
)
|
|
712
|
+
def supplier_accept_order(
|
|
713
|
+
production_order_id: str = typer.Argument(..., help="The production order."),
|
|
714
|
+
completion_date: str = typer.Option(..., "--completion-date", help="YYYY-MM-DD."),
|
|
715
|
+
note: str | None = typer.Option(None, "--note"),
|
|
716
|
+
) -> None:
|
|
717
|
+
"""Accept the order with its production date."""
|
|
718
|
+
body: dict[str, Any] = {"completion_date": completion_date}
|
|
719
|
+
if note:
|
|
720
|
+
body["note"] = note
|
|
721
|
+
print_json_or_exit(
|
|
722
|
+
console, lambda: api_client.supplier_confirm_production_date(production_order_id, body)
|
|
723
|
+
)
|
|
@@ -420,3 +420,218 @@ def register(app: typer.Typer) -> None:
|
|
|
420
420
|
print_json_or_exit(
|
|
421
421
|
console, lambda: api_client.admin_remove_shipping_order_fee(shipping_order_id, fee_id)
|
|
422
422
|
)
|
|
423
|
+
|
|
424
|
+
# ------------------------------------------------------------------ #
|
|
425
|
+
# Consignments: the lots a bulk shipment leaves the factory in
|
|
426
|
+
# ------------------------------------------------------------------ #
|
|
427
|
+
|
|
428
|
+
def _owner(shipping_order: str | None, production_order: str | None) -> dict[str, str]:
|
|
429
|
+
if bool(shipping_order) == bool(production_order):
|
|
430
|
+
raise typer.BadParameter("pass exactly one of --shipping-order / --production-order")
|
|
431
|
+
if shipping_order:
|
|
432
|
+
return {"shipping_order_id": shipping_order}
|
|
433
|
+
return {"production_order_id": production_order} # type: ignore[dict-item]
|
|
434
|
+
|
|
435
|
+
_SO_HELP = "Shipping order id the goods ride on."
|
|
436
|
+
_PO_HELP = (
|
|
437
|
+
"Production (or restock) order id. When its goods ride on a shipping order, "
|
|
438
|
+
"the lot goes there."
|
|
439
|
+
)
|
|
440
|
+
|
|
441
|
+
def _lot_body(
|
|
442
|
+
tracking: str | None,
|
|
443
|
+
carrier: str | None,
|
|
444
|
+
carrier_id: int | None,
|
|
445
|
+
tracking_url: str | None,
|
|
446
|
+
pieces: int | None,
|
|
447
|
+
cartons: int | None,
|
|
448
|
+
kg: float | None,
|
|
449
|
+
left: str | None,
|
|
450
|
+
contents: str | None,
|
|
451
|
+
orders: list[str] | None,
|
|
452
|
+
last: bool | None,
|
|
453
|
+
) -> dict[str, Any]:
|
|
454
|
+
body: dict[str, Any] = {}
|
|
455
|
+
for key, value in (
|
|
456
|
+
("tracking_number", tracking),
|
|
457
|
+
("carrier", carrier),
|
|
458
|
+
("carrier_id", carrier_id),
|
|
459
|
+
("tracking_url", tracking_url),
|
|
460
|
+
("pieces", pieces),
|
|
461
|
+
("cartons", cartons),
|
|
462
|
+
("gross_weight_kg", kg),
|
|
463
|
+
("shipped_at", left),
|
|
464
|
+
("contents", contents),
|
|
465
|
+
("is_last", last),
|
|
466
|
+
):
|
|
467
|
+
if value is not None:
|
|
468
|
+
body[key] = value
|
|
469
|
+
if orders:
|
|
470
|
+
body["production_order_ids"] = orders
|
|
471
|
+
return body
|
|
472
|
+
|
|
473
|
+
@command(
|
|
474
|
+
app,
|
|
475
|
+
"admin",
|
|
476
|
+
"list",
|
|
477
|
+
"consignments",
|
|
478
|
+
api="GET /admin/{shipping_orders|production_orders}/{id}/consignments",
|
|
479
|
+
help=(
|
|
480
|
+
"The lots a shipment left the factory in, each with its tracking number, plus "
|
|
481
|
+
"counts: pieces ordered, booked and still to ship, and how many lots landed."
|
|
482
|
+
),
|
|
483
|
+
)
|
|
484
|
+
def list_consignments(
|
|
485
|
+
shipping_order: str | None = typer.Option(None, "--shipping-order", help=_SO_HELP),
|
|
486
|
+
production_order: str | None = typer.Option(None, "--production-order", help=_PO_HELP),
|
|
487
|
+
) -> None:
|
|
488
|
+
"""List a shipment's consignments."""
|
|
489
|
+
owner = _owner(shipping_order, production_order)
|
|
490
|
+
print_json_or_exit(console, lambda: api_client.admin_list_consignments(**owner))
|
|
491
|
+
|
|
492
|
+
@command(
|
|
493
|
+
app,
|
|
494
|
+
"admin",
|
|
495
|
+
"create",
|
|
496
|
+
"consignment",
|
|
497
|
+
api="POST /admin/{shipping_orders|production_orders}/{id}/consignments",
|
|
498
|
+
side_effects=[
|
|
499
|
+
"the first lot marks the order shipped and emails the designer, as a tracking number did",
|
|
500
|
+
"a later lot posts an in-app note to the designer",
|
|
501
|
+
"the brand's Shipping tab lists the lot with its tracking",
|
|
502
|
+
],
|
|
503
|
+
approval="ask",
|
|
504
|
+
help=(
|
|
505
|
+
"Add one lot leaving the factory, with its own tracking number. The order is "
|
|
506
|
+
"delivered only when every lot has landed and one is marked last (or the pieces "
|
|
507
|
+
"reach the order). Without --last/--not-last, the lot that brings the pieces up "
|
|
508
|
+
"to the order is marked last."
|
|
509
|
+
),
|
|
510
|
+
)
|
|
511
|
+
def create_consignment(
|
|
512
|
+
tracking: str = typer.Option(..., "--tracking", help="The lot's tracking number."),
|
|
513
|
+
shipping_order: str | None = typer.Option(None, "--shipping-order", help=_SO_HELP),
|
|
514
|
+
production_order: str | None = typer.Option(None, "--production-order", help=_PO_HELP),
|
|
515
|
+
carrier: str | None = typer.Option(
|
|
516
|
+
None, "--carrier", help="Carrier name, e.g. DHL Express."
|
|
517
|
+
),
|
|
518
|
+
carrier_id: int | None = typer.Option(None, "--carrier-id", help="17track carrier code."),
|
|
519
|
+
tracking_url: str | None = typer.Option(None, "--tracking-url"),
|
|
520
|
+
pieces: int | None = typer.Option(None, "--pieces", help="Units in this lot."),
|
|
521
|
+
cartons: int | None = typer.Option(None, "--cartons"),
|
|
522
|
+
kg: float | None = typer.Option(None, "--kg", help="Gross weight in kg."),
|
|
523
|
+
left: str | None = typer.Option(
|
|
524
|
+
None, "--left", help="Date the lot left, YYYY-MM-DD (default today)."
|
|
525
|
+
),
|
|
526
|
+
contents: str | None = typer.Option(
|
|
527
|
+
None, "--contents", help='What the brand reads on the row, e.g. "Black, all sizes".'
|
|
528
|
+
),
|
|
529
|
+
orders: list[str] | None = typer.Option(
|
|
530
|
+
None,
|
|
531
|
+
"--order",
|
|
532
|
+
help="On a shipment carrying several orders: one that is in this lot; repeat.",
|
|
533
|
+
),
|
|
534
|
+
last: bool | None = typer.Option(
|
|
535
|
+
None, "--last/--not-last", help="Nothing else ships after this lot."
|
|
536
|
+
),
|
|
537
|
+
) -> None:
|
|
538
|
+
"""Add a consignment (one lot with its own tracking number)."""
|
|
539
|
+
owner = _owner(shipping_order, production_order)
|
|
540
|
+
body = _lot_body(
|
|
541
|
+
tracking,
|
|
542
|
+
carrier,
|
|
543
|
+
carrier_id,
|
|
544
|
+
tracking_url,
|
|
545
|
+
pieces,
|
|
546
|
+
cartons,
|
|
547
|
+
kg,
|
|
548
|
+
left,
|
|
549
|
+
contents,
|
|
550
|
+
orders,
|
|
551
|
+
last,
|
|
552
|
+
)
|
|
553
|
+
print_json_or_exit(console, lambda: api_client.admin_add_consignment(body, **owner))
|
|
554
|
+
|
|
555
|
+
@command(
|
|
556
|
+
app,
|
|
557
|
+
"admin",
|
|
558
|
+
"update",
|
|
559
|
+
"consignment",
|
|
560
|
+
api="PUT /admin/{shipping_orders|production_orders}/{id}/consignments/{consignment_id}",
|
|
561
|
+
side_effects=[
|
|
562
|
+
"--delivered runs the tracking sweep's delivered path for the lot (and the order when it was the last)",
|
|
563
|
+
"marking the last lot after the others landed delivers the order",
|
|
564
|
+
],
|
|
565
|
+
approval="ask",
|
|
566
|
+
help=(
|
|
567
|
+
"Edit one lot (ids c1, c2, ... from admin list consignments). --delivered marks it "
|
|
568
|
+
"delivered when the carrier page has no data: a partial lot tells the designer "
|
|
569
|
+
"in-app and on WhatsApp; the last one delivers the order with the usual emails."
|
|
570
|
+
),
|
|
571
|
+
)
|
|
572
|
+
def update_consignment(
|
|
573
|
+
consignment_id: str = typer.Argument(..., help="c1, c2, ..."),
|
|
574
|
+
shipping_order: str | None = typer.Option(None, "--shipping-order", help=_SO_HELP),
|
|
575
|
+
production_order: str | None = typer.Option(None, "--production-order", help=_PO_HELP),
|
|
576
|
+
tracking: str | None = typer.Option(None, "--tracking"),
|
|
577
|
+
carrier: str | None = typer.Option(None, "--carrier"),
|
|
578
|
+
carrier_id: int | None = typer.Option(None, "--carrier-id"),
|
|
579
|
+
tracking_url: str | None = typer.Option(None, "--tracking-url"),
|
|
580
|
+
pieces: int | None = typer.Option(None, "--pieces"),
|
|
581
|
+
cartons: int | None = typer.Option(None, "--cartons"),
|
|
582
|
+
kg: float | None = typer.Option(None, "--kg"),
|
|
583
|
+
left: str | None = typer.Option(None, "--left", help="YYYY-MM-DD"),
|
|
584
|
+
contents: str | None = typer.Option(None, "--contents"),
|
|
585
|
+
orders: list[str] | None = typer.Option(None, "--order"),
|
|
586
|
+
last: bool | None = typer.Option(None, "--last/--not-last"),
|
|
587
|
+
delivered: bool = typer.Option(False, "--delivered", help="Mark this lot delivered."),
|
|
588
|
+
silent: bool = typer.Option(
|
|
589
|
+
False, "--silent", help="With --delivered: change state only, tell nobody."
|
|
590
|
+
),
|
|
591
|
+
) -> None:
|
|
592
|
+
"""Edit a consignment, or mark it delivered."""
|
|
593
|
+
owner = _owner(shipping_order, production_order)
|
|
594
|
+
body = _lot_body(
|
|
595
|
+
tracking,
|
|
596
|
+
carrier,
|
|
597
|
+
carrier_id,
|
|
598
|
+
tracking_url,
|
|
599
|
+
pieces,
|
|
600
|
+
cartons,
|
|
601
|
+
kg,
|
|
602
|
+
left,
|
|
603
|
+
contents,
|
|
604
|
+
orders,
|
|
605
|
+
last,
|
|
606
|
+
)
|
|
607
|
+
if delivered:
|
|
608
|
+
body["status"] = "DELIVERED"
|
|
609
|
+
if silent:
|
|
610
|
+
body["notify"] = False
|
|
611
|
+
if not body:
|
|
612
|
+
raise typer.BadParameter("nothing to change")
|
|
613
|
+
print_json_or_exit(
|
|
614
|
+
console,
|
|
615
|
+
lambda: api_client.admin_update_consignment(consignment_id, body, **owner),
|
|
616
|
+
)
|
|
617
|
+
|
|
618
|
+
@command(
|
|
619
|
+
app,
|
|
620
|
+
"admin",
|
|
621
|
+
"delete",
|
|
622
|
+
"consignment",
|
|
623
|
+
api="DELETE /admin/{shipping_orders|production_orders}/{id}/consignments/{consignment_id}",
|
|
624
|
+
side_effects=["the lot and its tracking number leave the brand's Shipping tab"],
|
|
625
|
+
approval="ask",
|
|
626
|
+
help="Remove a lot entered by mistake. A delivered lot cannot be removed.",
|
|
627
|
+
)
|
|
628
|
+
def delete_consignment(
|
|
629
|
+
consignment_id: str = typer.Argument(..., help="c1, c2, ..."),
|
|
630
|
+
shipping_order: str | None = typer.Option(None, "--shipping-order", help=_SO_HELP),
|
|
631
|
+
production_order: str | None = typer.Option(None, "--production-order", help=_PO_HELP),
|
|
632
|
+
) -> None:
|
|
633
|
+
"""Remove a consignment."""
|
|
634
|
+
owner = _owner(shipping_order, production_order)
|
|
635
|
+
print_json_or_exit(
|
|
636
|
+
console, lambda: api_client.admin_delete_consignment(consignment_id, **owner)
|
|
637
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: makea-cli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.37
|
|
4
4
|
Summary: Makea admin CLI (browser login + Makea admin HTTP API)
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Requires-Dist: click<9,>=8.1
|
|
@@ -94,6 +94,8 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
|
|
|
94
94
|
| 命令 | 读/写 | 后端 | 说明 | 旧名 |
|
|
95
95
|
|---|---|---|---|---|
|
|
96
96
|
| `makea-cli admin backfill supplier-id` | write(never) | `POST /admin/supplier/backfill_supplier_id_with_quote_requests` | Migrate supplier_id from a wrong UUID to the Cognito user sub (user_id): profile + Cognito supplierReferenceId, optio… | `backfill-supplier-id` |
|
|
97
|
+
| `makea-cli admin create consignment` | write(ask) | `POST /admin/{production_orders\|shipping_orders}/{id}/consignments` | add one lot leaving the factory with its own tracking number, pieces, cartons, kg and ship date. The lot that brings the pieces up to the order is marked last unless `--last/--not-last` says. | — |
|
|
98
|
+
| `makea-cli admin create custom-step` | write(ask) | `POST /admin/products/{product_id}/order_flow/custom_steps` | add a step to one order as makea: `--label`, `--after` (a step id), `--placement inline\|alongside\|beside`, `--joins` / `--no-joins`, `--who`, `--done-when check\|upload\|send`, due (`--due-date` or `--due-days` + `--due-before`), `--hold` (checks in a production step), `--note`. | — |
|
|
97
99
|
| `makea-cli admin create feature-flag` | write(ask) | `POST /admin/feature-flags` | add a flag (off unless --enabled). An existing key is refused. | — |
|
|
98
100
|
| `makea-cli admin create library-element` | write(auto) | `POST /admin/designer/{user_id}/library_components` | save a reusable component under a designer. Provide --section and --values (see admin get library-schema). | `library-create` |
|
|
99
101
|
| `makea-cli admin create product-note` | write(ask) | `POST /admin/products/{product_id}/notes` | write a note on a product. Without --internal it goes to the brand. | — |
|
|
@@ -108,6 +110,8 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
|
|
|
108
110
|
| `makea-cli admin create supplier-link` | write(ask) | `POST /admin/product/link_supplier` | assign a factory to a product, with no price. A bare assignment is not a quote: no quote email goes out and nothing is priced. To quote, use admin submit quote on the quote request. | — |
|
|
109
111
|
| `makea-cli admin create user` | write(never) | `POST /admin/users/create` | register a user and confirm the Cognito account in one step (no verification email). Allowed --user-type values: "Fas… | `create-user` |
|
|
110
112
|
| `makea-cli admin delete about` | write(ask) | `DELETE /admin/about/{target}/{key}` | remove one About you line (`--user` / `--supplier`); it is not guessed again. --reason required. | — |
|
|
113
|
+
| `makea-cli admin delete consignment` | write(ask) | `DELETE /admin/{production_orders\|shipping_orders}/{id}/consignments/{consignment_id}` | remove a lot entered by mistake. A delivered lot cannot be removed. | — |
|
|
114
|
+
| `makea-cli admin delete custom-step` | write(ask) | `DELETE /admin/products/{product_id}/order_flow/custom_steps/{step_id}` | remove an added step while nothing was sent or uploaded on it; otherwise skip it. | — |
|
|
111
115
|
| `makea-cli admin delete ship-log` | write(ask) | `DELETE /admin/ship-log/deploys/{deploy_id}` | remove a Ship log entry recorded by mistake, with its recordings. | — |
|
|
112
116
|
| `makea-cli admin delete feature-flag` | write(ask) | `DELETE /admin/feature-flags/{key}` | remove a flag. Every check of it then reads false, so delete it only once the code that reads it is gone. | — |
|
|
113
117
|
| `makea-cli admin delete library-element` | write(never) | `DELETE /admin/designer/{user_id}/library_components/{component_id}` | remove a component from the designer's org library. | `library-delete` |
|
|
@@ -132,6 +136,7 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
|
|
|
132
136
|
| `makea-cli admin get playbook-preview` | read | `GET /admin/playbook/preview` | the playbook block one AI surface would get for a person or factory, and every rule left out with its reason; --product previews a conversation about one product, --rule answers for one rule. | — |
|
|
133
137
|
| `makea-cli admin get product-status` | read | `GET /admin/products/{product_id}/status` | where the product is: stage · step · owner for each supplier on it (the shared status model), plus the step catalog. | — |
|
|
134
138
|
| `makea-cli admin get product-step` | read | `GET /admin/products/{product_id}/suppliers/{supplier_id}/change_step` | the step one factory is at on a product and the steps admin update product-step can move it to (options; money steps are listed but never selectable). | — |
|
|
139
|
+
| `makea-cli admin get order-flow` | read | `GET /admin/products/{product_id}/order_flow` | an order's steps by stage: state, whose move it is, dates, key dates, factory names; added steps carry `custom`. | — |
|
|
135
140
|
| `makea-cli admin get production-order` | read | `GET /admin/production_orders/{production_order_id}/details` | one production (or restock) order in full: items, status, progress steps, tracking, notes, documents and linked suppliers. For only its pricing use admin get production-pricing. | — |
|
|
136
141
|
| `makea-cli admin get production-pricing` | read | `GET /admin/production_orders/{id}/details` | show a production order's price tiers, MOQ, sizes/colours, pricing groups and cart coverage. | `production-pricing-show` |
|
|
137
142
|
| `makea-cli admin get quote-request` | read | `GET /admin/quote_requests/{quote_request_id}` | one quote request in full. | — |
|
|
@@ -145,6 +150,7 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
|
|
|
145
150
|
| `makea-cli admin get top-clicks` | read | `POST /admin/analytics/query` | which buttons/elements get clicked most. | `analytics-top-clicks` |
|
|
146
151
|
| `makea-cli admin get top-features` | read | `POST /admin/analytics/query` | a quick map of which features get used most. | `analytics-top-features` |
|
|
147
152
|
| `makea-cli admin get user` | read | `GET /admin/user-profiles/{user_id}` | one account's profile (Cognito sub as id). | — |
|
|
153
|
+
| `makea-cli admin list consignments` | read | `GET /admin/{production_orders\|shipping_orders}/{id}/consignments` | the lots a shipment left the factory in, each with its tracking number, plus counts: pieces ordered, booked and still to ship, and how many lots landed. | — |
|
|
148
154
|
| `makea-cli admin list feature-flag` | read | `GET /admin/feature-flags` | every flag: global switch, default value, and the accounts it is on for (id, email, name). | — |
|
|
149
155
|
| `makea-cli admin list library-element` | read | `GET /admin/designer/{user_id}/library_components` | list a designer's tech-pack library (org-fanned). Optional --section scopes to one type. | `library-list` |
|
|
150
156
|
| `makea-cli admin list growth-snapshot` | read | `GET /admin/growth/snapshots` | published Growth Analysis snapshots, newest first (the change log). | — |
|
|
@@ -169,6 +175,7 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
|
|
|
169
175
|
| `makea-cli admin set production-variants` | write(ask) | `POST /admin/production_orders/{id}/details/update` | Set a production order's available sizes and colours (the grid the buyer's cart and every pricing group's cart keys a… | `production-variants-set` |
|
|
170
176
|
| `makea-cli admin set sampling-order-tracking` | write(ask) | `PUT /admin/sampling_orders/{sampling_order_id}/tracking` | the sample's parcel: tracking number, URL, shipping method, carrier. Only what you pass is changed; an empty string clears a field. | — |
|
|
171
177
|
| `makea-cli admin submit quote` | write(ask) | `POST /admin/quote_requests/{quote_request_id}/submit_quote` | admin submits a new quote (link) to a quote request. Pricing groups cannot be sent here (the submit endpoint ignores … | `submit-supplier-quote` |
|
|
178
|
+
| `makea-cli admin submit custom-step` | write(ask) | `POST /admin/products/{product_id}/order_flow/custom_steps/{step_id}/{move}` | make an added step's move (`--move done\|upload\|submit\|approve\|send-back\|skip`) as makea, or `--as supplier` for the step's factory (done, upload, submit); `--file` uploads under the brand. | — |
|
|
172
179
|
| `makea-cli admin update about` | write(ask) | `PATCH /admin/about/{target}/{key}` | add or reword one About you line (stands as the account's own words); `--restore` brings a removed one back. --reason required. | — |
|
|
173
180
|
| `makea-cli admin update about-pause` | write(ask) | `POST /admin/about/{target}/pause` | stop (or `--resume`) Beeboo using an account's About you. --reason required. | — |
|
|
174
181
|
| `makea-cli admin update feature-flag` | write(ask) | `PATCH /admin/feature-flags/{key}` | flip the global switch, edit the description or default value, or add / remove one account on the allow-list (by user id; find it with admin list user). | — |
|
|
@@ -184,6 +191,8 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
|
|
|
184
191
|
| `makea-cli admin update shipping-order` | write(ask) | `PUT /admin/shipping_orders/{shipping_order_id}/status` | Change a shipment: --status (PUT .../status), tracking flags (POST .../tracking), --address (PUT .../shipping-address… | — |
|
|
185
192
|
| `makea-cli admin update supplier` | write(ask) | `PUT /admin/supplier/update_supplier` | update an existing supplier from a JSON file (admin). Run `makea-cli get-supplier-profile-schema` FIRST to get the fi… | `update-supplier` |
|
|
186
193
|
| `makea-cli admin update task` | write(ask) | `POST /admin/tasks/{task_id}/{done\|dismiss\|note}` | close a Makea task with a note: `--done` once handled (a held lesson's `--reason` goes to Beeboo's next reading), `--dismiss`, or `--dismiss --wrong` when it should never have been raised; `--note` alone adds a note and leaves it open. | — |
|
|
194
|
+
| `makea-cli admin update consignment` | write(ask) | `PUT /admin/{production_orders\|shipping_orders}/{id}/consignments/{consignment_id}` | edit one lot; `--delivered` marks it delivered through the tracking sweep path (a middle lot tells the brand in-app and on WhatsApp, the last one delivers the order); `--silent` tells nobody. | — |
|
|
195
|
+
| `makea-cli admin update custom-step` | write(ask) | `PATCH /admin/products/{product_id}/order_flow/custom_steps/{step_id}` | change an added step that is not done or skipped; only the options given, including `--placement` and `--joins`. | — |
|
|
187
196
|
| `makea-cli admin update ship-log` | write(ask) | `PATCH /admin/ship-log/deploys/{deploy_id}` | fix a Ship log entry's title, summary or watch note; `--media` attaches more recordings. | — |
|
|
188
197
|
| `makea-cli admin update tech-spec` | write(ask) | `POST /admin/products/{id}/technical-specifications` | persist specs from a JSON file. | `save-product-tech-spec` |
|
|
189
198
|
| `makea-cli admin update tracking-status` | write(ask) | `POST /admin/tracking/carrier_status` | apply a carrier status looked up by hand (tracking-sweep skill) to one order: status, fan-out, delivered emails (--silent: state only). | — |
|
|
@@ -203,6 +212,7 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
|
|
|
203
212
|
|---|---|---|---|---|
|
|
204
213
|
| `makea-cli designer create checkout` | write(ask) | `POST /designer/payments/basket/create-session` | a Stripe checkout link for one or more charges. --key repeats: sampling:<sampling_order_id>, production:<production_o… | — |
|
|
205
214
|
| `makea-cli designer create collection` | write(auto) | `POST /designer/collections/create` | create or update a designer collection. | `designer-create-collection` |
|
|
215
|
+
| `makea-cli designer create custom-step` | write(ask) | `POST /designer/products/{product_id}/order_flow/custom_steps` | add a step to your order: `--after`, `--placement inline\|alongside\|beside` (default alongside), `--joins` / `--no-joins`, `--who`, `--done-when`, due, `--note`. | — |
|
|
206
216
|
| `makea-cli designer create library-element` | write(auto) | `POST /designer/library_components` | add a fabric, trim or other part to the brand's library; --document attaches a photo or data sheet, --draft when required fields are unknown. | — |
|
|
207
217
|
| `makea-cli designer create note` | write(ask) | `POST /designer/products/{product_id}/notes` | post a message into a product's conversation. | — |
|
|
208
218
|
| `makea-cli designer create pack-file` | write(auto) | `POST /designer/products/{product_id}/tech_spec/files` | put an uploaded file on a tech pack section; a pattern file (DXF, RUL, PLT) goes on Patterns when no section is named. | — |
|
|
@@ -245,6 +255,10 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
|
|
|
245
255
|
| `makea-cli designer update product` | write(auto) | `POST /designer/product/update_basic_info` | patch fields on a product. --cover-image / --back-image take a document id and are what the assistant's set_product_i… | — |
|
|
246
256
|
| `makea-cli designer update production-order` | write(ask) | `POST /designer/production_orders/{production_order_id}/complete` | POST /designer/production_orders/{id}/complete, or PUT the order to re-pick which supplier links it covers (--links-f… | — |
|
|
247
257
|
| `makea-cli designer create proposal` | write(auto) | `POST /designer/products/{product_id}/tech_spec/proposals` | propose a tech-pack change as a card on the field it changes; the user applies it. Name section/field as `get tech-pack --readable` shows them; --item / --entry pick a row, --was a line. | — |
|
|
258
|
+
| `makea-cli designer delete custom-step` | write(ask) | `DELETE /designer/products/{product_id}/order_flow/custom_steps/{step_id}` | remove a step you added while nothing was sent on it; the steps after it close up. | — |
|
|
259
|
+
| `makea-cli designer get order-flow` | read | `GET /designer/products/{product_id}/order_flow` | your order's steps, the branch/join moves of lines added alongside, and what each step `waits_for`. | — |
|
|
260
|
+
| `makea-cli designer submit custom-step` | write(ask) | `POST /designer/products/{product_id}/order_flow/custom_steps/{step_id}/{move}` | your move on an added step: done, upload, approve, send-back (`--comment`), skip (`--reason`). | — |
|
|
261
|
+
| `makea-cli designer update custom-step` | write(ask) | `PATCH /designer/products/{product_id}/order_flow/custom_steps/{step_id}` | change a step you added, including where it goes (`--after`, `--placement`, `--joins`). | — |
|
|
248
262
|
| `makea-cli designer update proposal` | write(ask) | `POST /designer/beeboo_proposals/approve` | apply one spec change the assistant proposed. This edits the pack, so read the proposal first. | — |
|
|
249
263
|
| `makea-cli designer update sampling-order` | write(never) | `POST /designer/sampling_orders/{sampling_order_id}/cancel` | cancel a sample order. Graded `never`: an agent must not do this on its own, a person runs it. | — |
|
|
250
264
|
| `makea-cli designer update shipping-order` | write(ask) | `POST /designer/shipping_orders/{shipping_order_id}/confirm_receive` | say the goods arrived. The backend accepts this only while the shipment is IN_TRANSIT. | — |
|
|
@@ -259,18 +273,23 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
|
|
|
259
273
|
| `makea-cli supplier create note` | write(ask) | `POST /supplier/products/{id}/channels/{key}/notes` | post a message into a product channel you are part of. | — |
|
|
260
274
|
| `makea-cli supplier download document` | read | `GET /supplier/document/download` | save a document you are allowed to read. | — |
|
|
261
275
|
| `makea-cli supplier get file` | read | local (makea_cli.file_reader) | read a pattern (DXF/RUL/PLT), artwork (AI/EPS/PSD/SVG), embroidery (PES/DST/EMB), ZIP or AVIF/TIFF file on this machine; saves PNG pictures of what it draws next to it. No API call. | — |
|
|
276
|
+
| `makea-cli supplier get order-flow` | read | `GET /supplier/products/{product_id}/order_flow` | your read of an order: request, one row per quote, your sample and bulk steps, holds (`waits_for`). | — |
|
|
262
277
|
| `makea-cli supplier get pack` | read | `GET /supplier/quote_requests/{id}/technical-specifications` | the tech pack for an RFQ, as the factory is allowed to see it (`--readable`: labels, values and blank essentials only). | — |
|
|
263
278
|
| `makea-cli supplier get pack-changes` | read | `GET /supplier/products/{product_id}/specification-change-history` | what changed in the pack since you quoted, field by field. | — |
|
|
264
279
|
| `makea-cli supplier get profile` | read | `GET /supplier/profile` | your own supplier profile. | — |
|
|
265
280
|
| `makea-cli supplier get rfq` | read | `GET /supplier/quote_requests` | one RFQ in full. | — |
|
|
266
281
|
| `makea-cli supplier list action` | read | `GET /supplier/actions` | what the platform is waiting on you for (pending actions). | — |
|
|
267
282
|
| `makea-cli supplier list channel` | read | `GET /supplier/products/{product_id}/channels` | the channels you are part of on a product. | — |
|
|
283
|
+
| `makea-cli supplier list custom-step` | read | `GET /supplier/products/{product_id}/custom_steps` | the steps the brand added that you do. | — |
|
|
268
284
|
| `makea-cli supplier list note` | read | `GET /supplier/products/{product_id}/channels/{channel_key}/notes` | the conversation in one channel. | — |
|
|
269
285
|
| `makea-cli supplier list production-order` | read | `GET /supplier/production_orders` | your production orders, optionally for one RFQ. | — |
|
|
270
286
|
| `makea-cli supplier list quote-edit-request` | read | `GET /supplier/quote_requests/{quote_request_id}/quote_edit_requests` | changes the brand has asked you to make to a quote you already sent. | — |
|
|
271
287
|
| `makea-cli supplier list rfq` | read | `GET /supplier/quote_requests` | the RFQs (quote requests) sent to you. | — |
|
|
272
288
|
| `makea-cli supplier list task` | read | `GET /supplier/tasks` | your onboarding and per-order to-dos. | — |
|
|
289
|
+
| `makea-cli supplier submit custom-step` | write(ask) | `POST /supplier/products/{product_id}/custom_steps/{step_id}/{move}` | your move on an added step: done, upload, or submit a round (`--file`, `--note`). Adding or changing steps is the brand's. | — |
|
|
290
|
+
| `makea-cli supplier submit order-acceptance` | write(ask) | `POST /supplier/production_orders/{production_order_id}/lead_time` | accept the order after the deposit with the date bulk will be done (`--completion-date`). | — |
|
|
273
291
|
| `makea-cli supplier submit quote` | write(ask) | `POST /supplier/quote_requests/{id}/submit_quote` | submit your quote for an RFQ. --file is the supplier link payload as JSON (same shape the web form posts); run with -… | — |
|
|
292
|
+
| `makea-cli supplier submit sample-shipment` | write(ask) | `POST /supplier/sampling_orders/{sampling_order_id}/ship` | send the sample: `--carrier`, `--tracking-number`, `--tracking-url`. | — |
|
|
274
293
|
| `makea-cli supplier update action` | write(auto) | `POST /supplier/actions/{action_id}/{acknowledge\|snooze}` | respond to a pending action. Acknowledging says you have seen it; the action still closes on the fact it asks for. | — |
|
|
275
294
|
| `makea-cli supplier update quote` | write(ask) | `POST /supplier/quote_requests/{quote_request_id}/links/{link_id}/edit` | revise a quote you already sent. --file is the same payload shape as submit; --dry-run first. | — |
|
|
276
295
|
| `makea-cli supplier update rfq` | write(ask) | `POST /supplier/quote_requests/{quote_request_id}/{status\|archive\|accept_terms}` | answer an RFQ. --status accepts or declines the invitation; --archive takes it off your board; --accept-terms accepts… | — |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
makea_cli/__init__.py,sha256=
|
|
1
|
+
makea_cli/__init__.py,sha256=5cBA1BOigyaIjTZkiKDnt-MqIStCt3LXAj1D5m_PUbg,23
|
|
2
2
|
makea_cli/__main__.py,sha256=AkQjxWfKE3w9iD1d6I-2Zqvv2t9cct0oYyFF0UiA-Z0,144
|
|
3
|
-
makea_cli/api_client.py,sha256=
|
|
3
|
+
makea_cli/api_client.py,sha256=5HmLZuY1ljqbSDd-BpGFyWLFZt2iCCYENAjBX11EwGU,90271
|
|
4
4
|
makea_cli/auth_pkce.py,sha256=iXSyJ7DM3qVuj-3FwPiqM25CxXz9ebFs9FNthZdw3ws,7315
|
|
5
5
|
makea_cli/broker.py,sha256=5O650nAdRuF-u9E1MuVM2jVv796iBdxJGIaJasxHij0,3019
|
|
6
6
|
makea_cli/companion.py,sha256=lEEMRDbS-5-CWPawlkPDeCij08pAYW8MsXLVSG3_8V0,10116
|
|
@@ -12,7 +12,7 @@ makea_cli/main.py,sha256=oU7cMXiZwCnT8gZS1vvuZYgtpDnyqTtb0dlkKIULZzo,9445
|
|
|
12
12
|
makea_cli/output.py,sha256=6xOJFjoIBphc10nz53xKCyQiz06an7oGtFJ0bap1G-Y,6739
|
|
13
13
|
makea_cli/posthog_client.py,sha256=k0cy9Hq7bhdLlPvC1ZW_esJ70xHDdQzPQUlx-GpVskk,1921
|
|
14
14
|
makea_cli/registry.py,sha256=GYJK_idhwIh1X2ictwFjn8PEMaXT56hFVkoLEVYrVqw,13722
|
|
15
|
-
makea_cli/commands/__init__.py,sha256=
|
|
15
|
+
makea_cli/commands/__init__.py,sha256=JezGFTj6bCClcpdWudh9rfzbrWxHomFwu7HeGhCk69w,2249
|
|
16
16
|
makea_cli/commands/_util.py,sha256=zSFwWaWpncARlKxgq4WuJlJvNv7XdZ39HfHrNOELHuw,980
|
|
17
17
|
makea_cli/commands/about/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
18
|
makea_cli/commands/about/cmd.py,sha256=smvn0WWfRfyL6h1ZB7vXSmJY67t7qhTHdRqxTk4jqeI,9665
|
|
@@ -40,6 +40,8 @@ makea_cli/commands/library/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
|
|
|
40
40
|
makea_cli/commands/library/cmd.py,sha256=eXZa6iLyPaoEWtRd-UmhRT6Ox-zlfs89gJqGn-IPuSU,11187
|
|
41
41
|
makea_cli/commands/metrics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
42
42
|
makea_cli/commands/metrics/cmd.py,sha256=gAYNztkhvdK8miP3ayDu0JgYzxLr42-ToeiXBCrAQeA,8656
|
|
43
|
+
makea_cli/commands/order_flow/__init__.py,sha256=SmD-TaDbNZLeu8q1nkPi2H6gJaKCrNAyW3Ejj6-UBog,79
|
|
44
|
+
makea_cli/commands/order_flow/cmd.py,sha256=3kUelbdFDDaxxLp0GMjtSG__CbV_aQQDhswxeJCR4aY,30960
|
|
43
45
|
makea_cli/commands/orders/__init__.py,sha256=6WKPqX02e0RRPmItPIBJ0TA4_yDI2PVvBDkAiMQu9rU,75
|
|
44
46
|
makea_cli/commands/orders/cmd.py,sha256=LgYPmC-eXEIvKhDYLKxo03DsJ2529-yKPKFPixnMBu0,23072
|
|
45
47
|
makea_cli/commands/playbook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -52,12 +54,12 @@ makea_cli/commands/production/pricing_spec.py,sha256=xGbj7-ps3PcKuU6Oc59A70b62Fj
|
|
|
52
54
|
makea_cli/commands/shiplog/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
53
55
|
makea_cli/commands/shiplog/cmd.py,sha256=XrqLdIJNxxwSTZQ1vqK2LJOrd18x7PEky78S2-lGe7o,10172
|
|
54
56
|
makea_cli/commands/shipping/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
55
|
-
makea_cli/commands/shipping/cmd.py,sha256=
|
|
57
|
+
makea_cli/commands/shipping/cmd.py,sha256=PI0kyaJJgYBcfkwKq9sKrQ9MXUH3VqvbsI3_6JG6Dmg,26290
|
|
56
58
|
makea_cli/commands/supplier/__init__.py,sha256=qfQDeQdQ-B7I_uwFVfcp1vXFUTL4fAcNLu3ipsZ7dfs,77
|
|
57
59
|
makea_cli/commands/supplier/cmd.py,sha256=12YzQIz8478ksOUbuI7pSwSAwQAqLTvXu-AKjyrwLgA,64039
|
|
58
60
|
makea_cli/commands/tasks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
59
61
|
makea_cli/commands/tasks/cmd.py,sha256=72MrVigmjjQCpDVF2a3aJn_gclw2iBbJdFmyd87mXec,8549
|
|
60
|
-
makea_cli-0.2.
|
|
61
|
-
makea_cli-0.2.
|
|
62
|
-
makea_cli-0.2.
|
|
63
|
-
makea_cli-0.2.
|
|
62
|
+
makea_cli-0.2.37.dist-info/METADATA,sha256=ls1R_knOZuxyOxXZnERi-rPst9gUhmTpxBg629G4z7Q,51096
|
|
63
|
+
makea_cli-0.2.37.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
64
|
+
makea_cli-0.2.37.dist-info/entry_points.txt,sha256=4x-lbVa1jBbNlkNq7L-rYyfRh2spZmc3BLIzP-Dl-Qk,50
|
|
65
|
+
makea_cli-0.2.37.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|