@newpeak/barista-cli 0.1.6 ā 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +714 -0
- package/README.ja.md +708 -0
- package/README.md +68 -0
- package/README.vi.md +714 -0
- package/dist/commands/liberica/calendar/index.d.ts +3 -0
- package/dist/commands/liberica/calendar/index.d.ts.map +1 -0
- package/dist/commands/liberica/calendar/index.js +11 -0
- package/dist/commands/liberica/calendar/index.js.map +1 -0
- package/dist/commands/liberica/calendar/list.d.ts +3 -0
- package/dist/commands/liberica/calendar/list.d.ts.map +1 -0
- package/dist/commands/liberica/calendar/list.js +181 -0
- package/dist/commands/liberica/calendar/list.js.map +1 -0
- package/dist/commands/liberica/calendar/set.d.ts +3 -0
- package/dist/commands/liberica/calendar/set.d.ts.map +1 -0
- package/dist/commands/liberica/calendar/set.js +120 -0
- package/dist/commands/liberica/calendar/set.js.map +1 -0
- package/dist/commands/liberica/client-contacts/create.d.ts +3 -0
- package/dist/commands/liberica/client-contacts/create.d.ts.map +1 -0
- package/dist/commands/liberica/client-contacts/create.js +132 -0
- package/dist/commands/liberica/client-contacts/create.js.map +1 -0
- package/dist/commands/liberica/client-contacts/delete.d.ts +3 -0
- package/dist/commands/liberica/client-contacts/delete.d.ts.map +1 -0
- package/dist/commands/liberica/client-contacts/delete.js +139 -0
- package/dist/commands/liberica/client-contacts/delete.js.map +1 -0
- package/dist/commands/liberica/client-contacts/get.d.ts +3 -0
- package/dist/commands/liberica/client-contacts/get.d.ts.map +1 -0
- package/dist/commands/liberica/client-contacts/get.js +92 -0
- package/dist/commands/liberica/client-contacts/get.js.map +1 -0
- package/dist/commands/liberica/client-contacts/index.d.ts +3 -0
- package/dist/commands/liberica/client-contacts/index.d.ts.map +1 -0
- package/dist/commands/liberica/client-contacts/index.js +17 -0
- package/dist/commands/liberica/client-contacts/index.js.map +1 -0
- package/dist/commands/liberica/client-contacts/list.d.ts +3 -0
- package/dist/commands/liberica/client-contacts/list.d.ts.map +1 -0
- package/dist/commands/liberica/client-contacts/list.js +92 -0
- package/dist/commands/liberica/client-contacts/list.js.map +1 -0
- package/dist/commands/liberica/client-contacts/update.d.ts +3 -0
- package/dist/commands/liberica/client-contacts/update.d.ts.map +1 -0
- package/dist/commands/liberica/client-contacts/update.js +156 -0
- package/dist/commands/liberica/client-contacts/update.js.map +1 -0
- package/dist/commands/liberica/dict-types/get.d.ts +3 -0
- package/dist/commands/liberica/dict-types/get.d.ts.map +1 -0
- package/dist/commands/liberica/dict-types/get.js +62 -0
- package/dist/commands/liberica/dict-types/get.js.map +1 -0
- package/dist/commands/liberica/dict-types/index.d.ts +3 -0
- package/dist/commands/liberica/dict-types/index.d.ts.map +1 -0
- package/dist/commands/liberica/dict-types/index.js +13 -0
- package/dist/commands/liberica/dict-types/index.js.map +1 -0
- package/dist/commands/liberica/dict-types/list.d.ts +3 -0
- package/dist/commands/liberica/dict-types/list.d.ts.map +1 -0
- package/dist/commands/liberica/dict-types/list.js +91 -0
- package/dist/commands/liberica/dict-types/list.js.map +1 -0
- package/dist/commands/liberica/dict-types/update.d.ts +3 -0
- package/dist/commands/liberica/dict-types/update.d.ts.map +1 -0
- package/dist/commands/liberica/dict-types/update.js +127 -0
- package/dist/commands/liberica/dict-types/update.js.map +1 -0
- package/dist/commands/liberica/dicts/create.d.ts +3 -0
- package/dist/commands/liberica/dicts/create.d.ts.map +1 -0
- package/dist/commands/liberica/dicts/create.js +157 -0
- package/dist/commands/liberica/dicts/create.js.map +1 -0
- package/dist/commands/liberica/dicts/delete.d.ts +3 -0
- package/dist/commands/liberica/dicts/delete.d.ts.map +1 -0
- package/dist/commands/liberica/dicts/delete.js +106 -0
- package/dist/commands/liberica/dicts/delete.js.map +1 -0
- package/dist/commands/liberica/dicts/get.d.ts +3 -0
- package/dist/commands/liberica/dicts/get.d.ts.map +1 -0
- package/dist/commands/liberica/dicts/get.js +69 -0
- package/dist/commands/liberica/dicts/get.js.map +1 -0
- package/dist/commands/liberica/dicts/index.d.ts +3 -0
- package/dist/commands/liberica/dicts/index.d.ts.map +1 -0
- package/dist/commands/liberica/dicts/index.js +17 -0
- package/dist/commands/liberica/dicts/index.js.map +1 -0
- package/dist/commands/liberica/dicts/list.d.ts +3 -0
- package/dist/commands/liberica/dicts/list.d.ts.map +1 -0
- package/dist/commands/liberica/dicts/list.js +88 -0
- package/dist/commands/liberica/dicts/list.js.map +1 -0
- package/dist/commands/liberica/dicts/update.d.ts +3 -0
- package/dist/commands/liberica/dicts/update.d.ts.map +1 -0
- package/dist/commands/liberica/dicts/update.js +112 -0
- package/dist/commands/liberica/dicts/update.js.map +1 -0
- package/dist/commands/liberica/index.d.ts.map +1 -1
- package/dist/commands/liberica/index.js +22 -0
- package/dist/commands/liberica/index.js.map +1 -1
- package/dist/commands/liberica/materials/create.d.ts.map +1 -1
- package/dist/commands/liberica/materials/create.js +35 -9
- package/dist/commands/liberica/materials/create.js.map +1 -1
- package/dist/commands/liberica/operations/active.d.ts +3 -0
- package/dist/commands/liberica/operations/active.d.ts.map +1 -0
- package/dist/commands/liberica/operations/active.js +152 -0
- package/dist/commands/liberica/operations/active.js.map +1 -0
- package/dist/commands/liberica/operations/batch-delete.d.ts +3 -0
- package/dist/commands/liberica/operations/batch-delete.d.ts.map +1 -0
- package/dist/commands/liberica/operations/batch-delete.js +130 -0
- package/dist/commands/liberica/operations/batch-delete.js.map +1 -0
- package/dist/commands/liberica/operations/copy.d.ts +3 -0
- package/dist/commands/liberica/operations/copy.d.ts.map +1 -0
- package/dist/commands/liberica/operations/copy.js +137 -0
- package/dist/commands/liberica/operations/copy.js.map +1 -0
- package/dist/commands/liberica/operations/create.d.ts +3 -0
- package/dist/commands/liberica/operations/create.d.ts.map +1 -0
- package/dist/commands/liberica/operations/create.js +212 -0
- package/dist/commands/liberica/operations/create.js.map +1 -0
- package/dist/commands/liberica/operations/deactive.d.ts +3 -0
- package/dist/commands/liberica/operations/deactive.d.ts.map +1 -0
- package/dist/commands/liberica/operations/deactive.js +152 -0
- package/dist/commands/liberica/operations/deactive.js.map +1 -0
- package/dist/commands/liberica/operations/delete.d.ts +3 -0
- package/dist/commands/liberica/operations/delete.d.ts.map +1 -0
- package/dist/commands/liberica/operations/delete.js +128 -0
- package/dist/commands/liberica/operations/delete.js.map +1 -0
- package/dist/commands/liberica/operations/get.d.ts +3 -0
- package/dist/commands/liberica/operations/get.d.ts.map +1 -0
- package/dist/commands/liberica/operations/get.js +93 -0
- package/dist/commands/liberica/operations/get.js.map +1 -0
- package/dist/commands/liberica/operations/index.d.ts +3 -0
- package/dist/commands/liberica/operations/index.d.ts.map +1 -0
- package/dist/commands/liberica/operations/index.js +25 -0
- package/dist/commands/liberica/operations/index.js.map +1 -0
- package/dist/commands/liberica/operations/list.d.ts +3 -0
- package/dist/commands/liberica/operations/list.d.ts.map +1 -0
- package/dist/commands/liberica/operations/list.js +141 -0
- package/dist/commands/liberica/operations/list.js.map +1 -0
- package/dist/commands/liberica/operations/update.d.ts +3 -0
- package/dist/commands/liberica/operations/update.d.ts.map +1 -0
- package/dist/commands/liberica/operations/update.js +208 -0
- package/dist/commands/liberica/operations/update.js.map +1 -0
- package/dist/commands/liberica/orgs/index.d.ts.map +1 -1
- package/dist/commands/liberica/orgs/index.js.map +1 -1
- package/dist/commands/liberica/stock/__tests__/ledger.test.d.ts +2 -0
- package/dist/commands/liberica/stock/__tests__/ledger.test.d.ts.map +1 -0
- package/dist/commands/liberica/stock/__tests__/ledger.test.js +41 -0
- package/dist/commands/liberica/stock/__tests__/ledger.test.js.map +1 -0
- package/dist/commands/liberica/stock/__tests__/list.test.d.ts +2 -0
- package/dist/commands/liberica/stock/__tests__/list.test.d.ts.map +1 -0
- package/dist/commands/liberica/stock/__tests__/list.test.js +39 -0
- package/dist/commands/liberica/stock/__tests__/list.test.js.map +1 -0
- package/dist/commands/liberica/stock/index.d.ts +3 -0
- package/dist/commands/liberica/stock/index.d.ts.map +1 -0
- package/dist/commands/liberica/stock/index.js +11 -0
- package/dist/commands/liberica/stock/index.js.map +1 -0
- package/dist/commands/liberica/stock/ledger.d.ts +3 -0
- package/dist/commands/liberica/stock/ledger.d.ts.map +1 -0
- package/dist/commands/liberica/stock/ledger.js +154 -0
- package/dist/commands/liberica/stock/ledger.js.map +1 -0
- package/dist/commands/liberica/stock/list.d.ts +3 -0
- package/dist/commands/liberica/stock/list.d.ts.map +1 -0
- package/dist/commands/liberica/stock/list.js +127 -0
- package/dist/commands/liberica/stock/list.js.map +1 -0
- package/dist/commands/liberica/supplier-contacts/create.d.ts +3 -0
- package/dist/commands/liberica/supplier-contacts/create.d.ts.map +1 -0
- package/dist/commands/liberica/supplier-contacts/create.js +129 -0
- package/dist/commands/liberica/supplier-contacts/create.js.map +1 -0
- package/dist/commands/liberica/supplier-contacts/delete.d.ts +3 -0
- package/dist/commands/liberica/supplier-contacts/delete.d.ts.map +1 -0
- package/dist/commands/liberica/supplier-contacts/delete.js +88 -0
- package/dist/commands/liberica/supplier-contacts/delete.js.map +1 -0
- package/dist/commands/liberica/supplier-contacts/get.d.ts +3 -0
- package/dist/commands/liberica/supplier-contacts/get.d.ts.map +1 -0
- package/dist/commands/liberica/supplier-contacts/get.js +84 -0
- package/dist/commands/liberica/supplier-contacts/get.js.map +1 -0
- package/dist/commands/liberica/supplier-contacts/index.d.ts +3 -0
- package/dist/commands/liberica/supplier-contacts/index.d.ts.map +1 -0
- package/dist/commands/liberica/supplier-contacts/index.js +17 -0
- package/dist/commands/liberica/supplier-contacts/index.js.map +1 -0
- package/dist/commands/liberica/supplier-contacts/list.d.ts +3 -0
- package/dist/commands/liberica/supplier-contacts/list.d.ts.map +1 -0
- package/dist/commands/liberica/supplier-contacts/list.js +98 -0
- package/dist/commands/liberica/supplier-contacts/list.js.map +1 -0
- package/dist/commands/liberica/supplier-contacts/update.d.ts +3 -0
- package/dist/commands/liberica/supplier-contacts/update.d.ts.map +1 -0
- package/dist/commands/liberica/supplier-contacts/update.js +136 -0
- package/dist/commands/liberica/supplier-contacts/update.js.map +1 -0
- package/dist/commands/liberica/users/create.d.ts.map +1 -1
- package/dist/commands/liberica/users/create.js +1 -0
- package/dist/commands/liberica/users/create.js.map +1 -1
- package/dist/commands/liberica/warehouses/create.d.ts +3 -0
- package/dist/commands/liberica/warehouses/create.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/create.js +196 -0
- package/dist/commands/liberica/warehouses/create.js.map +1 -0
- package/dist/commands/liberica/warehouses/delete.d.ts +3 -0
- package/dist/commands/liberica/warehouses/delete.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/delete.js +111 -0
- package/dist/commands/liberica/warehouses/delete.js.map +1 -0
- package/dist/commands/liberica/warehouses/disable.d.ts +3 -0
- package/dist/commands/liberica/warehouses/disable.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/disable.js +173 -0
- package/dist/commands/liberica/warehouses/disable.js.map +1 -0
- package/dist/commands/liberica/warehouses/enable.d.ts +3 -0
- package/dist/commands/liberica/warehouses/enable.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/enable.js +173 -0
- package/dist/commands/liberica/warehouses/enable.js.map +1 -0
- package/dist/commands/liberica/warehouses/get.d.ts +3 -0
- package/dist/commands/liberica/warehouses/get.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/get.js +90 -0
- package/dist/commands/liberica/warehouses/get.js.map +1 -0
- package/dist/commands/liberica/warehouses/index.d.ts +3 -0
- package/dist/commands/liberica/warehouses/index.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/index.js +23 -0
- package/dist/commands/liberica/warehouses/index.js.map +1 -0
- package/dist/commands/liberica/warehouses/list.d.ts +3 -0
- package/dist/commands/liberica/warehouses/list.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/list.js +101 -0
- package/dist/commands/liberica/warehouses/list.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/create.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/create.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/create.js +199 -0
- package/dist/commands/liberica/warehouses/locations/create.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/delete.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/delete.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/delete.js +115 -0
- package/dist/commands/liberica/warehouses/locations/delete.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/disable.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/disable.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/disable.js +173 -0
- package/dist/commands/liberica/warehouses/locations/disable.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/enable.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/enable.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/enable.js +173 -0
- package/dist/commands/liberica/warehouses/locations/enable.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/get.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/get.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/get.js +73 -0
- package/dist/commands/liberica/warehouses/locations/get.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/index.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/index.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/index.js +21 -0
- package/dist/commands/liberica/warehouses/locations/index.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/list.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/list.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/list.js +104 -0
- package/dist/commands/liberica/warehouses/locations/list.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/update.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/update.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/update.js +128 -0
- package/dist/commands/liberica/warehouses/locations/update.js.map +1 -0
- package/dist/commands/liberica/warehouses/update.d.ts +3 -0
- package/dist/commands/liberica/warehouses/update.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/update.js +143 -0
- package/dist/commands/liberica/warehouses/update.js.map +1 -0
- package/dist/core/api/client.d.ts +62 -0
- package/dist/core/api/client.d.ts.map +1 -1
- package/dist/core/api/client.js +1203 -104
- package/dist/core/api/client.js.map +1 -1
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/types/calendar.d.ts +28 -0
- package/dist/types/calendar.d.ts.map +1 -0
- package/dist/types/calendar.js +2 -0
- package/dist/types/calendar.js.map +1 -0
- package/dist/types/client-contact.d.ts +65 -0
- package/dist/types/client-contact.d.ts.map +1 -0
- package/dist/types/client-contact.js +4 -0
- package/dist/types/client-contact.js.map +1 -0
- package/dist/types/dict.d.ts +97 -0
- package/dist/types/dict.d.ts.map +1 -0
- package/dist/types/dict.js +2 -0
- package/dist/types/dict.js.map +1 -0
- package/dist/types/index.d.ts +9 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/location.d.ts +53 -0
- package/dist/types/location.d.ts.map +1 -0
- package/dist/types/location.js +2 -0
- package/dist/types/location.js.map +1 -0
- package/dist/types/operation.d.ts +66 -0
- package/dist/types/operation.d.ts.map +1 -0
- package/dist/types/operation.js +2 -0
- package/dist/types/operation.js.map +1 -0
- package/dist/types/stock.d.ts +133 -0
- package/dist/types/stock.d.ts.map +1 -0
- package/dist/types/stock.js +3 -0
- package/dist/types/stock.js.map +1 -0
- package/dist/types/supplier-contact.d.ts +65 -0
- package/dist/types/supplier-contact.d.ts.map +1 -0
- package/dist/types/supplier-contact.js +4 -0
- package/dist/types/supplier-contact.js.map +1 -0
- package/dist/types/warehouse.d.ts +68 -0
- package/dist/types/warehouse.d.ts.map +1 -0
- package/dist/types/warehouse.js +2 -0
- package/dist/types/warehouse.js.map +1 -0
- package/docs/commands/REFERENCE.md +24 -4
- package/docs/commands/liberica/calendar/DESIGN.md +333 -0
- package/docs/commands/liberica/client-contacts/create.md +152 -0
- package/docs/commands/liberica/client-contacts/delete.md +123 -0
- package/docs/commands/liberica/client-contacts/get.md +133 -0
- package/docs/commands/liberica/client-contacts/list.md +143 -0
- package/docs/commands/liberica/client-contacts/update.md +158 -0
- package/docs/commands/liberica/locations/create.md +195 -0
- package/docs/commands/liberica/locations/list.md +171 -0
- package/docs/commands/liberica/stock/ledger.md +209 -0
- package/docs/commands/liberica/stock/list.md +165 -0
- package/docs/commands/liberica/supplier-contacts/create.md +152 -0
- package/docs/commands/liberica/supplier-contacts/delete.md +123 -0
- package/docs/commands/liberica/supplier-contacts/get.md +133 -0
- package/docs/commands/liberica/supplier-contacts/list.md +143 -0
- package/docs/commands/liberica/supplier-contacts/update.md +158 -0
- package/docs/commands/liberica/warehouses/create.md +222 -0
- package/docs/commands/liberica/warehouses/list.md +184 -0
- package/package.json +1 -1
- package/src/commands/liberica/calendar/index.ts +13 -0
- package/src/commands/liberica/calendar/list.ts +214 -0
- package/src/commands/liberica/calendar/set.ts +130 -0
- package/src/commands/liberica/client-contacts/create.ts +115 -0
- package/src/commands/liberica/client-contacts/delete.ts +140 -0
- package/src/commands/liberica/client-contacts/get.ts +103 -0
- package/src/commands/liberica/client-contacts/index.ts +19 -0
- package/src/commands/liberica/client-contacts/list.ts +118 -0
- package/src/commands/liberica/client-contacts/update.ts +137 -0
- package/src/commands/liberica/dict-types/get.ts +74 -0
- package/src/commands/liberica/dict-types/index.ts +15 -0
- package/src/commands/liberica/dict-types/list.ts +118 -0
- package/src/commands/liberica/dict-types/update.ts +134 -0
- package/src/commands/liberica/dicts/create.ts +175 -0
- package/src/commands/liberica/dicts/delete.ts +107 -0
- package/src/commands/liberica/dicts/get.ts +80 -0
- package/src/commands/liberica/dicts/index.ts +19 -0
- package/src/commands/liberica/dicts/list.ts +114 -0
- package/src/commands/liberica/dicts/update.ts +116 -0
- package/src/commands/liberica/index.ts +22 -0
- package/src/commands/liberica/materials/create.ts +32 -9
- package/src/commands/liberica/operations/active.ts +153 -0
- package/src/commands/liberica/operations/batch-delete.ts +131 -0
- package/src/commands/liberica/operations/copy.ts +138 -0
- package/src/commands/liberica/operations/create.ts +223 -0
- package/src/commands/liberica/operations/deactive.ts +152 -0
- package/src/commands/liberica/operations/delete.ts +128 -0
- package/src/commands/liberica/operations/design.md +587 -0
- package/src/commands/liberica/operations/get.ts +112 -0
- package/src/commands/liberica/operations/index.ts +27 -0
- package/src/commands/liberica/operations/list.ts +180 -0
- package/src/commands/liberica/operations/update.ts +218 -0
- package/src/commands/liberica/orgs/index.ts +0 -1
- package/src/commands/liberica/stock/index.ts +13 -0
- package/src/commands/liberica/stock/ledger.ts +159 -0
- package/src/commands/liberica/stock/list.ts +128 -0
- package/src/commands/liberica/supplier-contacts/create.ts +120 -0
- package/src/commands/liberica/supplier-contacts/delete.ts +88 -0
- package/src/commands/liberica/supplier-contacts/get.ts +94 -0
- package/src/commands/liberica/supplier-contacts/index.ts +19 -0
- package/src/commands/liberica/supplier-contacts/list.ts +130 -0
- package/src/commands/liberica/supplier-contacts/update.ts +127 -0
- package/src/commands/liberica/users/create.ts +1 -0
- package/src/commands/liberica/warehouses/create.ts +204 -0
- package/src/commands/liberica/warehouses/delete.ts +112 -0
- package/src/commands/liberica/warehouses/disable.ts +174 -0
- package/src/commands/liberica/warehouses/enable.ts +174 -0
- package/src/commands/liberica/warehouses/get.ts +101 -0
- package/src/commands/liberica/warehouses/index.ts +25 -0
- package/src/commands/liberica/warehouses/list.ts +136 -0
- package/src/commands/liberica/warehouses/locations/create.ts +209 -0
- package/src/commands/liberica/warehouses/locations/delete.ts +116 -0
- package/src/commands/liberica/warehouses/locations/disable.ts +174 -0
- package/src/commands/liberica/warehouses/locations/enable.ts +174 -0
- package/src/commands/liberica/warehouses/locations/get.ts +84 -0
- package/src/commands/liberica/warehouses/locations/index.ts +23 -0
- package/src/commands/liberica/warehouses/locations/list.ts +140 -0
- package/src/commands/liberica/warehouses/locations/update.ts +135 -0
- package/src/commands/liberica/warehouses/update.ts +142 -0
- package/src/core/api/client.ts +1493 -78
- package/src/index.ts +1 -3
- package/src/types/calendar.ts +36 -0
- package/src/types/client-contact.ts +78 -0
- package/src/types/dict.ts +121 -0
- package/src/types/index.ts +9 -4
- package/src/types/location.ts +66 -0
- package/src/types/operation.ts +72 -0
- package/src/types/stock.ts +161 -0
- package/src/types/supplier-contact.ts +78 -0
- package/src/types/warehouse.ts +82 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import Table from 'cli-table3';
|
|
4
|
+
import { configManager } from '../../../core/config/manager.js';
|
|
5
|
+
import { apiClient } from '../../../core/api/client.js';
|
|
6
|
+
import { MasterStockQueryParams, MasterStockApiResponse } from '../../../types/stock.js';
|
|
7
|
+
import { Environment } from '../../../types/index.js';
|
|
8
|
+
|
|
9
|
+
export function createStockListCommand(): Command {
|
|
10
|
+
const listCommand = new Command('list');
|
|
11
|
+
listCommand.description('Query warehouse stock inventory (paginated)');
|
|
12
|
+
|
|
13
|
+
listCommand
|
|
14
|
+
.option('--warehouse-code <string>', 'Warehouse code')
|
|
15
|
+
.option('--material-code <string>', 'Material code')
|
|
16
|
+
.option('--material-no <string>', 'Material number')
|
|
17
|
+
.option('--material-name <string>', 'Material name')
|
|
18
|
+
.option('--material-type <string>', 'Material type/spec')
|
|
19
|
+
.option('--lot-no <string>', 'Lot/Batch number')
|
|
20
|
+
.option('--color <string>', 'Color')
|
|
21
|
+
.option('--long-x <number>', 'Length', parseFloat)
|
|
22
|
+
.option('--wide-y <number>', 'Width', parseFloat)
|
|
23
|
+
.option('--high-z <number>', 'Height', parseFloat)
|
|
24
|
+
.option('--source-type <string>', 'Source document type')
|
|
25
|
+
.option('--source-code <string>', 'Source document code')
|
|
26
|
+
.option('--stock-id <string>', 'Stock ID')
|
|
27
|
+
.option('--exclude-zero', 'Exclude zero stock items')
|
|
28
|
+
.option('--start-date <YYYY-MM-DD>', 'Stock date range start')
|
|
29
|
+
.option('--end-date <YYYY-MM-DD>', 'Stock date range end')
|
|
30
|
+
.option('-p, --page <number>', 'Page number (1-based)', '1')
|
|
31
|
+
.option('-s, --size <number>', 'Page size', '20')
|
|
32
|
+
.option('--json', 'Output as JSON')
|
|
33
|
+
.action(async (options) => {
|
|
34
|
+
const context = configManager.getCurrentContext();
|
|
35
|
+
const environment = (options.env as Environment) || context.environment;
|
|
36
|
+
const tenant = (options.tenant as string) || context.tenant;
|
|
37
|
+
|
|
38
|
+
if (!tenant) {
|
|
39
|
+
console.error(chalk.red('\nā No tenant configured. Run "barista liberica auth login" first.\n'));
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Convert 1-based CLI page to 0-based API page
|
|
44
|
+
const pageNo = parseInt(options.page as string, 10) - 1;
|
|
45
|
+
const pageSize = parseInt(options.size as string, 10);
|
|
46
|
+
|
|
47
|
+
const params: MasterStockQueryParams = {
|
|
48
|
+
pageNo,
|
|
49
|
+
pageSize,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
if (options.warehouseCode) params.warehouseCode = options.warehouseCode;
|
|
53
|
+
if (options.materialCode) params.materialCode = options.materialCode;
|
|
54
|
+
if (options.materialNo) params.materialNo = options.materialNo;
|
|
55
|
+
if (options.materialName) params.materialName = options.materialName;
|
|
56
|
+
if (options.materialType) params.materialType = options.materialType;
|
|
57
|
+
if (options.lotNo) params.lotNo = options.lotNo;
|
|
58
|
+
if (options.color) params.color = options.color;
|
|
59
|
+
if (options.longX !== undefined) params.longX = options.longX;
|
|
60
|
+
if (options.wideY !== undefined) params.wideY = options.wideY;
|
|
61
|
+
if (options.highZ !== undefined) params.highZ = options.highZ;
|
|
62
|
+
if (options.sourceType) params.sourceType = options.sourceType;
|
|
63
|
+
if (options.sourceCode) params.sourceCode = options.sourceCode;
|
|
64
|
+
if (options.stockId) params.stockId = options.stockId;
|
|
65
|
+
if (options.excludeZero) params.excludeZeroStock = true;
|
|
66
|
+
if (options.startDate) params.startDate = options.startDate;
|
|
67
|
+
if (options.endDate) params.endDate = options.endDate;
|
|
68
|
+
|
|
69
|
+
const response: MasterStockApiResponse = await apiClient.listStock(environment, tenant, params);
|
|
70
|
+
|
|
71
|
+
if (!response.success) {
|
|
72
|
+
console.error(chalk.red(`\nā Failed: ${response.error?.message}\n`));
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const data = response.data!;
|
|
77
|
+
const items = data.rows || [];
|
|
78
|
+
|
|
79
|
+
if (options.json) {
|
|
80
|
+
console.log(JSON.stringify({ success: true, data }, null, 2));
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (items.length === 0) {
|
|
85
|
+
console.log(chalk.yellow('\n No stock records found.\n'));
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const table = new Table({
|
|
90
|
+
head: [
|
|
91
|
+
chalk.bold('Warehouse'),
|
|
92
|
+
chalk.bold('Material'),
|
|
93
|
+
chalk.bold('Name'),
|
|
94
|
+
chalk.bold('Type'),
|
|
95
|
+
chalk.bold('Color'),
|
|
96
|
+
chalk.bold('Stock'),
|
|
97
|
+
chalk.bold('UOM'),
|
|
98
|
+
chalk.bold('Price'),
|
|
99
|
+
chalk.bold('Amount'),
|
|
100
|
+
],
|
|
101
|
+
colWidths: [12, 14, 20, 12, 8, 10, 6, 10, 12],
|
|
102
|
+
style: { border: [], head: [] },
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
for (const item of items) {
|
|
106
|
+
table.push([
|
|
107
|
+
item.warehouseCode || '-',
|
|
108
|
+
item.materialCode || '-',
|
|
109
|
+
item.materialName || '-',
|
|
110
|
+
item.materialType || '-',
|
|
111
|
+
item.color || '-',
|
|
112
|
+
item.stockCount?.toLocaleString() || '0',
|
|
113
|
+
item.materialUomCode || '-',
|
|
114
|
+
item.unitPrice != null ? `Ā„${item.unitPrice.toFixed(2)}` : '-',
|
|
115
|
+
item.stockAmount != null ? `Ā„${item.stockAmount.toLocaleString()}` : '-',
|
|
116
|
+
]);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
console.log(chalk.bold('\n Stock Inventory List\n'));
|
|
120
|
+
console.log(table.toString());
|
|
121
|
+
|
|
122
|
+
const totalPages = Math.ceil(data.totalRows / pageSize);
|
|
123
|
+
const currentPage = pageNo + 1;
|
|
124
|
+
console.log(chalk.gray(`\n Page ${currentPage} of ${totalPages} (Total: ${data.totalRows.toLocaleString()})\n`));
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
return listCommand;
|
|
128
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { configManager } from '../../../core/config/manager.js';
|
|
4
|
+
import { apiClient } from '../../../core/api/client.js';
|
|
5
|
+
import { CreateSupplierContactRequest } from '../../../types/supplier-contact.js';
|
|
6
|
+
|
|
7
|
+
export function createSupplierContactCreateCommand(): Command {
|
|
8
|
+
const cmd = new Command('create');
|
|
9
|
+
cmd.description('Create a new supplier contact');
|
|
10
|
+
|
|
11
|
+
cmd
|
|
12
|
+
.requiredOption('-s, --supplier-id <string>', 'Supplier ID')
|
|
13
|
+
.requiredOption('-n, --name <string>', 'Contact name')
|
|
14
|
+
.option('-p, --phone <string>', 'Phone number')
|
|
15
|
+
.option('-t, --telephone <string>', 'Telephone number')
|
|
16
|
+
.option('-e, --email <string>', 'Email address')
|
|
17
|
+
.option('-x, --sex <string>', 'Sex')
|
|
18
|
+
.option('-b, --birthday <string>', 'Birthday (YYYY-MM-DD)')
|
|
19
|
+
.option('-q, --qq <string>', 'QQ number')
|
|
20
|
+
.option('-w, --wechat <string>', 'WeChat ID')
|
|
21
|
+
.option('-a, --address <string>', 'Address')
|
|
22
|
+
.option('-d, --default', 'Set as default contact')
|
|
23
|
+
.option('-r, --remark <string>', 'Remark')
|
|
24
|
+
.option('--dry-run', 'Preview the operation without executing')
|
|
25
|
+
.option('--json', 'Output as JSON')
|
|
26
|
+
.action(async (options: Record<string, unknown>) => {
|
|
27
|
+
const context = configManager.getCurrentContext();
|
|
28
|
+
const environment = context.environment;
|
|
29
|
+
const tenant = context.tenant;
|
|
30
|
+
const jsonOutput = options.json === true;
|
|
31
|
+
|
|
32
|
+
const supplierId = options.supplierId as string;
|
|
33
|
+
const supplierContactName = options.name as string;
|
|
34
|
+
|
|
35
|
+
if (!supplierId || !supplierContactName) {
|
|
36
|
+
if (jsonOutput) {
|
|
37
|
+
console.log(JSON.stringify({ success: false, error: { code: 'VALIDATION_ERROR', message: 'supplier-id and name are required' } }));
|
|
38
|
+
} else {
|
|
39
|
+
console.error(chalk.red('\nā supplier-id and name are required\n'));
|
|
40
|
+
}
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const data: CreateSupplierContactRequest = {
|
|
45
|
+
supplierId,
|
|
46
|
+
supplierContactName,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
if (options.phone) data.supplierContactPhone = options.phone as string;
|
|
50
|
+
if (options.telephone) data.supplierContactTelephone = options.telephone as string;
|
|
51
|
+
if (options.email) data.supplierContactEmail = options.email as string;
|
|
52
|
+
if (options.sex) data.supplierContactSex = options.sex as string;
|
|
53
|
+
if (options.birthday) data.supplierContactBirthday = options.birthday as string;
|
|
54
|
+
if (options.qq) data.supplierContactQq = options.qq as string;
|
|
55
|
+
if (options.wechat) data.supplierContactWechat = options.wechat as string;
|
|
56
|
+
if (options.address) data.supplierContactAddress = options.address as string;
|
|
57
|
+
if (options.default) data.defaultFlag = 'Y';
|
|
58
|
+
else data.defaultFlag = 'N';
|
|
59
|
+
if (options.remark) data.remark = options.remark as string;
|
|
60
|
+
|
|
61
|
+
Object.keys(data).forEach(key => {
|
|
62
|
+
if (data[key as keyof CreateSupplierContactRequest] === undefined) {
|
|
63
|
+
delete data[key as keyof CreateSupplierContactRequest];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
if (options.dryRun) {
|
|
68
|
+
if (jsonOutput) {
|
|
69
|
+
console.log(JSON.stringify({ success: true, dryRun: true, data }));
|
|
70
|
+
} else {
|
|
71
|
+
console.log(chalk.cyan('\nš Dry-Run Mode: No actual API call will be made\n'));
|
|
72
|
+
console.log(chalk.gray(' This operation will create the following supplier contact:'));
|
|
73
|
+
console.log(` ${chalk.gray('Supplier ID:')} ${supplierId}`);
|
|
74
|
+
console.log(` ${chalk.gray('Name:')} ${supplierContactName}`);
|
|
75
|
+
if (options.phone) console.log(` ${chalk.gray('Phone:')} ${options.phone}`);
|
|
76
|
+
if (options.email) console.log(` ${chalk.gray('Email:')} ${options.email}`);
|
|
77
|
+
console.log();
|
|
78
|
+
}
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
try {
|
|
83
|
+
const response = await apiClient.createSupplierContact(environment, tenant, data);
|
|
84
|
+
|
|
85
|
+
if (response.success) {
|
|
86
|
+
if (jsonOutput) {
|
|
87
|
+
console.log(JSON.stringify({ success: true, data: response.data }));
|
|
88
|
+
} else {
|
|
89
|
+
console.log(chalk.green('\nā Supplier contact created successfully\n'));
|
|
90
|
+
console.log(` ${chalk.gray('Supplier ID:')} ${chalk.green(supplierId)}`);
|
|
91
|
+
console.log(` ${chalk.gray('Name:')} ${chalk.green(supplierContactName)}`);
|
|
92
|
+
console.log();
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
const errorMsg = response.error?.message || 'Failed to create supplier contact';
|
|
96
|
+
const errorCode = response.error?.code || 'CREATE_ERROR';
|
|
97
|
+
if (jsonOutput) {
|
|
98
|
+
console.log(JSON.stringify({ success: false, error: { code: errorCode, message: errorMsg } }));
|
|
99
|
+
} else {
|
|
100
|
+
console.error(chalk.red(`\nā Failed to create supplier contact: ${errorMsg}`));
|
|
101
|
+
if (response.error?.code) {
|
|
102
|
+
console.error(chalk.gray(` Error code: ${response.error.code}`));
|
|
103
|
+
}
|
|
104
|
+
console.error();
|
|
105
|
+
}
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
} catch (error) {
|
|
109
|
+
const errMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
110
|
+
if (jsonOutput) {
|
|
111
|
+
console.log(JSON.stringify({ success: false, error: { code: 'ERROR', message: errMsg } }));
|
|
112
|
+
} else {
|
|
113
|
+
console.error(chalk.red(`\nā Error: ${errMsg}\n`));
|
|
114
|
+
}
|
|
115
|
+
process.exit(1);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
return cmd;
|
|
120
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { configManager } from '../../../core/config/manager.js';
|
|
4
|
+
import { apiClient } from '../../../core/api/client.js';
|
|
5
|
+
|
|
6
|
+
export function createSupplierContactDeleteCommand(): Command {
|
|
7
|
+
const cmd = new Command('delete');
|
|
8
|
+
cmd.description('Delete a supplier contact (requires --force to actually delete)');
|
|
9
|
+
|
|
10
|
+
cmd
|
|
11
|
+
.arguments('<contact-id>')
|
|
12
|
+
.option('--force', 'Skip confirmation and actually delete')
|
|
13
|
+
.option('--dry-run', 'Preview the operation (default)')
|
|
14
|
+
.option('--json', 'Output as JSON')
|
|
15
|
+
.action(async (contactId: string, options: Record<string, unknown>) => {
|
|
16
|
+
const context = configManager.getCurrentContext();
|
|
17
|
+
const environment = context.environment;
|
|
18
|
+
const tenant = context.tenant;
|
|
19
|
+
const jsonOutput = options.json === true;
|
|
20
|
+
|
|
21
|
+
if (!contactId || contactId.trim() === '') {
|
|
22
|
+
if (jsonOutput) {
|
|
23
|
+
console.log(JSON.stringify({ success: false, error: { code: 'VALIDATION_ERROR', message: 'contact-id is required' } }));
|
|
24
|
+
} else {
|
|
25
|
+
console.error(chalk.red('\nā Contact ID is required\n'));
|
|
26
|
+
}
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const isDryRun = !options.force;
|
|
31
|
+
|
|
32
|
+
if (isDryRun) {
|
|
33
|
+
if (jsonOutput) {
|
|
34
|
+
console.log(JSON.stringify({
|
|
35
|
+
success: true,
|
|
36
|
+
dryRun: true,
|
|
37
|
+
message: 'Dry-Run Mode: No actual API call will be made',
|
|
38
|
+
data: { supplierContactId: contactId }
|
|
39
|
+
}));
|
|
40
|
+
} else {
|
|
41
|
+
console.log(chalk.cyan('\nš Dry-Run Mode: No actual API call will be made\n'));
|
|
42
|
+
console.log(chalk.gray(' This operation will delete the following supplier contact:'));
|
|
43
|
+
console.log(` ${chalk.gray('Contact ID:')} ${contactId}`);
|
|
44
|
+
console.log();
|
|
45
|
+
console.log(chalk.yellow(' ā ļø Add --force option to confirm deletion'));
|
|
46
|
+
console.log();
|
|
47
|
+
}
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
try {
|
|
52
|
+
const response = await apiClient.deleteSupplierContact(environment, tenant, contactId);
|
|
53
|
+
|
|
54
|
+
if (response.success) {
|
|
55
|
+
if (jsonOutput) {
|
|
56
|
+
console.log(JSON.stringify({ success: true, data: { supplierContactId: contactId } }));
|
|
57
|
+
} else {
|
|
58
|
+
console.log(chalk.green('\nā Supplier contact deleted successfully\n'));
|
|
59
|
+
console.log(` ${chalk.gray('Contact ID:')} ${chalk.green(contactId)}`);
|
|
60
|
+
console.log();
|
|
61
|
+
}
|
|
62
|
+
} else {
|
|
63
|
+
const errorMsg = response.error?.message || 'Failed to delete supplier contact';
|
|
64
|
+
const errorCode = response.error?.code || 'DELETE_ERROR';
|
|
65
|
+
if (jsonOutput) {
|
|
66
|
+
console.log(JSON.stringify({ success: false, error: { code: errorCode, message: errorMsg } }));
|
|
67
|
+
} else {
|
|
68
|
+
console.error(chalk.red(`\nā Failed to delete supplier contact: ${errorMsg}`));
|
|
69
|
+
if (response.error?.code) {
|
|
70
|
+
console.error(chalk.gray(` Error code: ${response.error.code}`));
|
|
71
|
+
}
|
|
72
|
+
console.error();
|
|
73
|
+
}
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
} catch (error) {
|
|
77
|
+
const errMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
78
|
+
if (jsonOutput) {
|
|
79
|
+
console.log(JSON.stringify({ success: false, error: { code: 'ERROR', message: errMsg } }));
|
|
80
|
+
} else {
|
|
81
|
+
console.error(chalk.red(`\nā Error: ${errMsg}\n`));
|
|
82
|
+
}
|
|
83
|
+
process.exit(1);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
return cmd;
|
|
88
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { configManager } from '../../../core/config/manager.js';
|
|
4
|
+
import { apiClient } from '../../../core/api/client.js';
|
|
5
|
+
import { SupplierContact } from '../../../types/supplier-contact.js';
|
|
6
|
+
import { Environment } from '../../../types/index.js';
|
|
7
|
+
|
|
8
|
+
export function createSupplierContactGetCommand(): Command {
|
|
9
|
+
const getCommand = new Command('get');
|
|
10
|
+
getCommand.description('Get supplier contact details by ID');
|
|
11
|
+
getCommand.arguments('<contact-id>');
|
|
12
|
+
getCommand.option('--json', 'Output as JSON');
|
|
13
|
+
|
|
14
|
+
getCommand.action(async (contactId: string, options: Record<string, unknown>) => {
|
|
15
|
+
const context = configManager.getCurrentContext();
|
|
16
|
+
const environment = (options.env as Environment) || context.environment;
|
|
17
|
+
const tenant = (options.tenant as string) || context.tenant;
|
|
18
|
+
|
|
19
|
+
if (!contactId || contactId.trim() === '') {
|
|
20
|
+
console.error(chalk.red('\nā Contact ID is required\n'));
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
const response = await apiClient.getSupplierContact(environment, tenant, contactId);
|
|
26
|
+
|
|
27
|
+
if (!response.success) {
|
|
28
|
+
const errorCode = response.error?.code || 'UNKNOWN_ERROR';
|
|
29
|
+
const errorMessage = response.error?.message || 'Unknown error';
|
|
30
|
+
|
|
31
|
+
if (errorCode === '01001XXX001' || errorMessage.includes('äøååØ')) {
|
|
32
|
+
console.error(chalk.red(`\nā Supplier contact not found: ${contactId}\n`));
|
|
33
|
+
} else {
|
|
34
|
+
console.error(chalk.red(`\nā Error: ${errorMessage} (${errorCode})\n`));
|
|
35
|
+
}
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const contact = response.data as SupplierContact | null;
|
|
40
|
+
|
|
41
|
+
if (!contact) {
|
|
42
|
+
console.error(chalk.red('\nā Supplier contact not found\n'));
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (options.json) {
|
|
47
|
+
console.log(JSON.stringify({
|
|
48
|
+
success: true,
|
|
49
|
+
data: contact,
|
|
50
|
+
}, null, 2));
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
console.log(chalk.bold('\nš¤ Supplier Contact Details\n'));
|
|
55
|
+
console.log(` ${chalk.gray('Contact ID:')} ${contact.supplierContactId}`);
|
|
56
|
+
console.log(` ${chalk.gray('Supplier ID:')} ${contact.supplierId}`);
|
|
57
|
+
console.log(` ${chalk.gray('Name:')} ${contact.supplierContactName || '-'}`);
|
|
58
|
+
if (contact.supplierContactPhone) {
|
|
59
|
+
console.log(` ${chalk.gray('Phone:')} ${contact.supplierContactPhone}`);
|
|
60
|
+
}
|
|
61
|
+
if (contact.supplierContactTelephone) {
|
|
62
|
+
console.log(` ${chalk.gray('Telephone:')} ${contact.supplierContactTelephone}`);
|
|
63
|
+
}
|
|
64
|
+
if (contact.supplierContactEmail) {
|
|
65
|
+
console.log(` ${chalk.gray('Email:')} ${contact.supplierContactEmail}`);
|
|
66
|
+
}
|
|
67
|
+
if (contact.supplierContactSex) {
|
|
68
|
+
console.log(` ${chalk.gray('Sex:')} ${contact.supplierContactSex}`);
|
|
69
|
+
}
|
|
70
|
+
if (contact.supplierContactBirthday) {
|
|
71
|
+
console.log(` ${chalk.gray('Birthday:')} ${contact.supplierContactBirthday}`);
|
|
72
|
+
}
|
|
73
|
+
if (contact.supplierContactQq) {
|
|
74
|
+
console.log(` ${chalk.gray('QQ:')} ${contact.supplierContactQq}`);
|
|
75
|
+
}
|
|
76
|
+
if (contact.supplierContactWechat) {
|
|
77
|
+
console.log(` ${chalk.gray('WeChat:')} ${contact.supplierContactWechat}`);
|
|
78
|
+
}
|
|
79
|
+
if (contact.supplierContactAddress) {
|
|
80
|
+
console.log(` ${chalk.gray('Address:')} ${contact.supplierContactAddress}`);
|
|
81
|
+
}
|
|
82
|
+
console.log(` ${chalk.gray('Default:')} ${contact.defaultFlag === 'Y' ? chalk.green('Yes') : 'No'}`);
|
|
83
|
+
if (contact.remark) {
|
|
84
|
+
console.log(` ${chalk.gray('Remark:')} ${contact.remark}`);
|
|
85
|
+
}
|
|
86
|
+
console.log();
|
|
87
|
+
} catch (error) {
|
|
88
|
+
console.error(chalk.red(`\nā Unexpected error: ${error instanceof Error ? error.message : 'Unknown error'}\n`));
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
return getCommand;
|
|
94
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { createSupplierContactListCommand } from './list.js';
|
|
3
|
+
import { createSupplierContactGetCommand } from './get.js';
|
|
4
|
+
import { createSupplierContactCreateCommand } from './create.js';
|
|
5
|
+
import { createSupplierContactUpdateCommand } from './update.js';
|
|
6
|
+
import { createSupplierContactDeleteCommand } from './delete.js';
|
|
7
|
+
|
|
8
|
+
export function createSupplierContactsCommand(): Command {
|
|
9
|
+
const supplierContactsCommand = new Command('supplier-contacts');
|
|
10
|
+
supplierContactsCommand.description('Manage supplier contacts');
|
|
11
|
+
|
|
12
|
+
supplierContactsCommand.addCommand(createSupplierContactListCommand());
|
|
13
|
+
supplierContactsCommand.addCommand(createSupplierContactGetCommand());
|
|
14
|
+
supplierContactsCommand.addCommand(createSupplierContactCreateCommand());
|
|
15
|
+
supplierContactsCommand.addCommand(createSupplierContactUpdateCommand());
|
|
16
|
+
supplierContactsCommand.addCommand(createSupplierContactDeleteCommand());
|
|
17
|
+
|
|
18
|
+
return supplierContactsCommand;
|
|
19
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import Table from 'cli-table3';
|
|
4
|
+
import { configManager } from '../../../core/config/manager.js';
|
|
5
|
+
import { apiClient } from '../../../core/api/client.js';
|
|
6
|
+
import { SupplierContactListResponse } from '../../../types/supplier-contact.js';
|
|
7
|
+
import { Environment } from '../../../types/index.js';
|
|
8
|
+
|
|
9
|
+
export function createSupplierContactListCommand(): Command {
|
|
10
|
+
const listCommand = new Command('list');
|
|
11
|
+
listCommand.description('List supplier contacts with pagination');
|
|
12
|
+
|
|
13
|
+
listCommand
|
|
14
|
+
.requiredOption('-s, --supplier-id <string>', 'Supplier ID')
|
|
15
|
+
.option('-p, --page <number>', 'Page number', '1')
|
|
16
|
+
.option('-z, --size <number>', 'Page size', '20')
|
|
17
|
+
.option('-S, --search <string>', 'Search keyword (contact name)')
|
|
18
|
+
.option('--json', 'Output as JSON')
|
|
19
|
+
.action(async (options) => {
|
|
20
|
+
const context = configManager.getCurrentContext();
|
|
21
|
+
const environment = (options.env as Environment) || context.environment;
|
|
22
|
+
const tenant = options.tenant || context.tenant;
|
|
23
|
+
|
|
24
|
+
const page = parseInt(options.page as string, 10) - 1;
|
|
25
|
+
const size = parseInt(options.size as string, 10);
|
|
26
|
+
|
|
27
|
+
const params: {
|
|
28
|
+
supplierId: string;
|
|
29
|
+
pageNo?: number;
|
|
30
|
+
pageSize?: number;
|
|
31
|
+
supplierContactName?: string;
|
|
32
|
+
} = { supplierId: options.supplierId };
|
|
33
|
+
|
|
34
|
+
if (page > 0) {
|
|
35
|
+
params.pageNo = page;
|
|
36
|
+
}
|
|
37
|
+
if (size > 0) {
|
|
38
|
+
params.pageSize = size;
|
|
39
|
+
}
|
|
40
|
+
if (options.search) {
|
|
41
|
+
params.supplierContactName = options.search as string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const response = await apiClient.listSupplierContacts(environment, tenant, params);
|
|
45
|
+
|
|
46
|
+
if (!response.success) {
|
|
47
|
+
console.error(chalk.red(`\nā Failed to list supplier contacts: ${response.error?.message || 'Unknown error'}`));
|
|
48
|
+
if (response.error?.code) {
|
|
49
|
+
console.error(chalk.gray(` Error code: ${response.error.code}`));
|
|
50
|
+
}
|
|
51
|
+
console.error();
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const data = response.data as SupplierContactListResponse | null;
|
|
56
|
+
|
|
57
|
+
if (!data) {
|
|
58
|
+
if (options.json) {
|
|
59
|
+
console.log(JSON.stringify({ success: true, data: { items: [], pagination: { pageNo: 0, pageSize: 20, totalRows: 0 } } }, null, 2));
|
|
60
|
+
} else {
|
|
61
|
+
console.log(chalk.bold('\nš Supplier Contact List\n'));
|
|
62
|
+
console.log(chalk.gray(' No supplier contacts found\n'));
|
|
63
|
+
}
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (options.json) {
|
|
68
|
+
console.log(
|
|
69
|
+
JSON.stringify(
|
|
70
|
+
{
|
|
71
|
+
success: true,
|
|
72
|
+
data: {
|
|
73
|
+
items: data.rows || [],
|
|
74
|
+
pagination: {
|
|
75
|
+
pageNo: data.pageNo,
|
|
76
|
+
pageSize: data.pageSize,
|
|
77
|
+
totalRows: data.totalRows,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
null,
|
|
82
|
+
2
|
|
83
|
+
)
|
|
84
|
+
);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const records = data.rows || [];
|
|
89
|
+
|
|
90
|
+
if (records.length === 0) {
|
|
91
|
+
console.log(chalk.bold('\nš Supplier Contact List\n'));
|
|
92
|
+
console.log(chalk.gray(' No supplier contacts found\n'));
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
console.log(chalk.bold('\nš Supplier Contact List\n'));
|
|
97
|
+
|
|
98
|
+
const table = new Table({
|
|
99
|
+
head: [chalk.bold('ID'), chalk.bold('NAME'), chalk.bold('PHONE'), chalk.bold('TELEPHONE'), chalk.bold('EMAIL'), chalk.bold('DEFAULT')],
|
|
100
|
+
colWidths: [10, 15, 15, 15, 25, 10],
|
|
101
|
+
style: {
|
|
102
|
+
head: [],
|
|
103
|
+
border: [],
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
for (const contact of records) {
|
|
108
|
+
const defaultText = contact.defaultFlag === 'Y' ? chalk.green('Y') : chalk.gray('N');
|
|
109
|
+
table.push([
|
|
110
|
+
contact.supplierContactId,
|
|
111
|
+
contact.supplierContactName || '-',
|
|
112
|
+
contact.supplierContactPhone || '-',
|
|
113
|
+
contact.supplierContactTelephone || '-',
|
|
114
|
+
contact.supplierContactEmail || '-',
|
|
115
|
+
defaultText,
|
|
116
|
+
]);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
console.log(table.toString());
|
|
120
|
+
console.log();
|
|
121
|
+
console.log(
|
|
122
|
+
chalk.gray(
|
|
123
|
+
` Total: ${data.totalRows} | Page: ${data.pageNo + 1} / ${Math.ceil(data.totalRows / data.pageSize) || 1} | Size: ${data.pageSize}`
|
|
124
|
+
)
|
|
125
|
+
);
|
|
126
|
+
console.log();
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
return listCommand;
|
|
130
|
+
}
|