@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,116 @@
|
|
|
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 { Environment } from '../../../../types/index.js';
|
|
6
|
+
import { WarehouseLocation } from '../../../../types/location.js';
|
|
7
|
+
|
|
8
|
+
export function createLocationDeleteCommand(): Command {
|
|
9
|
+
const deleteCommand = new Command('delete');
|
|
10
|
+
deleteCommand
|
|
11
|
+
.description('Delete a warehouse location')
|
|
12
|
+
.argument('<location-id>', 'Warehouse Location ID')
|
|
13
|
+
.option('--force', 'Skip confirmation and delete directly')
|
|
14
|
+
.option('--dry-run', 'Preview without making API call')
|
|
15
|
+
.option('--json', 'Output as JSON')
|
|
16
|
+
.action(async (locationId: string, options: Record<string, unknown>) => {
|
|
17
|
+
const context = configManager.getCurrentContext();
|
|
18
|
+
const environment = context.environment as Environment;
|
|
19
|
+
const tenant = context.tenant;
|
|
20
|
+
const dryRun = options.dryRun === true;
|
|
21
|
+
const jsonOutput = options.json === true;
|
|
22
|
+
|
|
23
|
+
if (!jsonOutput) {
|
|
24
|
+
console.log(chalk.bold(`\n🗑️ Delete Warehouse Location (${environment})\n`));
|
|
25
|
+
console.log(chalk.gray(` Location ID: ${locationId}`));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let location: WarehouseLocation | undefined;
|
|
29
|
+
try {
|
|
30
|
+
const locationResponse = await apiClient.getLocation(environment, tenant, locationId);
|
|
31
|
+
if (!locationResponse.success || !locationResponse.data || !('warehouseLocationId' in locationResponse.data)) {
|
|
32
|
+
const errMsg = `Warehouse location not found: ${locationId}`;
|
|
33
|
+
if (jsonOutput) {
|
|
34
|
+
console.log(JSON.stringify({ success: false, error: { code: 'NOT_FOUND', message: errMsg } }));
|
|
35
|
+
} else {
|
|
36
|
+
console.error(chalk.red(`\n✗ ${errMsg}\n`));
|
|
37
|
+
}
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
location = locationResponse.data as WarehouseLocation;
|
|
41
|
+
} catch (error) {
|
|
42
|
+
const errMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
43
|
+
if (jsonOutput) {
|
|
44
|
+
console.log(JSON.stringify({ success: false, error: { code: 'FETCH_ERROR', message: `Failed to fetch warehouse location: ${errMsg}` } }));
|
|
45
|
+
} else {
|
|
46
|
+
console.error(chalk.red(`\n✗ Failed to fetch warehouse location: ${errMsg}\n`));
|
|
47
|
+
}
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (!jsonOutput) {
|
|
52
|
+
console.log(chalk.gray(` Code: ${location.warehouseLocationCode}`));
|
|
53
|
+
console.log(chalk.gray(` Name: ${location.warehouseLocationName}`));
|
|
54
|
+
console.log(chalk.gray(` Warehouse ID: ${location.warehouseId}`));
|
|
55
|
+
if (location.warehouseLocationType) {
|
|
56
|
+
console.log(chalk.gray(` Type: ${location.warehouseLocationType}`));
|
|
57
|
+
}
|
|
58
|
+
if (location.capacity !== undefined && location.capacity !== null) {
|
|
59
|
+
console.log(chalk.gray(` Capacity: ${location.capacity}`));
|
|
60
|
+
}
|
|
61
|
+
console.log(chalk.gray(` Status: ${location.statusFlag === 1 ? 'Enable' : 'Disable'}`));
|
|
62
|
+
if (location.remark) {
|
|
63
|
+
console.log(chalk.gray(` Remark: ${location.remark}`));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (dryRun) {
|
|
68
|
+
if (jsonOutput) {
|
|
69
|
+
console.log(JSON.stringify({ success: true, dryRun: true, location }));
|
|
70
|
+
} else {
|
|
71
|
+
console.log(chalk.cyan('\n🔍 Dry-Run Mode: No actual deletion will be made\n'));
|
|
72
|
+
console.log(chalk.yellow(' To delete, add: --force\n'));
|
|
73
|
+
}
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (!options.force) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
try {
|
|
82
|
+
const response = await apiClient.deleteLocation(environment, tenant, locationId);
|
|
83
|
+
|
|
84
|
+
if (response.success) {
|
|
85
|
+
if (jsonOutput) {
|
|
86
|
+
console.log(JSON.stringify({ success: true, warehouseLocationId: locationId, name: location.warehouseLocationName }));
|
|
87
|
+
} else {
|
|
88
|
+
console.log(chalk.green(`\n✓ Warehouse Location "${location.warehouseLocationName}" (ID: ${locationId}) deleted\n`));
|
|
89
|
+
}
|
|
90
|
+
} else {
|
|
91
|
+
const errorMsg = response.error?.message || 'Unknown error';
|
|
92
|
+
const errorCode = response.error?.code || 'DELETE_ERROR';
|
|
93
|
+
if (jsonOutput) {
|
|
94
|
+
console.log(JSON.stringify({ success: false, error: { code: errorCode, message: errorMsg } }));
|
|
95
|
+
} else {
|
|
96
|
+
console.error(chalk.red(`\n✗ Failed to delete warehouse location: ${errorMsg}`));
|
|
97
|
+
if (response.error?.code) {
|
|
98
|
+
console.error(chalk.gray(` Error code: ${response.error.code}`));
|
|
99
|
+
}
|
|
100
|
+
console.error();
|
|
101
|
+
}
|
|
102
|
+
process.exit(1);
|
|
103
|
+
}
|
|
104
|
+
} catch (error) {
|
|
105
|
+
const errMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
106
|
+
if (jsonOutput) {
|
|
107
|
+
console.log(JSON.stringify({ success: false, error: { code: 'ERROR', message: errMsg } }));
|
|
108
|
+
} else {
|
|
109
|
+
console.error(chalk.red(`\n✗ Error: ${errMsg}\n`));
|
|
110
|
+
}
|
|
111
|
+
process.exit(1);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
return deleteCommand;
|
|
116
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import inquirer from 'inquirer';
|
|
4
|
+
import { configManager } from '../../../../core/config/manager.js';
|
|
5
|
+
import { apiClient } from '../../../../core/api/client.js';
|
|
6
|
+
import { Environment } from '../../../../types/index.js';
|
|
7
|
+
import { WarehouseLocation } from '../../../../types/location.js';
|
|
8
|
+
|
|
9
|
+
export function createLocationDisableCommand(): Command {
|
|
10
|
+
const disableCommand = new Command('disable');
|
|
11
|
+
disableCommand
|
|
12
|
+
.description('Disable (deactivate) a warehouse location')
|
|
13
|
+
.argument('[location-id]', 'Warehouse Location ID (mutually exclusive with --ids)')
|
|
14
|
+
.option('--ids <ids>', 'Comma-separated warehouse location IDs for batch operations')
|
|
15
|
+
.option('--force', 'Skip confirmation prompt')
|
|
16
|
+
.option('--dry-run', 'Preview the operation without executing')
|
|
17
|
+
.option('--json', 'Output as JSON')
|
|
18
|
+
.action(async (locationId: string | undefined, options: Record<string, unknown>) => {
|
|
19
|
+
const context = configManager.getCurrentContext();
|
|
20
|
+
const environment = context.environment as Environment;
|
|
21
|
+
const tenant = context.tenant;
|
|
22
|
+
const force = options.force === true;
|
|
23
|
+
const dryRun = options.dryRun === true;
|
|
24
|
+
const jsonOutput = options.json === true;
|
|
25
|
+
|
|
26
|
+
const batchIds = options.ids
|
|
27
|
+
? (options.ids as string).split(',').map((id) => id.trim()).filter((id) => id !== '')
|
|
28
|
+
: [];
|
|
29
|
+
|
|
30
|
+
if (!locationId && batchIds.length === 0) {
|
|
31
|
+
const errMsg = 'Invalid warehouse location ID. Provide <location-id> or use --ids for batch operations.';
|
|
32
|
+
if (jsonOutput) {
|
|
33
|
+
console.log(JSON.stringify({ success: false, error: { code: 'INVALID_ID', message: errMsg } }));
|
|
34
|
+
} else {
|
|
35
|
+
console.error(chalk.red(`\n✗ ${errMsg}\n`));
|
|
36
|
+
}
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const allIds = locationId ? [locationId] : batchIds;
|
|
41
|
+
|
|
42
|
+
if (!jsonOutput) {
|
|
43
|
+
console.log(chalk.bold(`\n⬇ Disable Warehouse Location (${environment})\n`));
|
|
44
|
+
if (batchIds.length > 0) {
|
|
45
|
+
console.log(chalk.gray(` Location IDs: ${batchIds.join(', ')}`));
|
|
46
|
+
} else {
|
|
47
|
+
console.log(chalk.gray(` Location ID: ${locationId}`));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (dryRun) {
|
|
52
|
+
if (jsonOutput) {
|
|
53
|
+
console.log(JSON.stringify({
|
|
54
|
+
success: true,
|
|
55
|
+
dryRun: true,
|
|
56
|
+
locationIds: allIds,
|
|
57
|
+
message: 'No actual API call will be made',
|
|
58
|
+
}));
|
|
59
|
+
} else {
|
|
60
|
+
console.log(chalk.cyan('\n🔍 Dry-Run Mode: No actual API call will be made\n'));
|
|
61
|
+
console.log(chalk.gray(` This operation will disable ${allIds.length} warehouse location(s).`));
|
|
62
|
+
console.log();
|
|
63
|
+
}
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const locations: WarehouseLocation[] = [];
|
|
68
|
+
for (const id of allIds) {
|
|
69
|
+
try {
|
|
70
|
+
const response = await apiClient.getLocation(environment, tenant, id);
|
|
71
|
+
if (!response.success || !response.data || !('warehouseLocationId' in response.data)) {
|
|
72
|
+
const errMsg = `Warehouse location not found: ${id}`;
|
|
73
|
+
if (jsonOutput) {
|
|
74
|
+
console.log(JSON.stringify({ success: false, error: { code: 'NOT_FOUND', message: errMsg } }));
|
|
75
|
+
} else {
|
|
76
|
+
console.error(chalk.red(`\n✗ ${errMsg}\n`));
|
|
77
|
+
}
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
locations.push(response.data as WarehouseLocation);
|
|
81
|
+
} catch (error) {
|
|
82
|
+
const errMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
83
|
+
const jsonErr = { success: false, error: { code: 'FETCH_ERROR', message: 'Failed to fetch warehouse location: ' + errMsg } };
|
|
84
|
+
if (jsonOutput) {
|
|
85
|
+
console.log(JSON.stringify(jsonErr));
|
|
86
|
+
} else {
|
|
87
|
+
console.error(chalk.red(`\n✗ Failed to fetch warehouse location: ${errMsg}\n`));
|
|
88
|
+
}
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const allAlreadyDisabled = locations.every((l) => l.statusFlag === 2);
|
|
94
|
+
if (allAlreadyDisabled) {
|
|
95
|
+
const names = locations.map((l) => `"${l.warehouseLocationName}"`).join(', ');
|
|
96
|
+
const errMsg = `Warehouse location(s) ${names} ${locations.length === 1 ? 'is' : 'are'} already disabled`;
|
|
97
|
+
if (jsonOutput) {
|
|
98
|
+
console.log(JSON.stringify({ success: false, error: { code: 'ALREADY_DISABLED', message: errMsg } }));
|
|
99
|
+
} else {
|
|
100
|
+
console.error(chalk.yellow(`\n⚠ ${errMsg}\n`));
|
|
101
|
+
}
|
|
102
|
+
process.exit(1);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (!force) {
|
|
106
|
+
if (!jsonOutput) {
|
|
107
|
+
if (locations.length === 1) {
|
|
108
|
+
console.log(chalk.gray(` Name: ${locations[0].warehouseLocationName}`));
|
|
109
|
+
console.log(chalk.gray(` Code: ${locations[0].warehouseLocationCode}`));
|
|
110
|
+
} else {
|
|
111
|
+
locations.forEach((l, i) => {
|
|
112
|
+
console.log(chalk.gray(` [${i + 1}] ${l.warehouseLocationName} (${l.warehouseLocationCode})`));
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const { confirm } = await inquirer.prompt([
|
|
118
|
+
{
|
|
119
|
+
type: 'confirm',
|
|
120
|
+
name: 'confirm',
|
|
121
|
+
message: locations.length === 1
|
|
122
|
+
? `Disable warehouse location "${locations[0].warehouseLocationName}"?`
|
|
123
|
+
: `Disable ${locations.length} warehouse locations?`,
|
|
124
|
+
default: false,
|
|
125
|
+
},
|
|
126
|
+
]);
|
|
127
|
+
|
|
128
|
+
if (!confirm) {
|
|
129
|
+
if (jsonOutput) {
|
|
130
|
+
console.log(JSON.stringify({ success: false, error: { code: 'CANCELLED', message: 'Operation cancelled' } }));
|
|
131
|
+
} else {
|
|
132
|
+
console.log(chalk.gray('\n Operation cancelled.\n'));
|
|
133
|
+
}
|
|
134
|
+
process.exit(0);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
try {
|
|
139
|
+
const response = await apiClient.batchDisableLocations(environment, tenant, allIds);
|
|
140
|
+
|
|
141
|
+
if (response.success) {
|
|
142
|
+
if (jsonOutput) {
|
|
143
|
+
console.log(JSON.stringify({ success: true, locationIds: allIds }));
|
|
144
|
+
} else {
|
|
145
|
+
const names = locations.map((l) => l.warehouseLocationName).join(', ');
|
|
146
|
+
console.log(chalk.green(`\n✓ Warehouse location(s) ${names || allIds.join(', ')} disabled\n`));
|
|
147
|
+
}
|
|
148
|
+
} else {
|
|
149
|
+
const errorMsg = response.error?.message || 'Unknown error';
|
|
150
|
+
const errorCode = response.error?.code || 'DISABLE_ERROR';
|
|
151
|
+
if (jsonOutput) {
|
|
152
|
+
console.log(JSON.stringify({ success: false, error: { code: errorCode, message: errorMsg } }));
|
|
153
|
+
} else {
|
|
154
|
+
console.error(chalk.red(`\n✗ Failed to disable warehouse location(s): ${errorMsg}`));
|
|
155
|
+
if (response.error?.code) {
|
|
156
|
+
console.error(chalk.gray(` Error code: ${response.error.code}`));
|
|
157
|
+
}
|
|
158
|
+
console.error();
|
|
159
|
+
}
|
|
160
|
+
process.exit(1);
|
|
161
|
+
}
|
|
162
|
+
} catch (error) {
|
|
163
|
+
const errMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
164
|
+
if (jsonOutput) {
|
|
165
|
+
console.log(JSON.stringify({ success: false, error: { code: 'ERROR', message: errMsg } }));
|
|
166
|
+
} else {
|
|
167
|
+
console.error(chalk.red(`\n✗ Error: ${errMsg}\n`));
|
|
168
|
+
}
|
|
169
|
+
process.exit(1);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
return disableCommand;
|
|
174
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import inquirer from 'inquirer';
|
|
4
|
+
import { configManager } from '../../../../core/config/manager.js';
|
|
5
|
+
import { apiClient } from '../../../../core/api/client.js';
|
|
6
|
+
import { Environment } from '../../../../types/index.js';
|
|
7
|
+
import { WarehouseLocation } from '../../../../types/location.js';
|
|
8
|
+
|
|
9
|
+
export function createLocationEnableCommand(): Command {
|
|
10
|
+
const enableCommand = new Command('enable');
|
|
11
|
+
enableCommand
|
|
12
|
+
.description('Enable (activate) a warehouse location')
|
|
13
|
+
.argument('[location-id]', 'Warehouse Location ID (mutually exclusive with --ids)')
|
|
14
|
+
.option('--ids <ids>', 'Comma-separated warehouse location IDs for batch operations')
|
|
15
|
+
.option('--force', 'Skip confirmation prompt')
|
|
16
|
+
.option('--dry-run', 'Preview the operation without executing')
|
|
17
|
+
.option('--json', 'Output as JSON')
|
|
18
|
+
.action(async (locationId: string | undefined, options: Record<string, unknown>) => {
|
|
19
|
+
const context = configManager.getCurrentContext();
|
|
20
|
+
const environment = context.environment as Environment;
|
|
21
|
+
const tenant = context.tenant;
|
|
22
|
+
const force = options.force === true;
|
|
23
|
+
const dryRun = options.dryRun === true;
|
|
24
|
+
const jsonOutput = options.json === true;
|
|
25
|
+
|
|
26
|
+
const batchIds = options.ids
|
|
27
|
+
? (options.ids as string).split(',').map((id) => id.trim()).filter((id) => id !== '')
|
|
28
|
+
: [];
|
|
29
|
+
|
|
30
|
+
if (!locationId && batchIds.length === 0) {
|
|
31
|
+
const errMsg = 'Invalid warehouse location ID. Provide <location-id> or use --ids for batch operations.';
|
|
32
|
+
if (jsonOutput) {
|
|
33
|
+
console.log(JSON.stringify({ success: false, error: { code: 'INVALID_ID', message: errMsg } }));
|
|
34
|
+
} else {
|
|
35
|
+
console.error(chalk.red(`\n✗ ${errMsg}\n`));
|
|
36
|
+
}
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const allIds = locationId ? [locationId] : batchIds;
|
|
41
|
+
|
|
42
|
+
if (!jsonOutput) {
|
|
43
|
+
console.log(chalk.bold(`\n↑ Enable Warehouse Location (${environment})\n`));
|
|
44
|
+
if (batchIds.length > 0) {
|
|
45
|
+
console.log(chalk.gray(` Location IDs: ${batchIds.join(', ')}`));
|
|
46
|
+
} else {
|
|
47
|
+
console.log(chalk.gray(` Location ID: ${locationId}`));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (dryRun) {
|
|
52
|
+
if (jsonOutput) {
|
|
53
|
+
console.log(JSON.stringify({
|
|
54
|
+
success: true,
|
|
55
|
+
dryRun: true,
|
|
56
|
+
locationIds: allIds,
|
|
57
|
+
message: 'No actual API call will be made',
|
|
58
|
+
}));
|
|
59
|
+
} else {
|
|
60
|
+
console.log(chalk.cyan('\n🔍 Dry-Run Mode: No actual API call will be made\n'));
|
|
61
|
+
console.log(chalk.gray(` This operation will enable ${allIds.length} warehouse location(s).`));
|
|
62
|
+
console.log();
|
|
63
|
+
}
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const locations: WarehouseLocation[] = [];
|
|
68
|
+
for (const id of allIds) {
|
|
69
|
+
try {
|
|
70
|
+
const response = await apiClient.getLocation(environment, tenant, id);
|
|
71
|
+
if (!response.success || !response.data || !('warehouseLocationId' in response.data)) {
|
|
72
|
+
const errMsg = `Warehouse location not found: ${id}`;
|
|
73
|
+
if (jsonOutput) {
|
|
74
|
+
console.log(JSON.stringify({ success: false, error: { code: 'NOT_FOUND', message: errMsg } }));
|
|
75
|
+
} else {
|
|
76
|
+
console.error(chalk.red(`\n✗ ${errMsg}\n`));
|
|
77
|
+
}
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
locations.push(response.data as WarehouseLocation);
|
|
81
|
+
} catch (error) {
|
|
82
|
+
const errMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
83
|
+
const jsonErr = { success: false, error: { code: 'FETCH_ERROR', message: 'Failed to fetch warehouse location: ' + errMsg } };
|
|
84
|
+
if (jsonOutput) {
|
|
85
|
+
console.log(JSON.stringify(jsonErr));
|
|
86
|
+
} else {
|
|
87
|
+
console.error(chalk.red(`\n✗ Failed to fetch warehouse location: ${errMsg}\n`));
|
|
88
|
+
}
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const allAlreadyEnabled = locations.every((l) => l.statusFlag === 1);
|
|
94
|
+
if (allAlreadyEnabled) {
|
|
95
|
+
const names = locations.map((l) => `"${l.warehouseLocationName}"`).join(', ');
|
|
96
|
+
const errMsg = `Warehouse location(s) ${names} ${locations.length === 1 ? 'is' : 'are'} already enabled`;
|
|
97
|
+
if (jsonOutput) {
|
|
98
|
+
console.log(JSON.stringify({ success: false, error: { code: 'ALREADY_ENABLED', message: errMsg } }));
|
|
99
|
+
} else {
|
|
100
|
+
console.error(chalk.yellow(`\n⚠ ${errMsg}\n`));
|
|
101
|
+
}
|
|
102
|
+
process.exit(1);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (!force) {
|
|
106
|
+
if (!jsonOutput) {
|
|
107
|
+
if (locations.length === 1) {
|
|
108
|
+
console.log(chalk.gray(` Name: ${locations[0].warehouseLocationName}`));
|
|
109
|
+
console.log(chalk.gray(` Code: ${locations[0].warehouseLocationCode}`));
|
|
110
|
+
} else {
|
|
111
|
+
locations.forEach((l, i) => {
|
|
112
|
+
console.log(chalk.gray(` [${i + 1}] ${l.warehouseLocationName} (${l.warehouseLocationCode})`));
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const { confirm } = await inquirer.prompt([
|
|
118
|
+
{
|
|
119
|
+
type: 'confirm',
|
|
120
|
+
name: 'confirm',
|
|
121
|
+
message: locations.length === 1
|
|
122
|
+
? `Enable warehouse location "${locations[0].warehouseLocationName}"?`
|
|
123
|
+
: `Enable ${locations.length} warehouse locations?`,
|
|
124
|
+
default: false,
|
|
125
|
+
},
|
|
126
|
+
]);
|
|
127
|
+
|
|
128
|
+
if (!confirm) {
|
|
129
|
+
if (jsonOutput) {
|
|
130
|
+
console.log(JSON.stringify({ success: false, error: { code: 'CANCELLED', message: 'Operation cancelled' } }));
|
|
131
|
+
} else {
|
|
132
|
+
console.log(chalk.gray('\n Operation cancelled.\n'));
|
|
133
|
+
}
|
|
134
|
+
process.exit(0);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
try {
|
|
139
|
+
const response = await apiClient.batchEnableLocations(environment, tenant, allIds);
|
|
140
|
+
|
|
141
|
+
if (response.success) {
|
|
142
|
+
if (jsonOutput) {
|
|
143
|
+
console.log(JSON.stringify({ success: true, locationIds: allIds }));
|
|
144
|
+
} else {
|
|
145
|
+
const names = locations.map((l) => l.warehouseLocationName).join(', ');
|
|
146
|
+
console.log(chalk.green(`\n✓ Warehouse location(s) ${names || allIds.join(', ')} enabled\n`));
|
|
147
|
+
}
|
|
148
|
+
} else {
|
|
149
|
+
const errorMsg = response.error?.message || 'Unknown error';
|
|
150
|
+
const errorCode = response.error?.code || 'ENABLE_ERROR';
|
|
151
|
+
if (jsonOutput) {
|
|
152
|
+
console.log(JSON.stringify({ success: false, error: { code: errorCode, message: errorMsg } }));
|
|
153
|
+
} else {
|
|
154
|
+
console.error(chalk.red(`\n✗ Failed to enable warehouse location(s): ${errorMsg}`));
|
|
155
|
+
if (response.error?.code) {
|
|
156
|
+
console.error(chalk.gray(` Error code: ${response.error.code}`));
|
|
157
|
+
}
|
|
158
|
+
console.error();
|
|
159
|
+
}
|
|
160
|
+
process.exit(1);
|
|
161
|
+
}
|
|
162
|
+
} catch (error) {
|
|
163
|
+
const errMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
164
|
+
if (jsonOutput) {
|
|
165
|
+
console.log(JSON.stringify({ success: false, error: { code: 'ERROR', message: errMsg } }));
|
|
166
|
+
} else {
|
|
167
|
+
console.error(chalk.red(`\n✗ Error: ${errMsg}\n`));
|
|
168
|
+
}
|
|
169
|
+
process.exit(1);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
return enableCommand;
|
|
174
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
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 { Environment } from '../../../../types/index.js';
|
|
6
|
+
import { WarehouseLocation } from '../../../../types/location.js';
|
|
7
|
+
|
|
8
|
+
export function createLocationGetCommand(): Command {
|
|
9
|
+
const getCommand = new Command('get');
|
|
10
|
+
getCommand.description('Get warehouse location details by ID');
|
|
11
|
+
getCommand.arguments('<location-id>');
|
|
12
|
+
getCommand.option('--json', 'Output as JSON');
|
|
13
|
+
|
|
14
|
+
getCommand.action(async (locationId: 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 (!locationId) {
|
|
20
|
+
console.error(chalk.red('\n✗ Location ID is required\n'));
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (!locationId || locationId.trim() === '') {
|
|
25
|
+
console.error(chalk.red('\n✗ Invalid location ID.\n'));
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
const response = await apiClient.getLocation(environment, tenant, locationId);
|
|
31
|
+
|
|
32
|
+
if (!response.success) {
|
|
33
|
+
const errorCode = response.error?.code || 'UNKNOWN_ERROR';
|
|
34
|
+
const errorMessage = response.error?.message || 'Unknown error';
|
|
35
|
+
|
|
36
|
+
// Handle "location not found" case
|
|
37
|
+
if (errorCode === '01001150001' || errorMessage.includes('不存在')) {
|
|
38
|
+
console.error(chalk.red(`\n✗ Location not found: ${locationId}\n`));
|
|
39
|
+
} else {
|
|
40
|
+
console.error(chalk.red(`\n✗ Error: ${errorMessage} (${errorCode})\n`));
|
|
41
|
+
}
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const location = response.data as WarehouseLocation | null;
|
|
46
|
+
|
|
47
|
+
if (!location) {
|
|
48
|
+
console.error(chalk.red('\n✗ Location not found\n'));
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (options.json) {
|
|
53
|
+
console.log(JSON.stringify({
|
|
54
|
+
success: true,
|
|
55
|
+
data: location,
|
|
56
|
+
}, null, 2));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Table output
|
|
61
|
+
console.log(chalk.bold('\n📍 Location Details\n'));
|
|
62
|
+
console.log(` ${chalk.gray('ID:')} ${location.warehouseLocationId}`);
|
|
63
|
+
console.log(` ${chalk.gray('Warehouse ID:')} ${location.warehouseId}`);
|
|
64
|
+
console.log(` ${chalk.gray('Code:')} ${location.warehouseLocationCode}`);
|
|
65
|
+
console.log(` ${chalk.gray('Name:')} ${location.warehouseLocationName}`);
|
|
66
|
+
if (location.warehouseLocationType) {
|
|
67
|
+
console.log(` ${chalk.gray('Type:')} ${location.warehouseLocationType}`);
|
|
68
|
+
}
|
|
69
|
+
if (location.capacity !== undefined && location.capacity !== null) {
|
|
70
|
+
console.log(` ${chalk.gray('Capacity:')} ${location.capacity}`);
|
|
71
|
+
}
|
|
72
|
+
console.log(` ${chalk.gray('Status:')} ${location.statusFlag === 1 ? 'Enable' : 'Disable'}`);
|
|
73
|
+
if (location.remark) {
|
|
74
|
+
console.log(` ${chalk.gray('Remark:')} ${location.remark}`);
|
|
75
|
+
}
|
|
76
|
+
console.log();
|
|
77
|
+
} catch (error) {
|
|
78
|
+
console.error(chalk.red(`\n✗ Unexpected error: ${error instanceof Error ? error.message : 'Unknown error'}\n`));
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
return getCommand;
|
|
84
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { createLocationCreateCommand } from './create.js';
|
|
3
|
+
import { createLocationGetCommand } from './get.js';
|
|
4
|
+
import { createLocationUpdateCommand } from './update.js';
|
|
5
|
+
import { createLocationEnableCommand } from './enable.js';
|
|
6
|
+
import { createLocationDisableCommand } from './disable.js';
|
|
7
|
+
import { createLocationDeleteCommand } from './delete.js';
|
|
8
|
+
import { createLocationListCommand } from './list.js';
|
|
9
|
+
|
|
10
|
+
export function createLocationsCommand(): Command {
|
|
11
|
+
const locationsCommand = new Command('locations');
|
|
12
|
+
locationsCommand.description('Manage warehouse locations');
|
|
13
|
+
|
|
14
|
+
locationsCommand.addCommand(createLocationCreateCommand());
|
|
15
|
+
locationsCommand.addCommand(createLocationListCommand());
|
|
16
|
+
locationsCommand.addCommand(createLocationGetCommand());
|
|
17
|
+
locationsCommand.addCommand(createLocationUpdateCommand());
|
|
18
|
+
locationsCommand.addCommand(createLocationEnableCommand());
|
|
19
|
+
locationsCommand.addCommand(createLocationDisableCommand());
|
|
20
|
+
locationsCommand.addCommand(createLocationDeleteCommand());
|
|
21
|
+
|
|
22
|
+
return locationsCommand;
|
|
23
|
+
}
|