@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,103 @@
|
|
|
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 { ClientContact } from '../../../types/client-contact.js';
|
|
7
|
+
|
|
8
|
+
export function createClientContactGetCommand(): Command {
|
|
9
|
+
const getCommand = new Command('get');
|
|
10
|
+
getCommand.description('Get client contact details by ID');
|
|
11
|
+
getCommand.arguments('<contact-id>');
|
|
12
|
+
getCommand.option('--json', 'Output as JSON');
|
|
13
|
+
|
|
14
|
+
getCommand.action(async (id: 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 (!id) {
|
|
20
|
+
console.error(chalk.red('\n✗ Client contact ID is required\n'));
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const clientContactId = id;
|
|
25
|
+
if (!clientContactId || clientContactId.trim() === '') {
|
|
26
|
+
console.error(chalk.red('\n✗ Invalid client contact ID.\n'));
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
const response = await apiClient.getClientContact(environment, tenant, clientContactId);
|
|
32
|
+
|
|
33
|
+
if (!response.success) {
|
|
34
|
+
const errorCode = response.error?.code || 'UNKNOWN_ERROR';
|
|
35
|
+
const errorMessage = response.error?.message || 'Unknown error';
|
|
36
|
+
|
|
37
|
+
if (errorCode === '01001207001' || errorMessage.includes('不存在')) {
|
|
38
|
+
console.error(chalk.red(`\n✗ Client contact not found: ${clientContactId}\n`));
|
|
39
|
+
} else {
|
|
40
|
+
console.error(chalk.red(`\n✗ Error: ${errorMessage} (${errorCode})\n`));
|
|
41
|
+
}
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const contact = response.data as ClientContact | null;
|
|
46
|
+
|
|
47
|
+
if (!contact) {
|
|
48
|
+
console.error(chalk.red('\n✗ Client contact not found\n'));
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (options.json) {
|
|
53
|
+
console.log(JSON.stringify({
|
|
54
|
+
success: true,
|
|
55
|
+
data: contact,
|
|
56
|
+
}, null, 2));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
console.log(chalk.bold('\n📇 Client Contact Details\n'));
|
|
61
|
+
console.log(` ${chalk.gray('Contact ID:')} ${contact.clientContactId}`);
|
|
62
|
+
console.log(` ${chalk.gray('Client ID:')} ${contact.clientId}`);
|
|
63
|
+
console.log(` ${chalk.gray('Name:')} ${contact.clientContactName}`);
|
|
64
|
+
if (contact.clientContactPhone) {
|
|
65
|
+
console.log(` ${chalk.gray('Phone:')} ${contact.clientContactPhone}`);
|
|
66
|
+
}
|
|
67
|
+
if (contact.clientContactTelephone) {
|
|
68
|
+
console.log(` ${chalk.gray('Telephone:')} ${contact.clientContactTelephone}`);
|
|
69
|
+
}
|
|
70
|
+
if (contact.clientContactEmail) {
|
|
71
|
+
console.log(` ${chalk.gray('Email:')} ${contact.clientContactEmail}`);
|
|
72
|
+
}
|
|
73
|
+
if (contact.clientContactSex) {
|
|
74
|
+
console.log(` ${chalk.gray('Sex:')} ${contact.clientContactSex}`);
|
|
75
|
+
}
|
|
76
|
+
if (contact.clientContactBirthday) {
|
|
77
|
+
console.log(` ${chalk.gray('Birthday:')} ${contact.clientContactBirthday}`);
|
|
78
|
+
}
|
|
79
|
+
if (contact.clientContactQq) {
|
|
80
|
+
console.log(` ${chalk.gray('QQ:')} ${contact.clientContactQq}`);
|
|
81
|
+
}
|
|
82
|
+
if (contact.clientContactWechat) {
|
|
83
|
+
console.log(` ${chalk.gray('WeChat:')} ${contact.clientContactWechat}`);
|
|
84
|
+
}
|
|
85
|
+
if (contact.clientContactAddress) {
|
|
86
|
+
console.log(` ${chalk.gray('Address:')} ${contact.clientContactAddress}`);
|
|
87
|
+
}
|
|
88
|
+
if (contact.defaultFlag) {
|
|
89
|
+
const defaultText = contact.defaultFlag === 'Y' ? chalk.green('Yes') : chalk.gray('No');
|
|
90
|
+
console.log(` ${chalk.gray('Default:')} ${defaultText}`);
|
|
91
|
+
}
|
|
92
|
+
if (contact.remark) {
|
|
93
|
+
console.log(` ${chalk.gray('Remark:')} ${contact.remark}`);
|
|
94
|
+
}
|
|
95
|
+
console.log();
|
|
96
|
+
} catch (error) {
|
|
97
|
+
console.error(chalk.red(`\n✗ Unexpected error: ${error instanceof Error ? error.message : 'Unknown error'}\n`));
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
return getCommand;
|
|
103
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { createClientContactListCommand } from './list.js';
|
|
3
|
+
import { createClientContactGetCommand } from './get.js';
|
|
4
|
+
import { createClientContactCreateCommand } from './create.js';
|
|
5
|
+
import { createClientContactUpdateCommand } from './update.js';
|
|
6
|
+
import { createClientContactDeleteCommand } from './delete.js';
|
|
7
|
+
|
|
8
|
+
export function createClientContactsCommand(): Command {
|
|
9
|
+
const clientContactsCommand = new Command('client-contacts');
|
|
10
|
+
clientContactsCommand.description('Manage client contacts');
|
|
11
|
+
|
|
12
|
+
clientContactsCommand.addCommand(createClientContactListCommand());
|
|
13
|
+
clientContactsCommand.addCommand(createClientContactGetCommand());
|
|
14
|
+
clientContactsCommand.addCommand(createClientContactCreateCommand());
|
|
15
|
+
clientContactsCommand.addCommand(createClientContactUpdateCommand());
|
|
16
|
+
clientContactsCommand.addCommand(createClientContactDeleteCommand());
|
|
17
|
+
|
|
18
|
+
return clientContactsCommand;
|
|
19
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
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 { ClientContactListResponse } from '../../../types/client-contact.js';
|
|
7
|
+
import { Environment } from '../../../types/index.js';
|
|
8
|
+
|
|
9
|
+
export function createClientContactListCommand(): Command {
|
|
10
|
+
const listCommand = new Command('list');
|
|
11
|
+
listCommand.description('List client contacts with pagination');
|
|
12
|
+
|
|
13
|
+
listCommand
|
|
14
|
+
.requiredOption('-c, --client-id <string>', 'Client ID (required)')
|
|
15
|
+
.option('-p, --page <number>', 'Page number', '1')
|
|
16
|
+
.option('-s, --size <number>', 'Page size', '20')
|
|
17
|
+
.option('--json', 'Output as JSON')
|
|
18
|
+
.action(async (options) => {
|
|
19
|
+
const context = configManager.getCurrentContext();
|
|
20
|
+
const environment = (options.env as Environment) || context.environment;
|
|
21
|
+
const tenant = options.tenant || context.tenant;
|
|
22
|
+
|
|
23
|
+
const page = parseInt(options.page as string, 10) - 1; // API uses 0-based pagination
|
|
24
|
+
const size = parseInt(options.size as string, 10);
|
|
25
|
+
|
|
26
|
+
const params = {
|
|
27
|
+
clientId: options.clientId as string,
|
|
28
|
+
pageNo: page,
|
|
29
|
+
pageSize: size,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const response = await apiClient.listClientContacts(environment, tenant, params);
|
|
33
|
+
|
|
34
|
+
if (!response.success) {
|
|
35
|
+
console.error(chalk.red(`\n✗ Failed to list client contacts: ${response.error?.message || 'Unknown error'}`));
|
|
36
|
+
if (response.error?.code) {
|
|
37
|
+
console.error(chalk.gray(` Error code: ${response.error.code}`));
|
|
38
|
+
}
|
|
39
|
+
console.error();
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const data = response.data as ClientContactListResponse | null;
|
|
44
|
+
|
|
45
|
+
if (!data) {
|
|
46
|
+
if (options.json) {
|
|
47
|
+
console.log(JSON.stringify({ success: true, data: { items: [], pagination: { pageNo: 0, pageSize: 20, totalRows: 0 } } }, null, 2));
|
|
48
|
+
} else {
|
|
49
|
+
console.log(chalk.bold('\n📋 Client Contact List\n'));
|
|
50
|
+
console.log(chalk.gray(' No client contacts found\n'));
|
|
51
|
+
}
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (options.json) {
|
|
56
|
+
console.log(
|
|
57
|
+
JSON.stringify(
|
|
58
|
+
{
|
|
59
|
+
success: true,
|
|
60
|
+
data: {
|
|
61
|
+
items: data.rows || [],
|
|
62
|
+
pagination: {
|
|
63
|
+
pageNo: data.pageNo,
|
|
64
|
+
pageSize: data.pageSize,
|
|
65
|
+
totalRows: data.totalRows,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
null,
|
|
70
|
+
2
|
|
71
|
+
)
|
|
72
|
+
);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const records = data.rows || [];
|
|
77
|
+
|
|
78
|
+
if (records.length === 0) {
|
|
79
|
+
console.log(chalk.bold('\n📋 Client Contact List\n'));
|
|
80
|
+
console.log(chalk.gray(' No client contacts found\n'));
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
console.log(chalk.bold('\n📋 Client Contact List\n'));
|
|
85
|
+
|
|
86
|
+
const table = new Table({
|
|
87
|
+
head: [chalk.bold('ID'), chalk.bold('NAME'), chalk.bold('PHONE'), chalk.bold('TELEPHONE'), chalk.bold('EMAIL'), chalk.bold('DEFAULT')],
|
|
88
|
+
colWidths: [10, 15, 15, 15, 25, 10],
|
|
89
|
+
style: {
|
|
90
|
+
head: [],
|
|
91
|
+
border: [],
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
for (const contact of records) {
|
|
96
|
+
const defaultText = contact.defaultFlag === 'Y' ? chalk.green('Y') : chalk.gray('N');
|
|
97
|
+
table.push([
|
|
98
|
+
contact.clientContactId,
|
|
99
|
+
contact.clientContactName || '-',
|
|
100
|
+
contact.clientContactPhone || '-',
|
|
101
|
+
contact.clientContactTelephone || '-',
|
|
102
|
+
contact.clientContactEmail || '-',
|
|
103
|
+
defaultText,
|
|
104
|
+
]);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
console.log(table.toString());
|
|
108
|
+
console.log();
|
|
109
|
+
console.log(
|
|
110
|
+
chalk.gray(
|
|
111
|
+
` Total: ${data.totalRows} | Page: ${data.pageNo + 1} / ${Math.ceil(data.totalRows / data.pageSize) || 1} | Size: ${data.pageSize}`
|
|
112
|
+
)
|
|
113
|
+
);
|
|
114
|
+
console.log();
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
return listCommand;
|
|
118
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
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 { UpdateClientContactRequest } from '../../../types/client-contact.js';
|
|
7
|
+
|
|
8
|
+
export function createClientContactUpdateCommand(): Command {
|
|
9
|
+
const cmd = new Command('update');
|
|
10
|
+
cmd.description('Update a client contact');
|
|
11
|
+
cmd.arguments('<contact-id>');
|
|
12
|
+
|
|
13
|
+
cmd
|
|
14
|
+
.option('-n, --name <string>', 'Contact name')
|
|
15
|
+
.option('-p, --phone <string>', 'Mobile phone')
|
|
16
|
+
.option('-t, --telephone <string>', 'Telephone')
|
|
17
|
+
.option('-e, --email <string>', 'Email')
|
|
18
|
+
.option('-s, --sex <string>', 'Sex')
|
|
19
|
+
.option('-b, --birthday <string>', 'Birthday (YYYY-MM-DD)')
|
|
20
|
+
.option('-q, --qq <string>', 'QQ number')
|
|
21
|
+
.option('-w, --wechat <string>', 'WeChat ID')
|
|
22
|
+
.option('-a, --address <string>', 'Address')
|
|
23
|
+
.option('-d, --default', 'Set as default contact')
|
|
24
|
+
.option('-r, --remark <string>', 'Remark')
|
|
25
|
+
.option('--dry-run', 'Preview the operation without executing')
|
|
26
|
+
.option('--json', 'Output as JSON')
|
|
27
|
+
.action(async (contactId: string, options: Record<string, unknown>) => {
|
|
28
|
+
const context = configManager.getCurrentContext();
|
|
29
|
+
const environment = context.environment as Environment;
|
|
30
|
+
const tenant = context.tenant;
|
|
31
|
+
const jsonOutput = options.json === true;
|
|
32
|
+
|
|
33
|
+
if (!contactId) {
|
|
34
|
+
if (jsonOutput) {
|
|
35
|
+
console.log(JSON.stringify({ success: false, error: { code: 'VALIDATION_ERROR', message: 'Contact ID is required' } }));
|
|
36
|
+
} else {
|
|
37
|
+
console.error(chalk.red('\n✗ Contact ID is required\n'));
|
|
38
|
+
}
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const fields: Partial<UpdateClientContactRequest> = {
|
|
43
|
+
clientContactId: contactId,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
if (options.name) fields.clientContactName = options.name as string;
|
|
47
|
+
if (options.phone) fields.clientContactPhone = options.phone as string;
|
|
48
|
+
if (options.telephone) fields.clientContactTelephone = options.telephone as string;
|
|
49
|
+
if (options.email) fields.clientContactEmail = options.email as string;
|
|
50
|
+
if (options.sex) fields.clientContactSex = options.sex as string;
|
|
51
|
+
if (options.birthday) fields.clientContactBirthday = options.birthday as string;
|
|
52
|
+
if (options.qq) fields.clientContactQq = options.qq as string;
|
|
53
|
+
if (options.wechat) fields.clientContactWechat = options.wechat as string;
|
|
54
|
+
if (options.address) fields.clientContactAddress = options.address as string;
|
|
55
|
+
if (options.default) fields.defaultFlag = 'Y';
|
|
56
|
+
if (options.remark) fields.remark = options.remark as string;
|
|
57
|
+
|
|
58
|
+
const updateFields = Object.keys(fields).filter(k => k !== 'clientContactId' && fields[k as keyof UpdateClientContactRequest] !== undefined);
|
|
59
|
+
if (updateFields.length === 0) {
|
|
60
|
+
if (jsonOutput) {
|
|
61
|
+
console.log(JSON.stringify({ success: false, error: { code: 'VALIDATION_ERROR', message: 'No fields to update. Provide at least one of: --name, --phone, --telephone, --email, --sex, --birthday, --qq, --wechat, --address, --default, --remark' } }));
|
|
62
|
+
} else {
|
|
63
|
+
console.error(chalk.red('\n✗ No fields to update. Provide at least one of: --name, --phone, --telephone, --email, --sex, --birthday, --qq, --wechat, --address, --default, --remark\n'));
|
|
64
|
+
}
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const updateData: UpdateClientContactRequest = fields as UpdateClientContactRequest;
|
|
69
|
+
|
|
70
|
+
if (options.dryRun) {
|
|
71
|
+
if (jsonOutput) {
|
|
72
|
+
console.log(JSON.stringify({ success: true, dryRun: true, data: updateData }));
|
|
73
|
+
} else {
|
|
74
|
+
console.log(chalk.cyan('\n🔍 Dry-Run Mode: No actual API call will be made\n'));
|
|
75
|
+
console.log(chalk.gray(' This operation will update the client contact with the following fields:'));
|
|
76
|
+
console.log(` ${chalk.gray('Contact ID:')} ${contactId}`);
|
|
77
|
+
if (fields.clientContactName) console.log(` ${chalk.gray('Name:')} ${fields.clientContactName}`);
|
|
78
|
+
if (fields.clientContactPhone) console.log(` ${chalk.gray('Phone:')} ${fields.clientContactPhone}`);
|
|
79
|
+
if (fields.clientContactTelephone) console.log(` ${chalk.gray('Telephone:')} ${fields.clientContactTelephone}`);
|
|
80
|
+
if (fields.clientContactEmail) console.log(` ${chalk.gray('Email:')} ${fields.clientContactEmail}`);
|
|
81
|
+
if (fields.clientContactSex) console.log(` ${chalk.gray('Sex:')} ${fields.clientContactSex}`);
|
|
82
|
+
if (fields.clientContactBirthday) console.log(` ${chalk.gray('Birthday:')} ${fields.clientContactBirthday}`);
|
|
83
|
+
if (fields.clientContactQq) console.log(` ${chalk.gray('QQ:')} ${fields.clientContactQq}`);
|
|
84
|
+
if (fields.clientContactWechat) console.log(` ${chalk.gray('WeChat:')} ${fields.clientContactWechat}`);
|
|
85
|
+
if (fields.clientContactAddress) console.log(` ${chalk.gray('Address:')} ${fields.clientContactAddress}`);
|
|
86
|
+
if (fields.defaultFlag) console.log(` ${chalk.gray('Default:')} ${fields.defaultFlag}`);
|
|
87
|
+
if (fields.remark) console.log(` ${chalk.gray('Remark:')} ${fields.remark}`);
|
|
88
|
+
console.log();
|
|
89
|
+
}
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
try {
|
|
94
|
+
const response = await apiClient.updateClientContact(environment, tenant, updateData);
|
|
95
|
+
|
|
96
|
+
if (response.success) {
|
|
97
|
+
if (jsonOutput) {
|
|
98
|
+
console.log(JSON.stringify({ success: true, data: response.data }));
|
|
99
|
+
} else {
|
|
100
|
+
console.log(chalk.green('\n✓ Client contact updated successfully\n'));
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
const errorMsg = response.error?.message || 'Unknown error';
|
|
104
|
+
const errorCode = response.error?.code || 'UPDATE_CLIENT_CONTACT_ERROR';
|
|
105
|
+
|
|
106
|
+
if (errorCode === '01001207001' || errorMsg.includes('不存在')) {
|
|
107
|
+
if (jsonOutput) {
|
|
108
|
+
console.log(JSON.stringify({ success: false, error: { code: 'NOT_FOUND', message: `Client contact not found: ${contactId}` } }));
|
|
109
|
+
} else {
|
|
110
|
+
console.error(chalk.red(`\n✗ Client contact not found: ${contactId}\n`));
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
if (jsonOutput) {
|
|
114
|
+
console.log(JSON.stringify({ success: false, error: { code: errorCode, message: errorMsg } }));
|
|
115
|
+
} else {
|
|
116
|
+
console.error(chalk.red(`\n✗ Failed to update client contact: ${errorMsg}`));
|
|
117
|
+
if (response.error?.code) {
|
|
118
|
+
console.error(chalk.gray(` Error code: ${response.error.code}`));
|
|
119
|
+
}
|
|
120
|
+
console.error();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
process.exit(1);
|
|
124
|
+
}
|
|
125
|
+
} catch (error) {
|
|
126
|
+
const errMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
127
|
+
if (jsonOutput) {
|
|
128
|
+
console.log(JSON.stringify({ success: false, error: { code: 'ERROR', message: errMsg } }));
|
|
129
|
+
} else {
|
|
130
|
+
console.error(chalk.red(`\n✗ Error: ${errMsg}\n`));
|
|
131
|
+
}
|
|
132
|
+
process.exit(1);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
return cmd;
|
|
137
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
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 { DictType } from '../../../types/dict.js';
|
|
7
|
+
|
|
8
|
+
export function createDictTypeGetCommand(): Command {
|
|
9
|
+
const getCommand = new Command('get');
|
|
10
|
+
getCommand.description('Get dictionary type details by ID');
|
|
11
|
+
getCommand.arguments('<dictTypeId>');
|
|
12
|
+
getCommand.option('--json', 'Output as JSON');
|
|
13
|
+
|
|
14
|
+
getCommand.action(async (dictTypeId: 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 (!dictTypeId) {
|
|
20
|
+
console.error(chalk.red('\n✗ Dictionary Type ID is required\n'));
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
const response = await apiClient.getDictType(environment, tenant, dictTypeId);
|
|
28
|
+
|
|
29
|
+
if (!response.success) {
|
|
30
|
+
const errorCode = response.error?.code || 'UNKNOWN_ERROR';
|
|
31
|
+
const errorMessage = response.error?.message || 'Unknown error';
|
|
32
|
+
|
|
33
|
+
// Handle "dict type not found" case
|
|
34
|
+
if (errorCode === '01001150001' || errorMessage.includes('不存在')) {
|
|
35
|
+
console.error(chalk.red(`\n✗ Dictionary type not found: ${dictTypeId}\n`));
|
|
36
|
+
} else {
|
|
37
|
+
console.error(chalk.red(`\n✗ Error: ${errorMessage} (${errorCode})\n`));
|
|
38
|
+
}
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const dictType = response.data as DictType | null;
|
|
43
|
+
|
|
44
|
+
if (!dictType) {
|
|
45
|
+
console.error(chalk.red('\n✗ Dictionary type not found\n'));
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (options.json) {
|
|
50
|
+
console.log(JSON.stringify({
|
|
51
|
+
success: true,
|
|
52
|
+
data: dictType,
|
|
53
|
+
}, null, 2));
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Table output
|
|
58
|
+
console.log(chalk.bold('\n📋 Dictionary Type Details\n'));
|
|
59
|
+
console.log(` ${chalk.gray('ID:')} ${dictType.dictTypeId}`);
|
|
60
|
+
console.log(` ${chalk.gray('Code:')} ${dictType.dictTypeCode}`);
|
|
61
|
+
console.log(` ${chalk.gray('Name:')} ${dictType.dictTypeName}`);
|
|
62
|
+
console.log(` ${chalk.gray('Status:')} ${dictType.statusFlag === 1 ? 'Enable' : 'Disable'}`);
|
|
63
|
+
if (dictType.remark) {
|
|
64
|
+
console.log(` ${chalk.gray('Remark:')} ${dictType.remark}`);
|
|
65
|
+
}
|
|
66
|
+
console.log();
|
|
67
|
+
} catch (error) {
|
|
68
|
+
console.error(chalk.red(`\n✗ Unexpected error: ${error instanceof Error ? error.message : 'Unknown error'}\n`));
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
return getCommand;
|
|
74
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { createDictTypeListCommand } from './list.js';
|
|
3
|
+
import { createDictTypeGetCommand } from './get.js';
|
|
4
|
+
import { createDictTypeUpdateCommand } from './update.js';
|
|
5
|
+
|
|
6
|
+
export function createDictTypesCommand(): Command {
|
|
7
|
+
const dictTypesCommand = new Command('dict-types');
|
|
8
|
+
dictTypesCommand.description('Manage dictionary types');
|
|
9
|
+
|
|
10
|
+
dictTypesCommand.addCommand(createDictTypeListCommand());
|
|
11
|
+
dictTypesCommand.addCommand(createDictTypeGetCommand());
|
|
12
|
+
dictTypesCommand.addCommand(createDictTypeUpdateCommand());
|
|
13
|
+
|
|
14
|
+
return dictTypesCommand;
|
|
15
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
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 { DictType, DictStatusFlag } from '../../../types/dict.js';
|
|
7
|
+
import { Environment } from '../../../types/index.js';
|
|
8
|
+
|
|
9
|
+
export function createDictTypeListCommand(): Command {
|
|
10
|
+
const listCommand = new Command('list');
|
|
11
|
+
listCommand.description('List dictionary types with pagination');
|
|
12
|
+
|
|
13
|
+
listCommand
|
|
14
|
+
.option('-p, --page <number>', 'Page number', '1')
|
|
15
|
+
.option('-s, --size <number>', 'Page size', '20')
|
|
16
|
+
.option('--status <string>', 'Status filter (enable/disable)')
|
|
17
|
+
.option('--keyword <string>', 'Keyword search (dictTypeCode and dictTypeName)')
|
|
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
|
+
pageNo: number;
|
|
29
|
+
pageSize: number;
|
|
30
|
+
status?: DictStatusFlag;
|
|
31
|
+
dictTypeCode?: string;
|
|
32
|
+
dictTypeName?: string;
|
|
33
|
+
} = { pageNo: page, pageSize: size };
|
|
34
|
+
|
|
35
|
+
if (options.status !== undefined) {
|
|
36
|
+
const statusVal = (options.status as string).toLowerCase();
|
|
37
|
+
if (statusVal === 'enable' || statusVal === '1') {
|
|
38
|
+
params.status = 1;
|
|
39
|
+
} else if (statusVal === 'disable' || statusVal === '2') {
|
|
40
|
+
params.status = 2;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Keyword searches both dictTypeCode and dictTypeName
|
|
45
|
+
if (options.keyword !== undefined) {
|
|
46
|
+
const keyword = options.keyword as string;
|
|
47
|
+
params.dictTypeCode = keyword;
|
|
48
|
+
params.dictTypeName = keyword;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const response = await apiClient.listDictTypes(environment, tenant, params);
|
|
52
|
+
|
|
53
|
+
if (!response.success) {
|
|
54
|
+
console.error(chalk.red(`\n✗ Failed to list dictionary types: ${response.error?.message || 'Unknown error'}`));
|
|
55
|
+
if (response.error?.code) {
|
|
56
|
+
console.error(chalk.gray(` Error code: ${response.error.code}`));
|
|
57
|
+
}
|
|
58
|
+
console.error();
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const records = (response.data as unknown as DictType[]) || [];
|
|
63
|
+
|
|
64
|
+
if (!records || records.length === 0) {
|
|
65
|
+
if (options.json) {
|
|
66
|
+
console.log(JSON.stringify({ success: true, data: { items: [] } }, null, 2));
|
|
67
|
+
} else {
|
|
68
|
+
console.log(chalk.bold('\n📖 Dict Type List\n'));
|
|
69
|
+
console.log(chalk.gray(' No dictionary types found\n'));
|
|
70
|
+
}
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (options.json) {
|
|
75
|
+
console.log(
|
|
76
|
+
JSON.stringify(
|
|
77
|
+
{
|
|
78
|
+
success: true,
|
|
79
|
+
data: {
|
|
80
|
+
items: records,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
null,
|
|
84
|
+
2
|
|
85
|
+
)
|
|
86
|
+
);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
console.log(chalk.bold('\n📖 Dict Type List\n'));
|
|
91
|
+
|
|
92
|
+
const table = new Table({
|
|
93
|
+
head: [chalk.bold('ID'), chalk.bold('Code'), chalk.bold('Name'), chalk.bold('Status')],
|
|
94
|
+
colWidths: [14, 18, 35, 10],
|
|
95
|
+
style: {
|
|
96
|
+
head: [],
|
|
97
|
+
border: [],
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
for (const dictType of records) {
|
|
102
|
+
const statusText = dictType.statusFlag === 1 ? chalk.green('Enable') : chalk.red('Disable');
|
|
103
|
+
table.push([
|
|
104
|
+
dictType.dictTypeId,
|
|
105
|
+
dictType.dictTypeCode || '-',
|
|
106
|
+
dictType.dictTypeName || '-',
|
|
107
|
+
statusText,
|
|
108
|
+
]);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
console.log(table.toString());
|
|
112
|
+
console.log();
|
|
113
|
+
console.log(chalk.gray(` Total: ${records.length}`));
|
|
114
|
+
console.log();
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
return listCommand;
|
|
118
|
+
}
|