pglens 1.0.0

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.
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: Bug Report
3
+ about: Create a report to help us improve
4
+ title: '[BUG] '
5
+ labels: bug
6
+ assignees: ''
7
+ ---
8
+
9
+ ## Describe the Bug
10
+
11
+ A clear and concise description of what the bug is.
12
+
13
+ ## To Reproduce
14
+
15
+ Steps to reproduce the behavior:
16
+
17
+ 1. Run command: `pglens --url ...`
18
+ 2. Perform action: '...'
19
+ 3. See error
20
+
21
+ ## Expected Behavior
22
+
23
+ A clear and concise description of what you expected to happen.
24
+
25
+ ## Error Message
26
+
27
+ ```
28
+ Paste the full error message here
29
+ ```
30
+
31
+ ## Environment
32
+
33
+ - **OS**: [e.g., macOS 12.0, Ubuntu 20.04, Windows 10]
34
+ - **Node.js version**: [e.g., 16.14.0]
35
+ - **pglens version**: [e.g., 1.0.0]
36
+ - **PostgreSQL version**: [e.g., 14.2]
37
+ - **SSL Mode** (if applicable): [e.g., require, prefer]
38
+
39
+ ## Additional Context
40
+
41
+ Add any other context, screenshots, or information about the problem.
42
+
43
+ ## Possible Solution
44
+
45
+ If you have ideas on how to fix this, please share them here.
46
+
@@ -0,0 +1,9 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: ๐Ÿ’ฌ Discussions
4
+ url: https://github.com/tsvillain/pglens/discussions
5
+ about: Ask questions and discuss ideas
6
+ - name: ๐Ÿ“š Documentation
7
+ url: https://github.com/tsvillain/pglens#readme
8
+ about: Check the README for usage and examples
9
+
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: Feature Request
3
+ about: Suggest an idea for this project
4
+ title: '[FEATURE] '
5
+ labels: enhancement
6
+ assignees: ''
7
+ ---
8
+
9
+ ## Is your feature request related to a problem?
10
+
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ ## Describe the solution you'd like
14
+
15
+ A clear and concise description of what you want to happen.
16
+
17
+ ## Describe alternatives you've considered
18
+
19
+ A clear and concise description of any alternative solutions or features you've considered.
20
+
21
+ ## Use Cases
22
+
23
+ Describe specific scenarios where this feature would be useful:
24
+
25
+ 1. ...
26
+ 2. ...
27
+ 3. ...
28
+
29
+ ## Additional Context
30
+
31
+ Add any other context, mockups, screenshots, or examples about the feature request here.
32
+
33
+ ## Implementation Ideas
34
+
35
+ If you have ideas on how this could be implemented, please share them here.
36
+
@@ -0,0 +1,52 @@
1
+ ## Description
2
+
3
+ Brief description of what this PR does and why it's needed.
4
+
5
+ ## Type of Change
6
+
7
+ - [ ] ๐Ÿ› Bug fix (non-breaking change which fixes an issue)
8
+ - [ ] โœจ New feature (non-breaking change which adds functionality)
9
+ - [ ] ๐Ÿ’ฅ Breaking change (fix or feature that would cause existing functionality to not work as expected)
10
+ - [ ] ๐Ÿ“ Documentation update
11
+ - [ ] โ™ป๏ธ Code refactoring (no functional changes)
12
+ - [ ] โšก Performance improvement
13
+ - [ ] ๐Ÿงน Code cleanup
14
+
15
+ ## Related Issues
16
+
17
+ Closes #
18
+ Fixes #
19
+ Related to #
20
+
21
+ ## Changes Made
22
+
23
+ -
24
+ -
25
+ -
26
+
27
+ ## Testing
28
+
29
+ - [ ] Tested locally with PostgreSQL database
30
+ - [ ] Verified error handling works correctly
31
+ - [ ] Checked for console errors in browser
32
+ - [ ] Tested with different SSL modes (if applicable)
33
+ - [ ] Tested edge cases (empty tables, large tables, etc.)
34
+
35
+ ## Screenshots (if applicable)
36
+
37
+ Add screenshots to help explain your changes.
38
+
39
+ ## Checklist
40
+
41
+ - [ ] My code follows the project's style guidelines
42
+ - [ ] I have commented my code, particularly in hard-to-understand areas
43
+ - [ ] I have updated the documentation (README.md, CHANGELOG.md, etc.)
44
+ - [ ] My changes generate no new warnings or errors
45
+ - [ ] I have removed all debug code (console.log, commented code, etc.)
46
+ - [ ] I have tested my changes thoroughly
47
+ - [ ] My PR title follows the commit message guidelines
48
+
49
+ ## Additional Notes
50
+
51
+ Any additional information that reviewers should know.
52
+
package/CHANGELOG.md ADDED
@@ -0,0 +1,41 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+ - SSL mode configuration via `--sslmode` flag with support for: `disable`, `require`, `prefer`, `verify-ca`, `verify-full`
12
+ - Automatic SSL mode recommendations when connection fails
13
+ - Enhanced error messages with context-aware suggestions
14
+
15
+ ### Changed
16
+ - Improved production readiness by removing debug code and commented sections
17
+ - Updated connection error handling to provide actionable recommendations
18
+
19
+ ## [1.0.0] - Initial Release
20
+
21
+ ### Added
22
+ - PostgreSQL database viewer with web interface
23
+ - Table browser with searchable sidebar
24
+ - Multi-tab support for viewing multiple tables simultaneously
25
+ - Data viewer with pagination (100 rows per page)
26
+ - Client-side column sorting
27
+ - Column visibility toggle
28
+ - Column resizing functionality
29
+ - Theme support (light, dark, system)
30
+ - Cursor-based pagination for efficient large table navigation
31
+ - Automatic primary key detection for optimized pagination
32
+ - Refresh data functionality
33
+ - PM2 deployment support documentation
34
+
35
+ ### Security
36
+ - SQL injection prevention via table name sanitization
37
+ - Input validation for pagination parameters
38
+
39
+ [Unreleased]: https://github.com/tsvillain/pglens/compare/v1.0.0...HEAD
40
+ [1.0.0]: https://github.com/tsvillain/pglens/releases/tag/v1.0.0
41
+
@@ -0,0 +1,391 @@
1
+ # Contributing to pglens
2
+
3
+ Thank you for your interest in contributing to pglens! This document provides guidelines and instructions for contributing to the project.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Code of Conduct](#code-of-conduct)
8
+ - [How to Contribute](#how-to-contribute)
9
+ - [Development Setup](#development-setup)
10
+ - [Project Structure](#project-structure)
11
+ - [Coding Guidelines](#coding-guidelines)
12
+ - [Pull Request Process](#pull-request-process)
13
+ - [Reporting Issues](#reporting-issues)
14
+ - [Feature Requests](#feature-requests)
15
+ - [Commit Message Guidelines](#commit-message-guidelines)
16
+
17
+ ## Code of Conduct
18
+
19
+ By participating in this project, you agree to:
20
+
21
+ - Be respectful and inclusive
22
+ - Welcome newcomers and help them learn
23
+ - Focus on constructive feedback
24
+ - Respect different viewpoints and experiences
25
+
26
+ ## How to Contribute
27
+
28
+ There are many ways to contribute to pglens:
29
+
30
+ - ๐Ÿ› **Report bugs**: Help us identify and fix issues
31
+ - ๐Ÿ’ก **Suggest features**: Share your ideas for improvements
32
+ - ๐Ÿ“ **Improve documentation**: Help make the docs clearer
33
+ - ๐Ÿ”ง **Submit code**: Fix bugs or add new features
34
+ - ๐Ÿงช **Test changes**: Help verify that changes work correctly
35
+
36
+ ## Development Setup
37
+
38
+ ### Prerequisites
39
+
40
+ - Node.js (v14 or higher)
41
+ - npm (v6 or higher)
42
+ - PostgreSQL database (for testing)
43
+
44
+ ### Getting Started
45
+
46
+ 1. **Fork the repository** on GitHub
47
+
48
+ 2. **Clone your fork**:
49
+ ```bash
50
+ git clone https://github.com/YOUR_USERNAME/pglens.git
51
+ cd pglens
52
+ ```
53
+
54
+ 3. **Install dependencies**:
55
+ ```bash
56
+ npm install
57
+ ```
58
+
59
+ 4. **Set up a test database**:
60
+ - Create a PostgreSQL database for testing
61
+ - Note the connection string for testing
62
+
63
+ 5. **Test the installation**:
64
+ ```bash
65
+ node bin/pglens --url postgresql://user:password@localhost:5432/testdb --port 54321
66
+ ```
67
+
68
+ 6. **Create a branch** for your changes:
69
+ ```bash
70
+ git checkout -b feature/your-feature-name
71
+ # or
72
+ git checkout -b fix/your-bug-fix
73
+ ```
74
+
75
+ ## Project Structure
76
+
77
+ ```
78
+ pglens/
79
+ โ”œโ”€โ”€ bin/
80
+ โ”‚ โ””โ”€โ”€ pglens # CLI entry point
81
+ โ”œโ”€โ”€ client/ # Frontend application
82
+ โ”‚ โ”œโ”€โ”€ app.js # Main client-side JavaScript
83
+ โ”‚ โ”œโ”€โ”€ index.html # HTML template
84
+ โ”‚ โ””โ”€โ”€ styles.css # Stylesheet
85
+ โ”œโ”€โ”€ src/
86
+ โ”‚ โ”œโ”€โ”€ db/
87
+ โ”‚ โ”‚ โ””โ”€โ”€ connection.js # Database connection pool
88
+ โ”‚ โ”œโ”€โ”€ routes/
89
+ โ”‚ โ”‚ โ””โ”€โ”€ api.js # API routes
90
+ โ”‚ โ””โ”€โ”€ server.js # Express server setup
91
+ โ”œโ”€โ”€ package.json
92
+ โ”œโ”€โ”€ README.md
93
+ โ”œโ”€โ”€ CHANGELOG.md
94
+ โ””โ”€โ”€ CONTRIBUTING.md
95
+ ```
96
+
97
+ ## Coding Guidelines
98
+
99
+ ### General Principles
100
+
101
+ - **Keep it simple**: Prefer simple, readable solutions over clever ones
102
+ - **Follow existing patterns**: Match the style and structure of existing code
103
+ - **Document your code**: Add JSDoc comments for functions and complex logic
104
+ - **Remove debug code**: Don't commit `console.log` statements (except for production logs)
105
+ - **No commented code**: Remove commented-out code before submitting
106
+
107
+ ### Code Style
108
+
109
+ - Use **2 spaces** for indentation
110
+ - Use **single quotes** for strings (unless escaping quotes)
111
+ - Use **camelCase** for variables and functions
112
+ - Use **PascalCase** for classes/constructors
113
+ - Add **semicolons** at the end of statements
114
+ - Maximum line length: **100 characters** (soft limit)
115
+
116
+ ### Example
117
+
118
+ ```javascript
119
+ /**
120
+ * Example function with proper documentation.
121
+ * @param {string} tableName - Name of the table
122
+ * @param {number} limit - Maximum number of rows
123
+ * @returns {Promise<Array>} Array of table rows
124
+ */
125
+ async function fetchTableData(tableName, limit = 100) {
126
+ if (!tableName) {
127
+ throw new Error('Table name is required');
128
+ }
129
+
130
+ const pool = getPool();
131
+ const query = `SELECT * FROM "${tableName}" LIMIT $1`;
132
+ const result = await pool.query(query, [limit]);
133
+ return result.rows;
134
+ }
135
+ ```
136
+
137
+ ### File Organization
138
+
139
+ - **One main export per file**: Keep modules focused
140
+ - **Group related functions**: Keep related code together
141
+ - **Separate concerns**: Database logic, API routes, and server setup should be separate
142
+
143
+ ### Error Handling
144
+
145
+ - Always handle errors appropriately
146
+ - Use try-catch blocks for async operations
147
+ - Provide meaningful error messages
148
+ - Log errors with `console.error()` for debugging
149
+
150
+ ```javascript
151
+ try {
152
+ const result = await someAsyncOperation();
153
+ return result;
154
+ } catch (error) {
155
+ console.error('Operation failed:', error);
156
+ throw new Error(`Failed to complete operation: ${error.message}`);
157
+ }
158
+ ```
159
+
160
+ ## Pull Request Process
161
+
162
+ ### Before Submitting
163
+
164
+ 1. **Test your changes**:
165
+ - Test with a real PostgreSQL database
166
+ - Verify the feature works as expected
167
+ - Check for any console errors
168
+
169
+ 2. **Update documentation**:
170
+ - Update README.md if you add new features
171
+ - Update CHANGELOG.md in the [Unreleased] section
172
+ - Add/update JSDoc comments
173
+
174
+ 3. **Check code quality**:
175
+ - Remove debug code and console.log statements
176
+ - Remove commented-out code
177
+ - Ensure consistent formatting
178
+ - Verify no linter errors
179
+
180
+ 4. **Keep PRs focused**:
181
+ - One feature or bug fix per PR
182
+ - Keep changes small and reviewable
183
+ - Split large changes into multiple PRs if needed
184
+
185
+ ### PR Submission Steps
186
+
187
+ 1. **Push your branch**:
188
+ ```bash
189
+ git push origin feature/your-feature-name
190
+ ```
191
+
192
+ 2. **Create a Pull Request** on GitHub:
193
+ - Use a clear, descriptive title
194
+ - Fill out the PR template (if available)
195
+ - Reference related issues (e.g., "Fixes #123")
196
+ - Describe what changes you made and why
197
+
198
+ 3. **PR Title Format**:
199
+ ```
200
+ type: Brief description
201
+ ```
202
+
203
+ Examples:
204
+ - `feat: Add SSL mode configuration`
205
+ - `fix: Resolve connection timeout issue`
206
+ - `docs: Update README with SSL examples`
207
+ - `refactor: Clean up connection error handling`
208
+
209
+ 4. **PR Description Template**:
210
+ ```markdown
211
+ ## Description
212
+ Brief description of what this PR does.
213
+
214
+ ## Type of Change
215
+ - [ ] Bug fix
216
+ - [ ] New feature
217
+ - [ ] Documentation update
218
+ - [ ] Code refactoring
219
+
220
+ ## Testing
221
+ - [ ] Tested locally with PostgreSQL
222
+ - [ ] Verified error handling
223
+ - [ ] Checked for console errors
224
+
225
+ ## Checklist
226
+ - [ ] Code follows style guidelines
227
+ - [ ] Documentation updated
228
+ - [ ] CHANGELOG.md updated
229
+ - [ ] No debug code committed
230
+ ```
231
+
232
+ 5. **Respond to feedback**:
233
+ - Address review comments promptly
234
+ - Make requested changes
235
+ - Ask questions if something is unclear
236
+
237
+ ### Review Process
238
+
239
+ - Maintainers will review your PR
240
+ - They may request changes or ask questions
241
+ - Once approved, your PR will be merged
242
+ - Thank you for your contribution! ๐ŸŽ‰
243
+
244
+ ## Reporting Issues
245
+
246
+ ### Before Reporting
247
+
248
+ 1. **Check existing issues**: Search to see if the issue is already reported
249
+ 2. **Verify it's a bug**: Make sure it's not expected behavior
250
+ 3. **Test latest version**: Ensure you're using the latest code
251
+
252
+ ### Bug Report Template
253
+
254
+ When creating an issue, include:
255
+
256
+ ```markdown
257
+ **Describe the bug**
258
+ A clear and concise description of what the bug is.
259
+
260
+ **To Reproduce**
261
+ Steps to reproduce the behavior:
262
+ 1. Run command: `pglens --url ...`
263
+ 2. Click on '...'
264
+ 3. See error
265
+
266
+ **Expected behavior**
267
+ A clear description of what you expected to happen.
268
+
269
+ **Error Message**
270
+ ```
271
+ Paste the full error message here
272
+ ```
273
+
274
+ **Environment:**
275
+ - OS: [e.g., macOS 12.0, Ubuntu 20.04]
276
+ - Node.js version: [e.g., 16.14.0]
277
+ - pglens version: [e.g., 1.0.0]
278
+ - PostgreSQL version: [e.g., 14.2]
279
+
280
+ **Additional context**
281
+ Add any other context, screenshots, or information about the problem.
282
+ ```
283
+
284
+ ### Security Issues
285
+
286
+ **Do not** open public issues for security vulnerabilities. Instead, please email the maintainer directly or use GitHub's security advisory feature.
287
+
288
+ ## Feature Requests
289
+
290
+ ### Before Requesting
291
+
292
+ 1. **Check existing issues**: See if the feature is already requested
293
+ 2. **Consider the scope**: Ensure it fits the project's goals
294
+ 3. **Think about implementation**: Consider how it might be implemented
295
+
296
+ ### Feature Request Template
297
+
298
+ ```markdown
299
+ **Is your feature request related to a problem?**
300
+ A clear description of what the problem is.
301
+
302
+ **Describe the solution you'd like**
303
+ A clear description of what you want to happen.
304
+
305
+ **Describe alternatives you've considered**
306
+ Any alternative solutions or features you've considered.
307
+
308
+ **Additional context**
309
+ Add any other context, mockups, or examples.
310
+ ```
311
+
312
+ ## Commit Message Guidelines
313
+
314
+ ### Format
315
+
316
+ ```
317
+ type(scope): subject
318
+
319
+ body (optional)
320
+
321
+ footer (optional)
322
+ ```
323
+
324
+ ### Types
325
+
326
+ - `feat`: New feature
327
+ - `fix`: Bug fix
328
+ - `docs`: Documentation changes
329
+ - `style`: Code style changes (formatting, etc.)
330
+ - `refactor`: Code refactoring
331
+ - `perf`: Performance improvements
332
+ - `test`: Adding or updating tests
333
+ - `chore`: Maintenance tasks
334
+
335
+ ### Examples
336
+
337
+ ```
338
+ feat(ssl): Add SSL mode configuration flag
339
+
340
+ Add --sslmode flag with support for disable, require, prefer, verify-ca, and verify-full modes.
341
+
342
+ Fixes #42
343
+ ```
344
+
345
+ ```
346
+ fix(connection): Resolve timeout issues with SSL connections
347
+
348
+ Improve error handling for SSL connection timeouts and provide better error messages.
349
+ ```
350
+
351
+ ```
352
+ docs(readme): Update README with SSL mode examples
353
+
354
+ Add examples for each SSL mode and troubleshooting section.
355
+ ```
356
+
357
+ ### Best Practices
358
+
359
+ - Use imperative mood ("Add feature" not "Added feature")
360
+ - Keep subject line under 50 characters
361
+ - Capitalize the subject line
362
+ - Don't end subject with a period
363
+ - Reference issues in footer: `Fixes #123` or `Closes #456`
364
+
365
+ ## Testing Guidelines
366
+
367
+ While we don't have automated tests yet, please:
368
+
369
+ 1. **Test manually** with a real PostgreSQL database
370
+ 2. **Test different scenarios**:
371
+ - Different table sizes
372
+ - Tables with and without primary keys
373
+ - Various SSL modes
374
+ - Error conditions
375
+
376
+ 3. **Test edge cases**:
377
+ - Empty tables
378
+ - Very large tables
379
+ - Special characters in table/column names
380
+ - Connection failures
381
+
382
+ ## Questions?
383
+
384
+ If you have questions about contributing:
385
+
386
+ - Open a discussion on GitHub
387
+ - Check existing issues and PRs
388
+ - Review the codebase to understand patterns
389
+
390
+ Thank you for contributing to pglens! ๐Ÿ™
391
+