Skip to content

Commit 2151eca

Browse files
Merge
2 parents c417b06 + 137b21b commit 2151eca

File tree

6 files changed

+21
-22
lines changed

6 files changed

+21
-22
lines changed

packages/database/index.node.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ import { Database } from './src/api/Database';
2828
import * as INTERNAL from './src/api/internal';
2929
import { DataSnapshot, Query, Reference } from './src/api/Reference';
3030
import * as TEST_ACCESS from './src/api/test_access';
31-
import { enableLogging } from './src/core/util/util';
3231
import { setSDKVersion } from './src/core/version';
33-
import { repoManagerDatabaseFromApp } from './src/exp/Database';
32+
import { enableLogging, repoManagerDatabaseFromApp } from './src/exp/Database';
3433
import { setWebSocketImpl } from './src/realtime/WebSocketConnection';
3534

3635
setWebSocketImpl(Client);

packages/database/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ import { Database } from './src/api/Database';
2828
import * as INTERNAL from './src/api/internal';
2929
import { DataSnapshot, Query, Reference } from './src/api/Reference';
3030
import * as TEST_ACCESS from './src/api/test_access';
31-
import { enableLogging } from './src/core/util/util';
3231
import { setSDKVersion } from './src/core/version';
33-
import { repoManagerDatabaseFromApp } from './src/exp/Database';
32+
import { enableLogging, repoManagerDatabaseFromApp } from './src/exp/Database';
3433

3534
const ServerValue = Database.ServerValue;
3635

packages/database/src/api/Database.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
goOffline
2828
} from '../exp/Database';
2929
import { ref, refFromURL } from '../exp/Reference_impl';
30+
import { increment, serverTimestamp } from '../exp/ServerValue';
3031

3132
import { Reference } from './Reference';
3233

@@ -35,16 +36,8 @@ import { Reference } from './Reference';
3536
*/
3637
export class Database implements FirebaseService, Compat<ExpDatabase> {
3738
static readonly ServerValue = {
38-
TIMESTAMP: {
39-
'.sv': 'timestamp'
40-
},
41-
increment: (delta: number) => {
42-
return {
43-
'.sv': {
44-
'increment': delta
45-
}
46-
};
47-
}
39+
TIMESTAMP: serverTimestamp(),
40+
increment: (delta: number) => increment(delta)
4841
};
4942

5043
/**

packages/database/src/exp/Database.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ import { Repo, repoInterrupt, repoResume, repoStart } from '../core/Repo';
3030
import { RepoInfo } from '../core/RepoInfo';
3131
import { parseRepoInfo } from '../core/util/libs/parser';
3232
import { newEmptyPath, pathIsEmpty } from '../core/util/Path';
33-
import { fatal, log } from '../core/util/util';
33+
import {
34+
fatal,
35+
log,
36+
enableLogging as enableLoggingImpl
37+
} from '../core/util/util';
3438
import { validateUrl } from '../core/util/validation';
3539

3640
import { ReferenceImpl } from './Reference_impl';
@@ -290,6 +294,5 @@ export function enableLogging(
290294
logger?: boolean | ((message: string) => unknown),
291295
persistent?: boolean
292296
): void {
293-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
294-
return {} as any;
297+
enableLoggingImpl(logger, persistent);
295298
}

packages/database/src/exp/Reference_impl.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,6 @@ export function setWithPriority(
471471
validateWritablePath('setWithPriority', ref._path);
472472
validateFirebaseDataArg('setWithPriority', value, ref._path, false);
473473
validatePriority('setWithPriority', priority, false);
474-
475474
if (ref.key === '.length' || ref.key === '.keys') {
476475
throw 'setWithPriority failed: ' + ref.key + ' is a read-only object.';
477476
}

packages/database/src/exp/ServerValue.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,18 @@
1515
* limitations under the License.
1616
*/
1717

18+
const SERVER_TIMESTAMP = {
19+
'.sv': 'timestamp'
20+
};
21+
1822
export function serverTimestamp(): object {
19-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
20-
return {} as any;
23+
return SERVER_TIMESTAMP;
2124
}
2225

2326
export function increment(delta: number): object {
24-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
25-
return {} as any;
27+
return {
28+
'.sv': {
29+
'increment': delta
30+
}
31+
};
2632
}

0 commit comments

Comments
 (0)