Skip to content

Commit 3afa731

Browse files
Copilothuangyiirene
andcommitted
Address code review feedback - improve error handling and documentation
Co-authored-by: huangyiirene <[email protected]>
1 parent e119286 commit 3afa731

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

packages/drivers/fs/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
"license": "MIT",
1515
"main": "dist/index.js",
1616
"types": "dist/index.d.ts",
17+
"files": [
18+
"dist",
19+
"README.md",
20+
"CHANGELOG.md",
21+
"package.json"
22+
],
1723
"scripts": {
1824
"build": "tsc",
1925
"test": "jest"

packages/drivers/fs/src/index.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,13 @@ export class FileSystemDriver implements Driver {
421421

422422
/**
423423
* Apply filters to an array of records.
424+
*
425+
* Supports ObjectQL filter format with logical operators (AND/OR):
426+
* [
427+
* ['field', 'operator', value],
428+
* 'or',
429+
* ['field2', 'operator', value2]
430+
* ]
424431
*/
425432
private applyFilters(records: any[], filters: any[]): any[] {
426433
if (!filters || filters.length === 0) {
@@ -463,7 +470,7 @@ export class FileSystemDriver implements Driver {
463470
}
464471

465472
let result = conditions[0];
466-
for (let i = 0; i < operators.length; i++) {
473+
for (let i = 0; i < operators.length && i + 1 < conditions.length; i++) {
467474
const op = operators[i];
468475
const nextCondition = conditions[i + 1];
469476

@@ -578,6 +585,8 @@ export class FileSystemDriver implements Driver {
578585

579586
/**
580587
* Generate a unique ID for a record.
588+
* Uses timestamp + counter for uniqueness.
589+
* Note: For production use with high-frequency writes, consider using crypto.randomUUID().
581590
*/
582591
private generateId(objectName: string): string {
583592
const counter = (this.idCounters.get(objectName) || 0) + 1;

0 commit comments

Comments
 (0)