- URL and POST parameters are now immutable after request initialization
- SET command creates user-defined variables in separate namespace
- Variable lookup: SET variables shadow request parameters
- Added sqlpage.variables('set') to inspect user-defined variables
- Simplified API: most functions now use &RequestInfo instead of &mut
- All tests passing (151 total)
- Recorded server timing for the parameter binding process in the query execution flow.
- Updated tests to verify the inclusion of the new timing event in the server timing header.
- Updated response handling to use a builder pattern for better clarity and consistency.
- Enhanced server timing format to include microseconds in the output.
- Added a new test for server timing in redirect responses to ensure proper header inclusion.
This commit modifies the ServerTiming structure to utilize Arc for thread-safe reference counting, enhancing performance and memory management. The header generation logic is streamlined, and related code is updated to reflect these changes. Additionally, tests are adjusted to ensure proper functionality with the new implementation.
Co-authored-by: contact <contact@ophir.dev>
This commit refactors the Server-Timing header generation to be more efficient and adds comprehensive tests for its behavior in development and production environments. It also includes a new test SQL file for server timing verification.
Co-authored-by: contact <contact@ophir.dev>
- Implemented tests for edit, delete, and custom action buttons in the table component.
- Verified visibility and correct href attributes for action buttons.
- Added checks for disabled action buttons in the table.
Updated package dependencies for Playwright and Node types in package.json and package-lock.json.
- Enabled arbitrary precision for `serde_json` to handle large numbers without rounding.
- Refactored decimal handling in `sql_to_json.rs` to utilize a new function for converting decimals to JSON format.
Fixes https://github.com/sqlpage/SQLPage/issues/1052
- Updated column name handling in `row_to_json` to use lowercase for ODBC databases.
- Added `canonical_col_name` function to standardize column names.
- Modified SQL queries in tests to use lowercase column names for consistency.
- Enhanced tests for edge cases and variations in column naming.
* feat: Add sqlpage.hmac function for cryptographic signing
Co-authored-by: contact <contact@ophir.dev>
* feat: Add sqlpage.hmac function for secure data signing
Co-authored-by: contact <contact@ophir.dev>
* Test HMAC function with RFC vectors and update tests
Co-authored-by: contact <contact@ophir.dev>
* feat: Add sqlpage.hmac() function for secure signatures
Co-authored-by: contact <contact@ophir.dev>
* feat: Add base64 output option to hmac function
Co-authored-by: contact <contact@ophir.dev>
* Refactor hmac function for cleaner output formatting
Co-authored-by: contact <contact@ophir.dev>
* Add webhook HMAC signature validation tests
Co-authored-by: contact <contact@ophir.dev>
* Refactor HMAC function and update SQL examples for clarity and consistency
- Changed function parameters to remove Option types for data and key in the HMAC function.
- Improved SQL documentation and examples for HMAC usage, including clearer descriptions and updated error handling.
- Enhanced test cases for webhook HMAC validation to ensure accurate signature checks and responses.
- Removed obsolete test file for HMAC with null values.
* Update HMAC validation logic to handle NULL values in SQL queries
- Modified conditions in SQL queries to check for NULL values alongside signature mismatches.
- Enhanced documentation on NULL handling for HMAC checks to improve clarity and portability.
* remove debug logging from ci
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
- Updated SQL queries in CSV data tests to use uppercase column names.
- Simplified database table management in core tests by separating drop and create statements.
- Enhanced transaction tests to utilize an enum for database type handling.
* implemented logger Component
* changed target for logger to "sqlpage::logger" and made the log::Level case insensitive
* changed error message on missing message key, to be more precise
* changed custom method for String to log::Level conversion to builtin method log::Level::from_str()
* switched to utility method get_object_str and inlined constants
* dynamically target based on file and statement
* disabled ci error (large difference in enum variants) for ResponseWithWriter<S>
* added functionality to work in Header context
* Refactor log component to use compact error handling
* Rename comp_str variable to component_name
* Documented log component
* fixxed missing values statement
* fixxed pipeline errors
* very simple test case for logger
---------
Co-authored-by: Lenardt Gerhardts <lenardt.ger+git@gmail.com>
Co-authored-by: lovasoa <contact@ophir.dev>
- Introduce a new download component to facilitate file downloads.
- Implement download handling in the header context, supporting data URLs.
- Add a test for the download functionality to ensure correct behavior.
see https://github.com/sqlpage/SQLPage/discussions/996
- Adds a new parameter `response_encoding` to the fetch function. - This
parameter allows the user to specify a charset for decoding the response
body. - It supports all standard web encodings, and also `hex` and
`base64`. - If no encoding is specified, the response is decoded as
utf-8, or as base64 if it contains binary data.
* Check for 404 before redirecting on no-extension paths
The commit improves routing logic by checking if a path would result in
a 404
fixes https://github.com/sqlpage/SQLPage/issues/971 before adding a
trailing slash. This prevents unnecessary redirects when a custom 404
handler exists.
* Fix test function signature formatting in routing module (#973)
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
* Simplify path resolution and redirect logic
The shorter code more clearly handles finding files with .sql extensions
and decides whether to add trailing slashes based on index file
presence.
* clippy
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Checks the `Accept` header for 404 responses. If HTML is not
preferred, a plain text 404 is returned, avoiding the
`_default_404.sql` processing. HTML-preferring clients
continue to receive the custom SQL-based 404 page.
* Extend CSP Configuration to handle user-supplied values that can contain {NONCE}
* fix RequestContext to use CSP value from AppConfig
* update documentation to describe usage
* generate nonce per request; config is a string (again); added playwright test to verify subsequent requests return a different nonce.
* fix js lint `let` -> `const`
* format
* remove some useless string copies
we are still re-parsing the csp template on every request
* implement a proper csp template struct
* parse the content-security-policy just once
* fix merge issue.
* fix docs
* fix docs
* clippy
---------
Co-authored-by: lovasoa <contact@ophir.dev>
* Update shell.handlebars
adding two options:
search_button
search_placeholder
* Update table.handlebars
adding search_placeholder option
* Update 01_documentation.sql
documentation update for the shell component options:
search_placeholder
search_button
and for the table component option: search_placeholder
* avoid failing tests on long loading map tiles
* add an example for search_placeholder
---------
Co-authored-by: lovasoa <contact@ophir.dev>
* use numbered parameters in sqlite
* implement parameter deduplication
* implement parameter re-duplication for mysql
* Improve error messages on invalid sqlpage function calls. The messages now contain actionable advice.
* simplify extract_set_variable