@mlagie/sql-connector 2.0.8 → 2.0.10

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/releases/2.0.6.md DELETED
@@ -1,80 +0,0 @@
1
- # Release v2.0.6 — Architectural Property Isolation, Query Defusal & Test Coverage Expansion
2
-
3
- This emergency structural release addresses a critical data-shadowing bug within the `ModelInstance` hydration cycle where active database column values (e.g., fields named `name`, `schema`, or `data`) overrode the core internal engine structures, mangling runtime query generation. It also introduces a comprehensive overhaul of the test suite to secure maximum coverage.
4
-
5
- ## 🛠️ The Bug Defusal (Why this was critical)
6
-
7
- When `ModelInstance` mapped rows dynamically into getters/setters, a column named `name` from the database would mask `this.name` (the structural reference to the SQL Table Name).
8
-
9
- As a result, an injection or ingestion update would mistakenly compile syntax failures like:
10
-
11
- ```sql
12
- UPDATE my_value SET `deletedAt` = ... -- Mangled: Used row data instead of Table Name
13
- ```
14
-
15
- By migrating all runtime configuration tokens to protected underscored properties (`_tableName`, `_data`, `_schema`), the instance context is now completely hermetic against database row schema payloads.
16
-
17
- ## Massive Test Coverage Expansion
18
-
19
- To ensure the stability and robustness of this release, the unit test suites for both `Model` and `ModelInstance` have been significantly hardened:
20
-
21
- - **Edge-Case & Fallback Testing**: Added specialized tests to force controlled failures in deep `try/catch` blocks, guaranteeing that the global engine fallback workflows function flawlessly under corrupted data scenarios.
22
-
23
- - **SQL Mechanics Validation**: Built targeted unit tests covering schema dictionary mismatches, complex conditional mapping (e.g., table joins filtering mixed array types), and secondary logic paths inside `updateOne()`, `delete()`, and `deleteOne()`.
24
-
25
- - `Database Simulation Coverage`: Implemented strict simulation sequences verifying UUID collision rejections (ensuring `generate_uuid()` handles duplicates properly) and missing response payloads (such as undefined `affectedRows`).
26
-
27
- - `Zero-Crash Guarantees`: Hardened utility methods like `getFieldType()` against historical JavaScript edge cases (such as parsing `null` values safely).
28
-
29
- ## What Was Improved
30
-
31
- - `Protected Context Isolation`: Migrated core metadata targets in `ModelInstance.js` to `_tableName`, `_data`, and `_schema`. Database columns can no longer shadow engine properties.
32
-
33
- - `Tiret/Hyphen Database Safety`: Wrapped table calls explicitly in SQL backticks (\`) inside `updateOne`, `delete`, and `deleteOne` routines. Tables named with hyphens (like my_value) no longer trigger syntax violations.
34
-
35
- - **Rehydration Mapping Consistency**: Standardized downstream sub-instantiations (like `customRequest`) to feed data strictly using the isolated `_tableName` descriptor.
36
-
37
- ## File Blueprint Updates
38
-
39
- `ModelInstance.js`
40
-
41
- The updated architecture encapsulates the internal core parameters like this:
42
-
43
- ```js
44
- class ModelInstance {
45
- constructor(name, data, schema = null) {
46
- Object.defineProperties(this, {
47
- _tableName: { // 🔒 Fully protected from row data collisions
48
- value: name,
49
- writable: true,
50
- configurable: true,
51
- enumerable: false
52
- },
53
- _data: {
54
- value: data,
55
- writable: true,
56
- configurable: true,
57
- enumerable: true
58
- },
59
- _schema: {
60
- value: schema,
61
- writable: true,
62
- configurable: true,
63
- enumerable: false
64
- }
65
- });
66
-
67
- // Dynamic row mapping safely bound without property leakage...
68
- }
69
-
70
- async updateOne(model) {
71
- const setClause = generateCondition(formatObject(model), true);
72
- let whereClause = /* ... evaluation matrix using this._schema & this.getRecordData() ... */;
73
-
74
- // Encapsulated Table execution with explicit backticks
75
- const sql_request = `UPDATE \`${this._tableName}\` SET ${setClause} WHERE ${whereClause}`;
76
-
77
- // ... execute transaction safely
78
- }
79
- }
80
- ```
package/releases/2.0.7.md DELETED
@@ -1,38 +0,0 @@
1
- # Release v2.0.7 — COUNT Polymorphism, Aggregation Alias Security & Test Coverage Overhaul
2
-
3
- This major release upgrades the query engine by introducing full polymorphic support for the `COUNT` aggregation function (supporting standard, multi-column distinct, and conditional `CASE WHEN` operations). It also fixes a key-aliasing limitation during raw aggregations and strengthens query-building validation boundaries through an extensive unit testing overhaul.
4
-
5
- ## COUNT Polymorphism (Why this evolution matters)
6
-
7
- Previously, the query engine only accepted a raw string parameter for `COUNT` instructions. The engine now dynamically evaluates three distinct structures (String, Array, Object) passed directly from your selection attributes:
8
-
9
- - **Multi-Column Distinct Counting**: Passing an array automatically compiles a unified multi-column unique combination statement, removing the need for manual raw SQL workarounds.
10
-
11
- - **Conditional Counting (`CASE WHEN`)**: Passing a key/value object cleanly compiles a conditional statement. This allows you to isolate state and status indicators (KPIs) in a single database round-trip without twisting your global query filters.
12
-
13
- As a result, complex nullity checks or status distributions are generated natively:
14
-
15
- ```js
16
- -- Automated nullity indicator compilation example:
17
- COUNT(CASE WHEN `deletedAt` = NULL THEN 1 END)
18
- ```
19
-
20
- ## Test Coverage Expansion
21
-
22
- To guarantee the stability of these new mechanics and prevent structural regressions, the global unit testing footprint has been exhaustively expanded:
23
-
24
- - **Multi-Count Validation**: Added dedicated test pipelines ensuring the syntax of `COUNT(DISTINCT column1, column2)` is perfectly isolated from standard counters.
25
-
26
- - **Temporal Nullity Filtering**: Implemented test scenarios covering both `{ deletedAt: null }` and `{ deletedAt: "NOT NULL" }` parameters to verify string state evaluations.
27
-
28
- - **Unsupported Input Interception**: Added strict `throw new Error` type boundaries to guarantee that injecting non-compliant values (like booleans or numbers) results in a clean, controlled application crash.
29
-
30
- - **Zero-Leak Key Assurances**: Added strict payload assertions ensuring no raw unmapped backticked SQL expressions can escape into the final Node.js JSON output object.
31
-
32
- ## What Was Improved
33
-
34
- - **Automatic Aggregation Fallback Alias**: Enhanced the `buildField` logic inside `buildQuery.js`. If an explicit `as` descriptor is omitted during a column sum (sum), the engine automatically fallbacks to using the targeted column name as the extraction property, blocking raw SQL formula leaks into the final row keys.
35
-
36
- - **Orchestrated Order Sorting**: Hardened the `options.orderBy` evaluator array loop to cleanly isolate and support both raw column identifier strings and structured sorting configuration objects `{ field, direction }`.
37
-
38
- Documentation Cleanup: Fully aligned the core developer usage guide and documentation files within `README.md` to reflect the updated parameter boundaries and capabilities.
package/releases/2.0.8.md DELETED
@@ -1,5 +0,0 @@
1
- # Release v2.0.8 — Changed
2
-
3
- - Updated maintainer username references across the project.
4
- - No functional changes.
5
- - No API changes.
package/socket.yml DELETED
@@ -1,4 +0,0 @@
1
- version: 2
2
- project:
3
- # Masquer les alertes des outils de dev/test dans le rapport
4
- ignoreDevDependencies: true