refactor(ktl-api): unify bulk batch execution + standardize progress and logging#587
refactor(ktl-api): unify bulk batch execution + standardize progress and logging#587
Conversation
…retry/429 handling rename child record APIs to getChildRecords and getAllChildRecords extract shared bulk helpers (_buildBatchContext, _runBatchWorkers, _logBatchSummary, _logBatchFailures) refactor createRecords, updateRecords, and deleteRecords to use bounded worker scheduling with early stop behavior improve processAutomatedBulkOps promise wiring in concurrent PUT path split bulk error codes for clearer triage (KEC_1028 create, KEC_1029 update, KEC_1030 delete, KEC_1031 tags) make bulk edit and copy progress both count up (X of total) for UX consistency
Enhances robustness of bulk operations by adding checks for missing source rows and records. Provides clear user feedback with error popups and logs, helping users retry after view load. Facilitates debugging for developers when errors occur.
Introduces detailed reference for the Knack REST helper, clarifying available methods, bulk operation behaviors, retry and rate-limit logic, configuration options, and usage patterns.
Switches API and documentation references from a field key to a connection slug for fetching child records. Improves clarity and aligns parameter naming with connection semantics.
Consolidates view refresh handling by inlining single-view refresh logic and eliminating a redundant helper. Ensures consistent error handling and streamlines code for maintainability.
Introduces new helpers to upload files and images as assets and link them to records, enabling auto-upload of File/Blob fields during record creation. Adds options for field allow-lists and per-field asset type overrides, streamlining workflows involving file or image attachments. Improves API usability and reduces manual handling of asset uploads.
PR #587 —
|
Co-authored-by: CSWinnall <10554243+CSWinnall@users.noreply.github.com>
…Records, ergonomic cleanup Co-authored-by: CSWinnall <10554243+CSWinnall@users.noreply.github.com>
… all batch methods Co-authored-by: CSWinnall <10554243+CSWinnall@users.noreply.github.com>
…cution refactor(ktl-api): unify bulk batch execution, parallel fetch, keyword cache, ergonomic cleanup
Enhances record filtering logic for greater flexibility and correctness, ensures concurrent GET requests are deduplicated with timeout awareness, and improves error reporting for API requests by handling more response shapes and clarifying missing response bodies. Enables automatic asset uploads in bulk record operations for smoother workflows.
|
Does this PR address this issue? |
Updated Review — Post-Copilot Fixes (PR #590)Re-reviewed after the Copilot fix commit ( Original Issues — Status
Issue 1 is the only original concern that remains unresolved. External code using New Issues FoundMedium PriorityA. When callers pass mergedFilters = { match: 'and', rules: [baseRule, ...opts.filters.rules] };This turns the caller's OR conditions into AND conditions. Fix: always nest the caller's filter as a single sub-rule instead of spreading: mergedFilters = { match: 'and', rules: [baseRule, opts.filters] };(The B. In const batchResults = await Promise.all(
pageNumbers.map(page => this.getRecords(viewId, { ...pageOpts, page }))
);If any single page fails, the entire accumulated result is lost — records from previously successful batches are discarded. The remaining in-flight fetches in that batch continue running (consuming rate limit) but their results are thrown away. Consider Low PriorityC.
D. Dead The check E. The check F. No file size validation in Any What Looks Good
Recommended before merge: Fix Issue 1 (backward-compat shim) and Issue A (filter merge). The rest can be addressed post-merge. |
|
Correction on Issue A ( Knack's filter API only supports a single Downgrading from medium to not an issue. The combination of |
|
Correction on Issue 1 (backward-compat shim for renamed methods): Dropping this — no external consumers use Updated summary of remaining items:
|
rename child record APIs to getChildRecords and getAllChildRecords extract shared bulk helpers (_buildBatchContext, _runBatchWorkers, _logBatchSummary, _logBatchFailures) refactor createRecords, updateRecords, and deleteRecords to use bounded worker scheduling with early stop behavior improve processAutomatedBulkOps promise wiring in concurrent PUT path split bulk error codes for clearer triage (KEC_1028 create, KEC_1029 update, KEC_1030 delete, KEC_1031 tags) make bulk edit and copy progress both count up (X of total) for UX consistency