@carllee1983/dbcli 4.0.0 → 7.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.
package/dist/cli.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  // package.json
4
4
  var package_default = {
5
5
  name: "@carllee1983/dbcli",
6
- version: "4.0.0",
6
+ version: "7.0.0",
7
7
  description: "Database CLI for AI agents",
8
8
  type: "module",
9
9
  publishConfig: {
@@ -135,7 +135,9 @@ var package_default = {
135
135
  },
136
136
  overrides: {
137
137
  "brace-expansion": "^5.0.9",
138
- postcss: "^8.5.26"
138
+ browserslist: "^4.28.7",
139
+ postcss: "^8.5.26",
140
+ "postcss-selector-parser": "^6.1.3"
139
141
  }
140
142
  };
141
143
 
package/dist/core.d.ts CHANGED
@@ -540,40 +540,65 @@ declare const SQL_DIALECTS: readonly [
540
540
  "mariadb"
541
541
  ];
542
542
  type SqlDialect = (typeof SQL_DIALECTS)[number];
543
- /**
544
- * Manager class for loading and querying blacklist rules.
545
- * Instantiate once per CLI invocation.
546
- */
547
543
  export declare class BlacklistManager {
548
544
  private config;
549
545
  private state;
550
546
  private overrideEnabled;
547
+ /** Table entries as the config wrote them, for the glob scan. */
548
+ private readonly rawTables;
551
549
  constructor(config: DbcliConfig, overrideEnvValue?: string);
552
550
  /**
553
551
  * Deserialize config.blacklist JSON into efficient Set/Map structures.
554
- * Case-insensitive table names (stored as lowercase).
555
- * Case-sensitive column names.
552
+ * Case-insensitive table names (stored as lowercase). Column entries are
553
+ * stored as written and folded where they are compared — see ADR-0018 and
554
+ * ADR-0020. Table entries are kept twice: lower-cased in `tables` for the
555
+ * exact lookup, and as written in `rawTables` for the glob scan, because
556
+ * folding a pattern's text narrows a character class.
556
557
  *
557
558
  * @returns BlacklistState with Set<string> for tables, Map<string, Set<string>> for columns
558
559
  */
559
560
  loadBlacklist(): BlacklistState;
560
561
  /**
561
562
  * Check if a table is blacklisted.
562
- * Case-insensitive comparison.
563
+ *
564
+ * Case-insensitive, and each entry is a glob: `secrets*` covers
565
+ * `secrets_2026`. The same array is already a glob for Redis keys and
566
+ * Elasticsearch index expressions, and one config file gets one answer
567
+ * (ADR-0019 Decision 4). `report\*` escapes back to a literal name.
563
568
  *
564
569
  * @param tableName Table name to check
565
570
  * @returns true if the table is blacklisted
566
571
  */
567
572
  isTableBlacklisted(tableName: string): boolean;
573
+ /**
574
+ * Table entries carrying glob metacharacters.
575
+ *
576
+ * Computed with `state` rather than lazily: `getState()` hands the same `Set`
577
+ * out, and a lazy cache filled after someone added to it would leave `Set.has`
578
+ * seeing the new entry and the glob scan not — fail-open, and silently.
579
+ * Nothing mutates it today; the point is that nothing can start to.
580
+ */
581
+ private readonly wildcardTables;
568
582
  /**
569
583
  * Check if a specific column in a table is blacklisted.
570
- * Table name is case-insensitive; column name is case-sensitive.
584
+ * Rule and name are compared case-insensitively over the whole dotted path,
585
+ * and a rule carrying a wildcard is matched through the shared matcher
586
+ * (ADR-0020).
571
587
  *
572
588
  * @param tableName Table name
573
589
  * @param columnName Column name
574
590
  * @returns true if the column is blacklisted
575
591
  */
592
+ /**
593
+ * The rules for a table, found by the reference as written and by its last
594
+ * segment. `extractTableReferences` keeps a qualified name whole, so a rule
595
+ * under `public.users` did not apply to `SELECT * FROM users` and the reverse
596
+ * was equally true. ADR-0018 Decision 3.
597
+ */
598
+ private columnRulesFor;
576
599
  isColumnBlacklisted(tableName: string, columnName: string): boolean;
600
+ private readonly foldedColumns;
601
+ private foldedColumnsFor;
577
602
  /**
578
603
  * Get all blacklisted column names for a specific table.
579
604
  *
@@ -606,6 +631,16 @@ export declare class BlacklistManager {
606
631
  interface FilterColumnsResult {
607
632
  filteredRows: Record<string, unknown>[];
608
633
  omittedColumns: string[];
634
+ /**
635
+ * Whether a caller-supplied field path is covered by what was omitted.
636
+ *
637
+ * `omittedColumns` names a wildcard rule by its text, so a consumer comparing
638
+ * strings could not tell that `--fields profile.SS_num` asks for something
639
+ * `profile.ss*` removed: the literal form of the same rule dropped the field
640
+ * from the output while the wildcard form returned it as `null`. This answers
641
+ * with the compiled rule.
642
+ */
643
+ reachesOmitted: (path: string) => boolean;
609
644
  }
610
645
  /**
611
646
  * Validator class for enforcing blacklist rules.