js-bao 0.5.1 → 0.5.2

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.
@@ -664,6 +664,27 @@ declare class BaseModel implements StringSetChangeTracker {
664
664
  */
665
665
  static count(this: new (...args: any[]) => any, filter?: DocumentFilter, options?: Pick<QueryOptions, "documents">): Promise<number>;
666
666
  static findAll<T extends BaseModel>(this: new (...args: any[]) => T): Promise<T[]>;
667
+ /**
668
+ * Resolve a record by its unique-constraint field values via an engine query.
669
+ * Used as a fallback when the `_uniqueIdx_<model>_<constraint>` map has no
670
+ * entry for a key.
671
+ *
672
+ * The index map is a cache over the SQLite projection, not the source of
673
+ * truth: every record is loaded into the projection on `initializeForDocument`
674
+ * regardless of index presence, but a record written by a client predating
675
+ * index maintenance (legacy data) is missing from the index. Such a record
676
+ * silently escapes both `upsertByUnique` lookups and the `save()` uniqueness
677
+ * check. A query over the constraint fields finds it reliably.
678
+ *
679
+ * Contract: RESOLVE ONLY. Returns the owning record (with `_metaDocId` set to
680
+ * the document that holds it, via `queryOne`) or `null`. Callers decide
681
+ * whether to heal the missing index entry (write paths) and do their own
682
+ * logging — this method never mutates the index, so read paths stay
683
+ * read-only. Mirrors `buildUniqueKey`: a null/undefined value in any
684
+ * constraint field means the record does not participate in the constraint,
685
+ * so no query runs.
686
+ */
687
+ private static _resolveByUniqueFallback;
667
688
  static findByUnique<T extends BaseModel>(this: typeof BaseModel & (new (...args: any[]) => T), constraintName: string, value: any | any[]): Promise<T | null>;
668
689
  static upsertByUnique<T extends BaseModel>(this: typeof BaseModel & (new (...args: any[]) => T), constraintName: string, uniqueLookupValue: any | any[], dataToUpsert: Partial<Omit<InstanceType<new (...args: any[]) => T>, keyof BaseModel | "toJSON">> & {
669
690
  id?: string;
package/dist/browser.d.ts CHANGED
@@ -664,6 +664,27 @@ declare class BaseModel implements StringSetChangeTracker {
664
664
  */
665
665
  static count(this: new (...args: any[]) => any, filter?: DocumentFilter, options?: Pick<QueryOptions, "documents">): Promise<number>;
666
666
  static findAll<T extends BaseModel>(this: new (...args: any[]) => T): Promise<T[]>;
667
+ /**
668
+ * Resolve a record by its unique-constraint field values via an engine query.
669
+ * Used as a fallback when the `_uniqueIdx_<model>_<constraint>` map has no
670
+ * entry for a key.
671
+ *
672
+ * The index map is a cache over the SQLite projection, not the source of
673
+ * truth: every record is loaded into the projection on `initializeForDocument`
674
+ * regardless of index presence, but a record written by a client predating
675
+ * index maintenance (legacy data) is missing from the index. Such a record
676
+ * silently escapes both `upsertByUnique` lookups and the `save()` uniqueness
677
+ * check. A query over the constraint fields finds it reliably.
678
+ *
679
+ * Contract: RESOLVE ONLY. Returns the owning record (with `_metaDocId` set to
680
+ * the document that holds it, via `queryOne`) or `null`. Callers decide
681
+ * whether to heal the missing index entry (write paths) and do their own
682
+ * logging — this method never mutates the index, so read paths stay
683
+ * read-only. Mirrors `buildUniqueKey`: a null/undefined value in any
684
+ * constraint field means the record does not participate in the constraint,
685
+ * so no query runs.
686
+ */
687
+ private static _resolveByUniqueFallback;
667
688
  static findByUnique<T extends BaseModel>(this: typeof BaseModel & (new (...args: any[]) => T), constraintName: string, value: any | any[]): Promise<T | null>;
668
689
  static upsertByUnique<T extends BaseModel>(this: typeof BaseModel & (new (...args: any[]) => T), constraintName: string, uniqueLookupValue: any | any[], dataToUpsert: Partial<Omit<InstanceType<new (...args: any[]) => T>, keyof BaseModel | "toJSON">> & {
669
690
  id?: string;