Skip to content

Bulk Import Devices#1

Merged
asanchezdelc merged 4 commits into
mainfrom
feat/bulk-import-locs-devs-to-user
Feb 5, 2026
Merged

Bulk Import Devices#1
asanchezdelc merged 4 commits into
mainfrom
feat/bulk-import-locs-devs-to-user

Conversation

@asanchezdelc

Copy link
Copy Markdown
Member

This pull request introduces major enhancements to the CLI commands for bulk import, devices, companies, and locations, focusing on improved flexibility, support for JSON input/output, and more robust error handling and validation. The changes enable users to provide complex data via JSON, override fields via CLI options, and include metadata and additional fields in device and company creation and updates.

Bulk Import Command Additions

  • Introduced a new bulk import command in src/commands/bulk.ts for importing locations and devices from CSV files, supporting interactive mapping, mapping file save/load, dry-run validation, CLI/default location fields, and JSON output.

Device Command Enhancements

  • Added support for JSON input (--data), device metadata (--metadata), and new device fields (user/company ID, sensor type/use, device category) to the device create/update commands. Individual CLI options override JSON fields, with validation for required fields. [1] [2]
  • Added an --include-metadata flag to the device list command to include device metadata in the response. [1] [2] [3]

Company Command Enhancements

  • Added support for a JSON body (--data) for company creation and update, with CLI options overriding JSON fields. Validation ensures required fields are present, and error handling is improved for missing/invalid data. [1] [2] [3] [4]

Location Command Enhancements

  • Added support for optional JSON input for location creation, and made industry an explicit option (required unless using --data).
  • Displayed the industry field in location details output.

General Improvements

  • Improved error handling: CLI now exits with clear error messages for missing required fields or invalid JSON input, and spinner handling is more robust to avoid leaving spinners running on errors. [1] [2] [3] [4]

…mmands

- Add industry as required field for location creation
- Add industry to location get output and update command
- Add location.industry to bulk import column mapping
- Add -d/--data option to create/update commands for quick JSON testing:
  - locations create/update
  - devices create/update
  - users create/update
  - companies create/update
  - registry create
- Change primary_users array to user_id string
- Remove timezone from location defaults (not required)
- Add --include-metadata flag to list command for fetching device metadata
- Add -m, --metadata option to create command for key-value metadata pairs
- Add -m, --metadata option to update command for updating metadata
- Add device.device_type_id mapping option to column mapper
- Fetch device templates by ID and extract device attributes:
  - device_category from template.category
  - sensor_use from device_use where default=true
  - sensor_type from meta where key='device_type'
- Update createDevice to use template values as fallbacks
- Make sensor_type optional when device_type_id is mapped
@asanchezdelc asanchezdelc merged commit ef0f98e into main Feb 5, 2026
3 of 4 checks passed
@asanchezdelc asanchezdelc deleted the feat/bulk-import-locs-devs-to-user branch February 5, 2026 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant