@lark-sh/client 0.1.15 → 0.1.17

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.
@@ -7,7 +7,7 @@ import {
7
7
  ServerValue,
8
8
  generatePushId,
9
9
  isVolatilePath
10
- } from "../chunk-EK7OYLDG.mjs";
10
+ } from "../chunk-VLAAYUVX.mjs";
11
11
 
12
12
  // src/fb-v8/index.ts
13
13
  var DatabaseReference = class _DatabaseReference {
package/dist/index.d.mts CHANGED
@@ -106,7 +106,6 @@ declare class DatabaseReference {
106
106
  * For queries (created via orderBy*, limitTo*, startAt, etc.), this returns
107
107
  * a reference to the same path without query constraints.
108
108
  * For non-query references, this returns the reference itself.
109
- * This matches Firebase's Query.ref behavior.
110
109
  */
111
110
  get ref(): DatabaseReference;
112
111
  /**
@@ -121,12 +120,12 @@ declare class DatabaseReference {
121
120
  * Returns "default" for non-query references (no constraints).
122
121
  * Returns a sorted JSON string of wire-format params for queries.
123
122
  *
124
- * This matches Firebase's queryIdentifier format for wire compatibility.
123
+ * Used for wire protocol and subscription deduplication.
125
124
  */
126
125
  get queryIdentifier(): string;
127
126
  /**
128
127
  * Get the data at this location. Alias for once('value').
129
- * This is Firebase's newer API for reading data.
128
+ * Alternative to once('value') for reading data.
130
129
  */
131
130
  get(): Promise<DataSnapshot>;
132
131
  /**
@@ -145,7 +144,7 @@ declare class DatabaseReference {
145
144
  /**
146
145
  * Update specific children at this location without overwriting other children.
147
146
  *
148
- * Also supports Firebase-style multi-path updates when keys look like paths
147
+ * Also supports multi-path updates when keys look like paths
149
148
  * (start with '/'). In this mode, each path is written atomically as a transaction.
150
149
  *
151
150
  * @example
@@ -201,7 +200,7 @@ declare class DatabaseReference {
201
200
  * For objects: injects `.priority` into the value object.
202
201
  * For primitives: wraps as `{ '.value': primitive, '.priority': priority }`.
203
202
  *
204
- * This follows Firebase's wire format for primitives with priority.
203
+ * Uses { '.value': value, '.priority': priority } format for the wire protocol.
205
204
  *
206
205
  * @param value - The value to write
207
206
  * @param priority - The priority for ordering
@@ -335,9 +334,8 @@ declare class DatabaseReference {
335
334
  */
336
335
  private _validateQueryValue;
337
336
  /**
338
- * Validate that a key is a valid Firebase key format.
339
- * Invalid characters: . $ # [ ] /
340
- * Also cannot start or end with .
337
+ * Validate that a key is a valid key format.
338
+ * Delegates to the shared validation utility.
341
339
  */
342
340
  private _validateKeyFormat;
343
341
  /**
@@ -358,7 +356,7 @@ declare class DatabaseReference {
358
356
  /**
359
357
  * A reference that is also a Promise - returned by push().
360
358
  *
361
- * This allows Firebase-compatible patterns like:
359
+ * This allows patterns like:
362
360
  * ```javascript
363
361
  * const pushed = ref.push();
364
362
  * console.log(pushed.key); // Key available immediately
@@ -423,12 +421,10 @@ type TxOperation = TxSetOp | TxUpdateOp | TxDeleteOp | TxConditionOp;
423
421
  * - Priority is stored as a regular child value `.priority` in the data
424
422
  * - val() strips `.priority` from returned objects (so app code doesn't see it)
425
423
  * - getPriority() reads from the data's `.priority` field
426
- * - This matches Firebase behavior where priority is metadata, not user data
427
424
  *
428
425
  * Wrapped Primitives:
429
426
  * - Primitives with priority are stored as `{ '.value': x, '.priority': y }`
430
427
  * - val() automatically unwraps these to return just the primitive value
431
- * - This follows Firebase's wire format for primitives with priority
432
428
  */
433
429
 
434
430
  declare class DataSnapshot {
@@ -479,9 +475,9 @@ declare class DataSnapshot {
479
475
  * Get a child snapshot at the specified path.
480
476
  *
481
477
  * Special handling:
482
- * - `.priority` returns the priority value (Firebase compatible)
478
+ * - `.priority` returns the priority value
483
479
  * - For wrapped primitives, only `.priority` returns data; other paths return null
484
- * - Non-existent paths return a snapshot with val() === null (Firebase compatible)
480
+ * - Non-existent paths return a snapshot with val() === null
485
481
  */
486
482
  child(path: string): DataSnapshot;
487
483
  /**
@@ -517,14 +513,12 @@ declare class DataSnapshot {
517
513
  getPriority(): number | string | null;
518
514
  /**
519
515
  * Check if this snapshot was from a volatile (high-frequency) update.
520
- * This is a Lark extension not present in Firebase.
521
516
  */
522
517
  isVolatile(): boolean;
523
518
  /**
524
519
  * Get the server timestamp for this snapshot (milliseconds since Unix epoch).
525
520
  * Only present on volatile value events. Use deltas between timestamps for
526
521
  * interpolation rather than absolute times to avoid clock sync issues.
527
- * This is a Lark extension not present in Firebase.
528
522
  */
529
523
  getServerTimestamp(): number | null;
530
524
  /**
@@ -571,8 +565,8 @@ interface ConnectOptions {
571
565
  token?: string;
572
566
  /** Connect anonymously (server assigns a UID) */
573
567
  anonymous?: boolean;
574
- /** Coordinator URL (default: https://db.lark.dev) */
575
- coordinator?: string;
568
+ /** Lark domain (default: larkdb.net) */
569
+ domain?: string;
576
570
  /**
577
571
  * Transport type preference.
578
572
  * - 'auto': Try WebTransport first, fall back to WebSocket (default)
@@ -712,7 +706,7 @@ declare class LarkDatabase {
712
706
  private _state;
713
707
  private _auth;
714
708
  private _databaseId;
715
- private _coordinatorUrl;
709
+ private _domain;
716
710
  private _volatilePaths;
717
711
  private _transportType;
718
712
  private _currentToken;
@@ -790,7 +784,7 @@ declare class LarkDatabase {
790
784
  * Connect to a database.
791
785
  *
792
786
  * @param databaseId - Database ID in format "project/database"
793
- * @param options - Connection options (token, anonymous, coordinator URL)
787
+ * @param options - Connection options (token, anonymous, domain)
794
788
  */
795
789
  connect(databaseId: string, options?: ConnectOptions): Promise<void>;
796
790
  /**
@@ -872,7 +866,7 @@ declare class LarkDatabase {
872
866
  *
873
867
  * Supports two syntaxes:
874
868
  *
875
- * **Object syntax** (like Firebase multi-path update):
869
+ * **Object syntax** (multi-path update):
876
870
  * ```javascript
877
871
  * await db.transaction({
878
872
  * '/users/alice/name': 'Alice',
@@ -1146,7 +1140,7 @@ declare class PendingWriteManager {
1146
1140
  }
1147
1141
 
1148
1142
  /**
1149
- * Push ID generation - Firebase-compatible chronologically-sortable IDs.
1143
+ * Push ID generation - chronologically-sortable unique IDs.
1150
1144
  *
1151
1145
  * Format: 20 characters
1152
1146
  * - First 8 chars: timestamp (milliseconds since epoch, base64-encoded)
@@ -1157,7 +1151,7 @@ declare class PendingWriteManager {
1157
1151
  * - IDs created in the same millisecond are unique and still sort correctly
1158
1152
  */
1159
1153
  /**
1160
- * Generate a Firebase-compatible push ID.
1154
+ * Generate a unique push ID.
1161
1155
  */
1162
1156
  declare function generatePushId(): string;
1163
1157
 
package/dist/index.d.ts CHANGED
@@ -106,7 +106,6 @@ declare class DatabaseReference {
106
106
  * For queries (created via orderBy*, limitTo*, startAt, etc.), this returns
107
107
  * a reference to the same path without query constraints.
108
108
  * For non-query references, this returns the reference itself.
109
- * This matches Firebase's Query.ref behavior.
110
109
  */
111
110
  get ref(): DatabaseReference;
112
111
  /**
@@ -121,12 +120,12 @@ declare class DatabaseReference {
121
120
  * Returns "default" for non-query references (no constraints).
122
121
  * Returns a sorted JSON string of wire-format params for queries.
123
122
  *
124
- * This matches Firebase's queryIdentifier format for wire compatibility.
123
+ * Used for wire protocol and subscription deduplication.
125
124
  */
126
125
  get queryIdentifier(): string;
127
126
  /**
128
127
  * Get the data at this location. Alias for once('value').
129
- * This is Firebase's newer API for reading data.
128
+ * Alternative to once('value') for reading data.
130
129
  */
131
130
  get(): Promise<DataSnapshot>;
132
131
  /**
@@ -145,7 +144,7 @@ declare class DatabaseReference {
145
144
  /**
146
145
  * Update specific children at this location without overwriting other children.
147
146
  *
148
- * Also supports Firebase-style multi-path updates when keys look like paths
147
+ * Also supports multi-path updates when keys look like paths
149
148
  * (start with '/'). In this mode, each path is written atomically as a transaction.
150
149
  *
151
150
  * @example
@@ -201,7 +200,7 @@ declare class DatabaseReference {
201
200
  * For objects: injects `.priority` into the value object.
202
201
  * For primitives: wraps as `{ '.value': primitive, '.priority': priority }`.
203
202
  *
204
- * This follows Firebase's wire format for primitives with priority.
203
+ * Uses { '.value': value, '.priority': priority } format for the wire protocol.
205
204
  *
206
205
  * @param value - The value to write
207
206
  * @param priority - The priority for ordering
@@ -335,9 +334,8 @@ declare class DatabaseReference {
335
334
  */
336
335
  private _validateQueryValue;
337
336
  /**
338
- * Validate that a key is a valid Firebase key format.
339
- * Invalid characters: . $ # [ ] /
340
- * Also cannot start or end with .
337
+ * Validate that a key is a valid key format.
338
+ * Delegates to the shared validation utility.
341
339
  */
342
340
  private _validateKeyFormat;
343
341
  /**
@@ -358,7 +356,7 @@ declare class DatabaseReference {
358
356
  /**
359
357
  * A reference that is also a Promise - returned by push().
360
358
  *
361
- * This allows Firebase-compatible patterns like:
359
+ * This allows patterns like:
362
360
  * ```javascript
363
361
  * const pushed = ref.push();
364
362
  * console.log(pushed.key); // Key available immediately
@@ -423,12 +421,10 @@ type TxOperation = TxSetOp | TxUpdateOp | TxDeleteOp | TxConditionOp;
423
421
  * - Priority is stored as a regular child value `.priority` in the data
424
422
  * - val() strips `.priority` from returned objects (so app code doesn't see it)
425
423
  * - getPriority() reads from the data's `.priority` field
426
- * - This matches Firebase behavior where priority is metadata, not user data
427
424
  *
428
425
  * Wrapped Primitives:
429
426
  * - Primitives with priority are stored as `{ '.value': x, '.priority': y }`
430
427
  * - val() automatically unwraps these to return just the primitive value
431
- * - This follows Firebase's wire format for primitives with priority
432
428
  */
433
429
 
434
430
  declare class DataSnapshot {
@@ -479,9 +475,9 @@ declare class DataSnapshot {
479
475
  * Get a child snapshot at the specified path.
480
476
  *
481
477
  * Special handling:
482
- * - `.priority` returns the priority value (Firebase compatible)
478
+ * - `.priority` returns the priority value
483
479
  * - For wrapped primitives, only `.priority` returns data; other paths return null
484
- * - Non-existent paths return a snapshot with val() === null (Firebase compatible)
480
+ * - Non-existent paths return a snapshot with val() === null
485
481
  */
486
482
  child(path: string): DataSnapshot;
487
483
  /**
@@ -517,14 +513,12 @@ declare class DataSnapshot {
517
513
  getPriority(): number | string | null;
518
514
  /**
519
515
  * Check if this snapshot was from a volatile (high-frequency) update.
520
- * This is a Lark extension not present in Firebase.
521
516
  */
522
517
  isVolatile(): boolean;
523
518
  /**
524
519
  * Get the server timestamp for this snapshot (milliseconds since Unix epoch).
525
520
  * Only present on volatile value events. Use deltas between timestamps for
526
521
  * interpolation rather than absolute times to avoid clock sync issues.
527
- * This is a Lark extension not present in Firebase.
528
522
  */
529
523
  getServerTimestamp(): number | null;
530
524
  /**
@@ -571,8 +565,8 @@ interface ConnectOptions {
571
565
  token?: string;
572
566
  /** Connect anonymously (server assigns a UID) */
573
567
  anonymous?: boolean;
574
- /** Coordinator URL (default: https://db.lark.dev) */
575
- coordinator?: string;
568
+ /** Lark domain (default: larkdb.net) */
569
+ domain?: string;
576
570
  /**
577
571
  * Transport type preference.
578
572
  * - 'auto': Try WebTransport first, fall back to WebSocket (default)
@@ -712,7 +706,7 @@ declare class LarkDatabase {
712
706
  private _state;
713
707
  private _auth;
714
708
  private _databaseId;
715
- private _coordinatorUrl;
709
+ private _domain;
716
710
  private _volatilePaths;
717
711
  private _transportType;
718
712
  private _currentToken;
@@ -790,7 +784,7 @@ declare class LarkDatabase {
790
784
  * Connect to a database.
791
785
  *
792
786
  * @param databaseId - Database ID in format "project/database"
793
- * @param options - Connection options (token, anonymous, coordinator URL)
787
+ * @param options - Connection options (token, anonymous, domain)
794
788
  */
795
789
  connect(databaseId: string, options?: ConnectOptions): Promise<void>;
796
790
  /**
@@ -872,7 +866,7 @@ declare class LarkDatabase {
872
866
  *
873
867
  * Supports two syntaxes:
874
868
  *
875
- * **Object syntax** (like Firebase multi-path update):
869
+ * **Object syntax** (multi-path update):
876
870
  * ```javascript
877
871
  * await db.transaction({
878
872
  * '/users/alice/name': 'Alice',
@@ -1146,7 +1140,7 @@ declare class PendingWriteManager {
1146
1140
  }
1147
1141
 
1148
1142
  /**
1149
- * Push ID generation - Firebase-compatible chronologically-sortable IDs.
1143
+ * Push ID generation - chronologically-sortable unique IDs.
1150
1144
  *
1151
1145
  * Format: 20 characters
1152
1146
  * - First 8 chars: timestamp (milliseconds since epoch, base64-encoded)
@@ -1157,7 +1151,7 @@ declare class PendingWriteManager {
1157
1151
  * - IDs created in the same millisecond are unique and still sort correctly
1158
1152
  */
1159
1153
  /**
1160
- * Generate a Firebase-compatible push ID.
1154
+ * Generate a unique push ID.
1161
1155
  */
1162
1156
  declare function generatePushId(): string;
1163
1157