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.
- package/README.md +124 -30
- package/dist/browser.cjs +586 -265
- package/dist/browser.d.cts +21 -0
- package/dist/browser.d.ts +21 -0
- package/dist/browser.js +588 -263
- package/dist/client.cjs +42 -6
- package/dist/client.d.cts +71 -0
- package/dist/client.d.ts +71 -0
- package/dist/client.js +39 -4
- package/dist/cloudflare-do.cjs +462 -215
- package/dist/cloudflare-do.d.cts +111 -1
- package/dist/cloudflare-do.d.ts +111 -1
- package/dist/cloudflare-do.js +459 -213
- package/dist/cloudflare.cjs +270 -23
- package/dist/cloudflare.d.cts +276 -1
- package/dist/cloudflare.d.ts +276 -1
- package/dist/cloudflare.js +267 -21
- package/dist/codegen-v2.cjs +77 -19
- package/dist/codegen.cjs +2 -1
- package/dist/index.cjs +551 -224
- package/dist/index.d.cts +57 -1
- package/dist/index.d.ts +57 -1
- package/dist/index.js +549 -221
- package/dist/node.cjs +775 -291
- package/dist/node.d.cts +179 -1
- package/dist/node.d.ts +179 -1
- package/dist/node.js +762 -288
- package/package.json +2 -1
package/dist/browser.d.cts
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;
|
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;
|