newo 1.5.0 → 1.5.2
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/.env.example +17 -6
- package/CHANGELOG.md +91 -0
- package/README.md +502 -105
- package/dist/akb.d.ts +1 -1
- package/dist/akb.js +21 -17
- package/dist/api.d.ts +3 -2
- package/dist/api.js +24 -21
- package/dist/auth.d.ts +5 -5
- package/dist/auth.js +332 -75
- package/dist/cli.js +225 -29
- package/dist/customer.d.ts +23 -0
- package/dist/customer.js +87 -0
- package/dist/customerAsync.d.ts +22 -0
- package/dist/customerAsync.js +67 -0
- package/dist/customerInit.d.ts +10 -0
- package/dist/customerInit.js +78 -0
- package/dist/env.d.ts +33 -0
- package/dist/env.js +82 -0
- package/dist/fsutil.d.ts +14 -6
- package/dist/fsutil.js +35 -12
- package/dist/hash.d.ts +2 -2
- package/dist/hash.js +31 -8
- package/dist/sync.d.ts +5 -5
- package/dist/sync.js +91 -52
- package/dist/types.d.ts +76 -53
- package/package.json +16 -9
- package/src/akb.ts +23 -18
- package/src/api.ts +27 -24
- package/src/auth.ts +367 -94
- package/src/cli.ts +234 -33
- package/src/customer.ts +102 -0
- package/src/customerAsync.ts +78 -0
- package/src/customerInit.ts +97 -0
- package/src/env.ts +118 -0
- package/src/fsutil.ts +43 -11
- package/src/hash.ts +29 -8
- package/src/sync.ts +105 -54
- package/src/types.ts +82 -54
package/.env.example
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
# NEWO endpoints
|
|
2
2
|
NEWO_BASE_URL=https://app.newo.ai
|
|
3
3
|
|
|
4
|
-
#
|
|
5
|
-
#
|
|
4
|
+
# Multi-customer configuration - Array format
|
|
5
|
+
# Define API keys as JSON array - customer IDN will be auto-detected from API response
|
|
6
|
+
NEWO_API_KEYS=["api_key_1", "api_key_2", "api_key_3"]
|
|
7
|
+
|
|
8
|
+
# Or with optional project IDs per API key
|
|
9
|
+
# NEWO_API_KEYS=[{"key":"api_key_1","project_id":"project_uuid_1"}, {"key":"api_key_2","project_id":"project_uuid_2"}]
|
|
10
|
+
|
|
11
|
+
# Optional: specify default customer IDN after keys are loaded
|
|
12
|
+
# NEWO_DEFAULT_CUSTOMER=NEWO_ESd2BC95
|
|
6
13
|
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
|
|
14
|
+
# Legacy format (still supported)
|
|
15
|
+
# NEWO_CUSTOMER_[IDN]_API_KEY=api_key
|
|
16
|
+
# NEWO_CUSTOMER_acme_API_KEY=put_acme_api_key_here
|
|
17
|
+
|
|
18
|
+
# Legacy single-customer mode (still supported)
|
|
19
|
+
# NEWO_API_KEY=put_api_key_here
|
|
20
|
+
# NEWO_PROJECT_ID=b78188ba-0df0-46a8-8713-f0d7cff0a06e
|
|
10
21
|
|
|
11
|
-
#
|
|
22
|
+
# Optional bootstrap tokens (for legacy mode or manual setup)
|
|
12
23
|
NEWO_ACCESS_TOKEN=
|
|
13
24
|
NEWO_REFRESH_TOKEN=
|
|
14
25
|
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,97 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.5.2] - 2025-01-15
|
|
9
|
+
|
|
10
|
+
### Enhanced
|
|
11
|
+
- **Documentation Overhaul**: Complete README restructuring with professional presentation
|
|
12
|
+
- Added npm, license, TypeScript, and Node.js badges for credibility
|
|
13
|
+
- Enhanced project description highlighting multi-customer support capabilities
|
|
14
|
+
- Visual feature bullets with emojis for improved readability and engagement
|
|
15
|
+
- **Multi-Customer Documentation**: Comprehensive guide for multi-customer workflows
|
|
16
|
+
- Three flexible configuration methods: JSON arrays, individual env vars, mixed approaches
|
|
17
|
+
- Clear migration path from single to multi-customer setup
|
|
18
|
+
- Command examples for multi-customer operations (`--customer` flag usage)
|
|
19
|
+
- **Professional Documentation Structure**:
|
|
20
|
+
- Table format for command reference with improved readability
|
|
21
|
+
- Visual folder tree showing accurate `newo_customers/` structure
|
|
22
|
+
- Enhanced CI/CD integration examples for both single and multi-customer scenarios
|
|
23
|
+
- Contributing guidelines, API reference, and support channels
|
|
24
|
+
- **Corrected File Organization**: Updated folder structure documentation to match actual implementation
|
|
25
|
+
- Fixed root folder from `projects/` to `newo_customers/`
|
|
26
|
+
- Accurate customer folder hierarchy: `newo_customers/{customerIdn}/projects/{projectIdn}/`
|
|
27
|
+
- Customer-specific state management in `.newo/{customerIdn}/`
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
- **Folder Structure Documentation**: Corrected project structure examples to match actual code implementation
|
|
31
|
+
- **Package Description**: Updated npm package description to reflect multi-customer capabilities
|
|
32
|
+
|
|
33
|
+
### Developer Experience
|
|
34
|
+
- **GitHub/npm Ready**: Professional presentation suitable for public package repository
|
|
35
|
+
- **Clear Navigation**: Improved documentation structure with proper sectioning and examples
|
|
36
|
+
- **Enhanced Onboarding**: Comprehensive quick-start guide and configuration examples
|
|
37
|
+
|
|
38
|
+
## [1.5.1] - 2025-01-14
|
|
39
|
+
|
|
40
|
+
### Added
|
|
41
|
+
- **Comprehensive Test Coverage**: Added extensive test suites for all major modules
|
|
42
|
+
- `test/auth.test.js`: 500+ lines covering authentication, token management, multi-customer support
|
|
43
|
+
- `test/hash.test.js`: 400+ lines covering SHA256 hashing, hash storage, and cross-platform compatibility
|
|
44
|
+
- `test/fsutil.test.js`: 400+ lines covering file system utilities and path handling
|
|
45
|
+
- `test/akb.test.js`: 600+ lines covering AKB article parsing and import workflows
|
|
46
|
+
- Added missing test dependencies: `chai`, `sinon`, `c8` for coverage reporting
|
|
47
|
+
- **Enhanced Authentication Validation**:
|
|
48
|
+
- `validateApiKey()`: Comprehensive API key format and length validation
|
|
49
|
+
- `validateTokens()`: Token format and structure validation with detailed error messages
|
|
50
|
+
- `validateUrl()`: URL format validation for API endpoints
|
|
51
|
+
- Sensitive data sanitization in logs (API keys and tokens masked)
|
|
52
|
+
- **Structured Logging System**:
|
|
53
|
+
- `logAuthEvent()`: Structured authentication event logging with metadata
|
|
54
|
+
- Automatic sensitive data sanitization (keys/tokens/secrets masked in logs)
|
|
55
|
+
- JSON-formatted logs with timestamp, level, module, and context information
|
|
56
|
+
- **Enhanced Error Handling**:
|
|
57
|
+
- User-friendly CLI error messages with troubleshooting tips
|
|
58
|
+
- Specific error handling for authentication, network, environment, and file system errors
|
|
59
|
+
- Verbose mode support for detailed debugging information
|
|
60
|
+
- Context-aware error messages with suggested solutions
|
|
61
|
+
|
|
62
|
+
### Enhanced
|
|
63
|
+
- **Authentication Robustness** (`src/auth.ts`):
|
|
64
|
+
- Added comprehensive input validation with detailed error messages
|
|
65
|
+
- Enhanced network error handling with specific status code interpretation
|
|
66
|
+
- Added request timeouts (30 seconds) and retry logic for reliability
|
|
67
|
+
- Improved token expiry handling with 60-second buffer for refresh
|
|
68
|
+
- Better handling of connection errors, timeouts, and server errors
|
|
69
|
+
- **CLI Error Experience** (`src/cli.ts`):
|
|
70
|
+
- Added `handleCliError()` function with categorized error types
|
|
71
|
+
- User-friendly error messages with emoji indicators and troubleshooting tips
|
|
72
|
+
- Verbose mode toggle for detailed technical information vs. clean user messages
|
|
73
|
+
- Specific guidance for common issues (API key, network, configuration)
|
|
74
|
+
- **Testing Infrastructure**:
|
|
75
|
+
- Fixed ES module/CommonJS compatibility issues in test files
|
|
76
|
+
- Enhanced `TestEnvironment` class with comprehensive cleanup and mocking
|
|
77
|
+
- Added MockHttpClient, MockFileSystem, and MockLogger utilities
|
|
78
|
+
- Comprehensive assertion helpers and test data generators
|
|
79
|
+
|
|
80
|
+
### Fixed
|
|
81
|
+
- **Module System Compatibility**: Resolved ES module/CommonJS conflicts in test environment
|
|
82
|
+
- **Test Dependencies**: Added missing testing dependencies that were imported but not declared
|
|
83
|
+
- **Integration Test Paths**: Fixed paths from `src/cli.js` to `dist/cli.js` for proper compiled code testing
|
|
84
|
+
- **Error Message Consistency**: Standardized error messages across authentication and CLI modules
|
|
85
|
+
|
|
86
|
+
### Technical Details
|
|
87
|
+
- **Validation Constants**: Added security-focused validation thresholds (API_KEY_MIN_LENGTH, TOKEN_MIN_LENGTH)
|
|
88
|
+
- **Request Configuration**: Added proper timeout handling (30s) and user-agent headers
|
|
89
|
+
- **Error Recovery**: Comprehensive fallback strategies for different failure scenarios
|
|
90
|
+
- **Logging Standards**: JSON-structured logs with automatic PII/sensitive data protection
|
|
91
|
+
- **Test Coverage**: Achieved comprehensive test coverage across all core modules with realistic scenarios
|
|
92
|
+
|
|
93
|
+
### Developer Experience
|
|
94
|
+
- **Enhanced Debugging**: Verbose mode provides detailed technical information for troubleshooting
|
|
95
|
+
- **Better Error Messages**: Clear, actionable error messages instead of generic API errors
|
|
96
|
+
- **Comprehensive Testing**: Full test suite covering authentication, file operations, hashing, and AKB import
|
|
97
|
+
- **Type Safety**: All improvements maintain strict TypeScript compliance with proper error types
|
|
98
|
+
|
|
8
99
|
## [1.5.0] - 2025-09-03
|
|
9
100
|
|
|
10
101
|
### Changed
|