Skip to content

Commit 7507f02

Browse files
committed
fix: expose ServerValue
1 parent 708e8b3 commit 7507f02

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

packages/database/__tests__/database.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import database, {
4646
push,
4747
remove,
4848
update,
49+
ServerValue,
4950
} from '../lib';
5051

5152
// @ts-ignore - no declaration file for DatabaseStatics
@@ -425,7 +426,7 @@ describe('Database', function () {
425426
describe('statics', function () {
426427
it('ServerValue', function () {
427428
staticsV9Deprecation(
428-
() => DatabaseStatics.ServerValue,
429+
() => ServerValue,
429430
() => firebase.database.ServerValue,
430431
'ServerValue',
431432
);

packages/database/lib/modular/index.d.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,20 @@ export function getServerTime(db: Database): Promise<number>;
220220
*/
221221
export function increment(delta: number): object;
222222

223+
/**
224+
* Server specific values.
225+
*/
226+
export const ServerValue: {
227+
/**
228+
* A placeholder value for auto-populating the current timestamp.
229+
*/
230+
TIMESTAMP: object;
231+
/**
232+
* Returns a placeholder value that can be used to atomically increment the current database value.
233+
*/
234+
increment(delta: number): object;
235+
};
236+
223237
/**
224238
* Logs debugging information to the console. Not implemented on native.
225239
*

packages/database/lib/modular/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ export function increment(delta) {
124124
return ServerValue.increment.call(ServerValue, delta, MODULAR_DEPRECATION_ARG);
125125
}
126126

127+
export { ServerValue };
128+
127129
export function enableLogging(_enabled, _persistent) {
128130
throw new Error('enableLogging() is not implemented');
129131
}

0 commit comments

Comments
 (0)