@react-native-firebase/database 24.1.1 → 25.0.1

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.
Files changed (126) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/module/DatabaseDataSnapshot.js +144 -0
  3. package/dist/module/DatabaseDataSnapshot.js.map +1 -0
  4. package/dist/module/DatabaseOnDisconnect.js +84 -0
  5. package/dist/module/DatabaseOnDisconnect.js.map +1 -0
  6. package/dist/module/DatabaseQuery.js +298 -0
  7. package/dist/module/DatabaseQuery.js.map +1 -0
  8. package/{lib → dist/module}/DatabaseQueryModifiers.js +49 -98
  9. package/dist/module/DatabaseQueryModifiers.js.map +1 -0
  10. package/dist/module/DatabaseReference.js +169 -0
  11. package/dist/module/DatabaseReference.js.map +1 -0
  12. package/dist/module/DatabaseStatics.js +35 -0
  13. package/dist/module/DatabaseStatics.js.map +1 -0
  14. package/{lib → dist/module}/DatabaseSyncTree.js +74 -156
  15. package/dist/module/DatabaseSyncTree.js.map +1 -0
  16. package/{lib → dist/module}/DatabaseThenableReference.js +12 -12
  17. package/dist/module/DatabaseThenableReference.js.map +1 -0
  18. package/{lib → dist/module}/DatabaseTransaction.js +26 -89
  19. package/dist/module/DatabaseTransaction.js.map +1 -0
  20. package/dist/module/index.js +27 -0
  21. package/dist/module/index.js.map +1 -0
  22. package/dist/module/modular/query.js +138 -0
  23. package/dist/module/modular/query.js.map +1 -0
  24. package/dist/module/modular/transaction.js +24 -0
  25. package/dist/module/modular/transaction.js.map +1 -0
  26. package/dist/module/modular.js +76 -0
  27. package/dist/module/modular.js.map +1 -0
  28. package/dist/module/namespaced.js +147 -0
  29. package/dist/module/namespaced.js.map +1 -0
  30. package/dist/module/package.json +1 -0
  31. package/dist/module/types/database.js +21 -0
  32. package/dist/module/types/database.js.map +1 -0
  33. package/dist/module/types/internal.js +4 -0
  34. package/dist/module/types/internal.js.map +1 -0
  35. package/dist/module/types/namespaced.js +67 -0
  36. package/dist/module/types/namespaced.js.map +1 -0
  37. package/dist/module/version.js +5 -0
  38. package/dist/module/version.js.map +1 -0
  39. package/dist/module/web/RNFBDatabaseModule.android.js +6 -0
  40. package/dist/module/web/RNFBDatabaseModule.android.js.map +1 -0
  41. package/dist/module/web/RNFBDatabaseModule.ios.js +6 -0
  42. package/dist/module/web/RNFBDatabaseModule.ios.js.map +1 -0
  43. package/dist/module/web/RNFBDatabaseModule.js +375 -0
  44. package/dist/module/web/RNFBDatabaseModule.js.map +1 -0
  45. package/{lib → dist/module}/web/query.js +19 -24
  46. package/dist/module/web/query.js.map +1 -0
  47. package/dist/typescript/lib/DatabaseDataSnapshot.d.ts +20 -0
  48. package/dist/typescript/lib/DatabaseDataSnapshot.d.ts.map +1 -0
  49. package/dist/typescript/lib/DatabaseOnDisconnect.d.ts +19 -0
  50. package/dist/typescript/lib/DatabaseOnDisconnect.d.ts.map +1 -0
  51. package/dist/typescript/lib/DatabaseQuery.d.ts +32 -0
  52. package/dist/typescript/lib/DatabaseQuery.d.ts.map +1 -0
  53. package/dist/typescript/lib/DatabaseQueryModifiers.d.ts +55 -0
  54. package/dist/typescript/lib/DatabaseQueryModifiers.d.ts.map +1 -0
  55. package/dist/typescript/lib/DatabaseReference.d.ts +21 -0
  56. package/dist/typescript/lib/DatabaseReference.d.ts.map +1 -0
  57. package/dist/typescript/lib/DatabaseStatics.d.ts +10 -0
  58. package/dist/typescript/lib/DatabaseStatics.d.ts.map +1 -0
  59. package/dist/typescript/lib/DatabaseSyncTree.d.ts +72 -0
  60. package/dist/typescript/lib/DatabaseSyncTree.d.ts.map +1 -0
  61. package/dist/typescript/lib/DatabaseThenableReference.d.ts +13 -0
  62. package/dist/typescript/lib/DatabaseThenableReference.d.ts.map +1 -0
  63. package/dist/typescript/lib/DatabaseTransaction.d.ts +15 -0
  64. package/dist/typescript/lib/DatabaseTransaction.d.ts.map +1 -0
  65. package/dist/typescript/lib/index.d.ts +6 -0
  66. package/dist/typescript/lib/index.d.ts.map +1 -0
  67. package/dist/typescript/lib/modular/query.d.ts +41 -0
  68. package/dist/typescript/lib/modular/query.d.ts.map +1 -0
  69. package/dist/typescript/lib/modular/transaction.d.ts +3 -0
  70. package/dist/typescript/lib/modular/transaction.d.ts.map +1 -0
  71. package/dist/typescript/lib/modular.d.ts +24 -0
  72. package/dist/typescript/lib/modular.d.ts.map +1 -0
  73. package/dist/typescript/lib/namespaced.d.ts +13 -0
  74. package/dist/typescript/lib/namespaced.d.ts.map +1 -0
  75. package/dist/typescript/lib/types/database.d.ts +93 -0
  76. package/dist/typescript/lib/types/database.d.ts.map +1 -0
  77. package/dist/typescript/lib/types/internal.d.ts +189 -0
  78. package/dist/typescript/lib/types/internal.d.ts.map +1 -0
  79. package/dist/typescript/lib/types/namespaced.d.ts +1230 -0
  80. package/dist/typescript/lib/types/namespaced.d.ts.map +1 -0
  81. package/dist/typescript/lib/version.d.ts +2 -0
  82. package/dist/typescript/lib/version.d.ts.map +1 -0
  83. package/dist/typescript/lib/web/RNFBDatabaseModule.android.d.ts +3 -0
  84. package/dist/typescript/lib/web/RNFBDatabaseModule.android.d.ts.map +1 -0
  85. package/dist/typescript/lib/web/RNFBDatabaseModule.d.ts +3 -0
  86. package/dist/typescript/lib/web/RNFBDatabaseModule.d.ts.map +1 -0
  87. package/dist/typescript/lib/web/RNFBDatabaseModule.ios.d.ts +3 -0
  88. package/dist/typescript/lib/web/RNFBDatabaseModule.ios.d.ts.map +1 -0
  89. package/dist/typescript/lib/web/query.d.ts +13 -0
  90. package/dist/typescript/lib/web/query.d.ts.map +1 -0
  91. package/dist/typescript/package.json +1 -0
  92. package/lib/{DatabaseDataSnapshot.js → DatabaseDataSnapshot.ts} +62 -88
  93. package/lib/{DatabaseOnDisconnect.js → DatabaseOnDisconnect.ts} +25 -23
  94. package/lib/{DatabaseQuery.js → DatabaseQuery.ts} +130 -144
  95. package/lib/DatabaseQueryModifiers.ts +283 -0
  96. package/lib/{DatabaseReference.js → DatabaseReference.ts} +103 -85
  97. package/lib/{DatabaseStatics.js → DatabaseStatics.ts} +4 -2
  98. package/lib/DatabaseSyncTree.ts +390 -0
  99. package/lib/DatabaseThenableReference.ts +73 -0
  100. package/lib/DatabaseTransaction.ts +172 -0
  101. package/lib/index.ts +25 -0
  102. package/lib/modular/query.ts +410 -0
  103. package/lib/modular/transaction.ts +34 -0
  104. package/lib/modular.ts +134 -0
  105. package/lib/{index.js → namespaced.ts} +91 -90
  106. package/lib/types/database.ts +144 -0
  107. package/lib/types/internal.ts +317 -0
  108. package/lib/{index.d.ts → types/namespaced.ts} +48 -9
  109. package/lib/version.ts +2 -0
  110. package/lib/web/RNFBDatabaseModule.android.ts +4 -0
  111. package/lib/web/RNFBDatabaseModule.ios.ts +4 -0
  112. package/lib/web/RNFBDatabaseModule.ts +534 -0
  113. package/lib/web/query.ts +97 -0
  114. package/package.json +42 -7
  115. package/tsconfig.json +21 -0
  116. package/typedoc.json +3 -3
  117. package/lib/modular/index.d.ts +0 -246
  118. package/lib/modular/index.js +0 -134
  119. package/lib/modular/query.d.ts +0 -972
  120. package/lib/modular/query.js +0 -305
  121. package/lib/modular/transaction.d.ts +0 -54
  122. package/lib/modular/transaction.js +0 -24
  123. package/lib/version.js +0 -2
  124. package/lib/web/RNFBDatabaseModule.android.js +0 -2
  125. package/lib/web/RNFBDatabaseModule.ios.js +0 -2
  126. package/lib/web/RNFBDatabaseModule.js +0 -558
@@ -1,3 +1,5 @@
1
+ "use strict";
2
+
1
3
  /*
2
4
  * Copyright (c) 2016-present Invertase Limited & Contributors
3
5
  *
@@ -16,12 +18,25 @@
16
18
  */
17
19
 
18
20
  import { isNull, isNumber, isString } from '@react-native-firebase/app/dist/module/common';
19
-
20
21
  const CONSTANTS = {
21
22
  VIEW_FROM_LEFT: 'left',
22
- VIEW_FROM_RIGHT: 'right',
23
+ VIEW_FROM_RIGHT: 'right'
23
24
  };
24
-
25
+ function getFilterValueType(value) {
26
+ if (value === null) {
27
+ return 'null';
28
+ }
29
+ switch (typeof value) {
30
+ case 'number':
31
+ return 'number';
32
+ case 'string':
33
+ return 'string';
34
+ case 'boolean':
35
+ return 'boolean';
36
+ default:
37
+ return 'object';
38
+ }
39
+ }
25
40
  export default class DatabaseQueryModifiers {
26
41
  constructor() {
27
42
  this._limit = undefined;
@@ -30,7 +45,6 @@ export default class DatabaseQueryModifiers {
30
45
  this._endAt = undefined;
31
46
  this._modifiers = [];
32
47
  }
33
-
34
48
  _copy() {
35
49
  const newInstance = new DatabaseQueryModifiers();
36
50
  newInstance._limit = this._limit;
@@ -40,213 +54,150 @@ export default class DatabaseQueryModifiers {
40
54
  newInstance._modifiers = [...this._modifiers];
41
55
  return newInstance;
42
56
  }
43
-
44
- /**
45
- *
46
- * LIMIT
47
- *
48
- */
49
-
50
57
  hasLimit() {
51
58
  return this._limit !== undefined;
52
59
  }
53
-
54
60
  isValidLimit(limit) {
55
61
  return !isNumber(limit) || Math.floor(limit) !== limit || limit <= 0;
56
62
  }
57
-
58
63
  limitToFirst(limit) {
59
64
  const newLimit = {
60
65
  id: `limit-limitToFirst:${limit}`,
61
66
  name: 'limitToFirst',
62
67
  type: 'limit',
63
68
  value: limit,
64
- viewFrom: CONSTANTS.VIEW_FROM_LEFT,
69
+ viewFrom: CONSTANTS.VIEW_FROM_LEFT
65
70
  };
66
-
67
71
  this._limit = newLimit;
68
72
  this._modifiers.push(newLimit);
69
73
  return this;
70
74
  }
71
-
72
75
  limitToLast(limit) {
73
76
  const newLimit = {
74
77
  id: `limit-limitToLast:${limit}`,
75
78
  name: 'limitToLast',
76
79
  type: 'limit',
77
80
  value: limit,
78
- viewFrom: CONSTANTS.VIEW_FROM_RIGHT,
81
+ viewFrom: CONSTANTS.VIEW_FROM_RIGHT
79
82
  };
80
-
81
83
  this._limit = newLimit;
82
84
  this._modifiers.push(newLimit);
83
85
  return this;
84
86
  }
85
-
86
- /**
87
- *
88
- * ORDER
89
- *
90
- */
91
-
92
87
  hasOrderBy() {
93
88
  return this._orderBy !== undefined;
94
89
  }
95
-
96
90
  orderByChild(path) {
97
91
  const newOrder = {
98
92
  id: `order-orderByChild:${path}`,
99
93
  type: 'orderBy',
100
94
  name: 'orderByChild',
101
- key: path,
95
+ key: path
102
96
  };
103
-
104
97
  this._orderBy = newOrder;
105
98
  this._modifiers.push(newOrder);
106
99
  return this;
107
100
  }
108
-
109
101
  orderByKey() {
110
102
  const newOrder = {
111
103
  id: 'order-orderByKey',
112
104
  type: 'orderBy',
113
- name: 'orderByKey',
105
+ name: 'orderByKey'
114
106
  };
115
-
116
107
  this._orderBy = newOrder;
117
108
  this._modifiers.push(newOrder);
118
109
  return this;
119
110
  }
120
-
121
111
  isValidPriority(priority) {
122
112
  return isNumber(priority) || isString(priority) || isNull(priority);
123
113
  }
124
-
125
114
  orderByPriority() {
126
115
  const newOrder = {
127
116
  id: 'order-orderByPriority',
128
117
  type: 'orderBy',
129
- name: 'orderByPriority',
118
+ name: 'orderByPriority'
130
119
  };
131
-
132
120
  this._orderBy = newOrder;
133
121
  this._modifiers.push(newOrder);
134
122
  return this;
135
123
  }
136
-
137
124
  orderByValue() {
138
125
  const newOrder = {
139
126
  id: 'order-orderByValue',
140
127
  type: 'orderBy',
141
- name: 'orderByValue',
128
+ name: 'orderByValue'
142
129
  };
143
-
144
130
  this._orderBy = newOrder;
145
131
  this._modifiers.push(newOrder);
146
132
  return this;
147
133
  }
148
-
149
- /**
150
- *
151
- * FILTER
152
- *
153
- */
154
-
155
134
  hasStartAt() {
156
135
  return this._startAt !== undefined;
157
136
  }
158
-
159
137
  hasEndAt() {
160
138
  return this._endAt !== undefined;
161
139
  }
162
-
163
140
  startAt(value, key) {
164
141
  const newStart = {
165
142
  id: `filter-startAt:${value}:${key || ''}`,
166
143
  type: 'filter',
167
144
  name: 'startAt',
168
145
  value,
169
- valueType: value === null ? 'null' : typeof value,
170
- key,
146
+ valueType: getFilterValueType(value),
147
+ key
171
148
  };
172
-
173
149
  this._startAt = newStart;
174
150
  this._modifiers.push(newStart);
175
151
  return this;
176
152
  }
177
-
178
153
  endAt(value, key) {
179
- const newStart = {
154
+ const newEnd = {
180
155
  id: `filter-endAt:${value}:${key || ''}`,
181
156
  type: 'filter',
182
157
  name: 'endAt',
183
158
  value,
184
- valueType: value === null ? 'null' : typeof value,
185
- key,
159
+ valueType: getFilterValueType(value),
160
+ key
186
161
  };
187
-
188
- this._endAt = newStart;
189
- this._modifiers.push(newStart);
162
+ this._endAt = newEnd;
163
+ this._modifiers.push(newEnd);
190
164
  return this;
191
165
  }
192
-
193
- // Returns a modifier array
194
166
  toArray() {
195
167
  return this._modifiers;
196
168
  }
197
-
198
- // Converts the modifier list to a string representation
199
169
  toString() {
200
- const sorted = [].concat(this._modifiers).sort((a, b) => {
201
- if (a.id < b.id) {
202
- return -1;
203
- }
204
- if (a.id > b.id) {
205
- return 1;
206
- }
207
- return 0;
208
- });
209
-
170
+ const sorted = [...this._modifiers].sort((a, b) => a.id.localeCompare(b.id));
210
171
  let key = '{';
211
- for (let i = 0; i < sorted.length; i++) {
212
- if (i !== 0) {
172
+ for (let index = 0; index < sorted.length; index++) {
173
+ const modifier = sorted[index];
174
+ if (!modifier) {
175
+ continue;
176
+ }
177
+ if (index !== 0) {
213
178
  key += ',';
214
179
  }
215
- key += sorted[i].id;
180
+ key += modifier.id;
216
181
  }
217
182
  key += '}';
218
183
  return key;
219
184
  }
220
-
221
185
  validateModifiers(prefix) {
222
- if (this._orderBy && this._orderBy.name === 'orderByKey') {
223
- if ((this._startAt && !!this._startAt.key) || (this._endAt && !!this._endAt.key)) {
224
- throw new Error(
225
- `${prefix} When ordering by key, you may only pass a value argument to startAt(), endAt(), or equalTo().`,
226
- );
186
+ if (this._orderBy?.name === 'orderByKey') {
187
+ if (this._startAt && !!this._startAt.key || this._endAt && !!this._endAt.key) {
188
+ throw new Error(`${prefix} When ordering by key, you may only pass a value argument to startAt(), endAt(), or equalTo().`);
227
189
  }
228
190
  }
229
-
230
- if (this._orderBy && this._orderBy.name === 'orderByKey') {
231
- if (
232
- (this._startAt && this._startAt.valueType !== 'string') ||
233
- (this._endAt && this._endAt.valueType !== 'string')
234
- ) {
235
- throw new Error(
236
- `${prefix} When ordering by key, the value of startAt(), endAt(), or equalTo() must be a string.`,
237
- );
191
+ if (this._orderBy?.name === 'orderByKey') {
192
+ if (this._startAt && this._startAt.valueType !== 'string' || this._endAt && this._endAt.valueType !== 'string') {
193
+ throw new Error(`${prefix} When ordering by key, the value of startAt(), endAt(), or equalTo() must be a string.`);
238
194
  }
239
195
  }
240
-
241
- if (this._orderBy && this._orderBy.name === 'orderByPriority') {
242
- if (
243
- (this._startAt && !this.isValidPriority(this._startAt.value)) ||
244
- (this._endAt && !this.isValidPriority(this._endAt.value))
245
- ) {
246
- throw new Error(
247
- `${prefix} When ordering by priority, the first value of startAt(), endAt(), or equalTo() must be a valid priority value (null, a number, or a string).`,
248
- );
196
+ if (this._orderBy?.name === 'orderByPriority') {
197
+ if (this._startAt && !this.isValidPriority(this._startAt.value) || this._endAt && !this.isValidPriority(this._endAt.value)) {
198
+ throw new Error(`${prefix} When ordering by priority, the first value of startAt(), endAt(), or equalTo() must be a valid priority value (null, a number, or a string).`);
249
199
  }
250
200
  }
251
201
  }
252
202
  }
203
+ //# sourceMappingURL=DatabaseQueryModifiers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["isNull","isNumber","isString","CONSTANTS","VIEW_FROM_LEFT","VIEW_FROM_RIGHT","getFilterValueType","value","DatabaseQueryModifiers","constructor","_limit","undefined","_orderBy","_startAt","_endAt","_modifiers","_copy","newInstance","hasLimit","isValidLimit","limit","Math","floor","limitToFirst","newLimit","id","name","type","viewFrom","push","limitToLast","hasOrderBy","orderByChild","path","newOrder","key","orderByKey","isValidPriority","priority","orderByPriority","orderByValue","hasStartAt","hasEndAt","startAt","newStart","valueType","endAt","newEnd","toArray","toString","sorted","sort","a","b","localeCompare","index","length","modifier","validateModifiers","prefix","Error"],"sourceRoot":"../../lib","sources":["DatabaseQueryModifiers.ts"],"mapp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AIsB,QAAQ,CAAChC,EAAE;IACpB;IAEAU,GAAG,IAAI,GAAG;IACV,OAAOA,GAAG;EACZ;EAEAuB,iBAAiBA,CAACC,MAAc,EAAQ;IACtC,IAAI,IAAI,CAAC/C,QAAQ,EAAEc,IAAI,KAAK,YAAY,EAAE;MACxC,IAAK,IAAI,CAACb,QAAQ,IAAI,CAAC,CAAC,IAAI,CAACA,QAAQ,CAACsB,GAAG,IAAM,IAAI,CAACrB,MAAM,IAAI,CAAC,CAAC,IAAI,CAACA,MAAM,CAACqB,GAAI,EAAE;QAChF,MAAM,IAAIyB,KAAK,CACb,GAAGD,MAAM,gGACX,CAAC;MACH;IACF;IAEA,IAAI,IAAI,CAAC/C,QAAQ,EAAEc,IAAI,KAAK,YAAY,EAAE;MACxC,IACG,IAAI,CAACb,QAAQ,IAAI,IAAI,CAACA,QAAQ,CAACgC,SAAS,KAAK,QAAQ,IACrD,IAAI,CAAC/B,MAAM,IAAI,IAAI,CAACA,MAAM,CAAC+B,SAAS,KAAK,QAAS,EACnD;QACA,MAAM,IAAIe,KAAK,CACb,GAAGD,MAAM,wFACX,CAAC;MACH;IACF;IAEA,IAAI,IAAI,CAAC/C,QAAQ,EAAEc,IAAI,KAAK,iBAAiB,EAAE;MAC7C,IACG,IAAI,CAACb,QAAQ,IAAI,CAAC,IAAI,CAACwB,eAAe,CAAC,IAAI,CAACxB,QAAQ,CAACN,KAAK,CAAC,IAC3D,IAAI,CAACO,MAAM,IAAI,CAAC,IAAI,CAACuB,eAAe,CAAC,IAAI,CAACvB,MAAM,CAACP,KAAK,CAAE,EACzD;QACA,MAAM,IAAIqD,KAAK,CACb,GAAGD,MAAM,+IACX,CAAC;MACH;IACF;EACF;AACF","ignoreList":[]}
@@ -0,0 +1,169 @@
1
+ "use strict";
2
+
3
+ /*
4
+ * Copyright (c) 2016-present Invertase Limited & Contributors
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this library except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ *
18
+ */
19
+
20
+ import { createDeprecationProxy, generateDatabaseId, isBoolean, isFunction, isNull, isNumber, isObject, isString, isUndefined, isValidPath, MODULAR_DEPRECATION_ARG, pathChild, pathParent, promiseWithOptionalCallback } from '@react-native-firebase/app/dist/module/common';
21
+ import DatabaseDataSnapshot from "./DatabaseDataSnapshot.js";
22
+ import DatabaseOnDisconnect from "./DatabaseOnDisconnect.js";
23
+ import DatabaseQuery, { provideReferenceClass as provideReferenceClassForQuery } from "./DatabaseQuery.js";
24
+ import DatabaseQueryModifiers from "./DatabaseQueryModifiers.js";
25
+ import DatabaseThenableReference, { provideReferenceClass as provideReferenceClassForThenable } from "./DatabaseThenableReference.js";
26
+ const internalRefs = ['.info/connected', '.info/serverTimeOffset'];
27
+ function apChild(reference) {
28
+ return reference;
29
+ }
30
+ function apSet(reference) {
31
+ return reference;
32
+ }
33
+ export default class DatabaseReference extends DatabaseQuery {
34
+ constructor(database, path) {
35
+ if (!internalRefs.includes(path) && !isValidPath(path)) {
36
+ throw new Error('firebase.database() Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"');
37
+ }
38
+ super(database, path, new DatabaseQueryModifiers());
39
+ this._database = database;
40
+ }
41
+ get parent() {
42
+ const parentPath = pathParent(this.path);
43
+ if (parentPath === null) {
44
+ return null;
45
+ }
46
+ return createDeprecationProxy(new DatabaseReference(this._database, parentPath));
47
+ }
48
+ get root() {
49
+ return createDeprecationProxy(new DatabaseReference(this._database, '/'));
50
+ }
51
+ child(path) {
52
+ if (!isString(path)) {
53
+ throw new Error("firebase.database().ref().child(*) 'path' must be a string value.");
54
+ }
55
+ return createDeprecationProxy(new DatabaseReference(this._database, pathChild(this.path, path)));
56
+ }
57
+ set(value, onComplete) {
58
+ if (isUndefined(value)) {
59
+ throw new Error("firebase.database().ref().set(*) 'value' must be defined.");
60
+ }
61
+ if (!isUndefined(onComplete) && !isFunction(onComplete)) {
62
+ throw new Error("firebase.database().ref().set(_, *) 'onComplete' must be a function if provided.");
63
+ }
64
+ return promiseWithOptionalCallback(this._database.native.set(this.path, {
65
+ value
66
+ }), onComplete);
67
+ }
68
+ update(values, onComplete) {
69
+ if (!isObject(values)) {
70
+ throw new Error("firebase.database().ref().update(*) 'values' must be an object.");
71
+ }
72
+ const keys = Object.keys(values);
73
+ for (let i = 0; i < keys.length; i++) {
74
+ if (!isValidPath(keys[i])) {
75
+ throw new Error('firebase.database().update(*) \'values\' contains an invalid path. Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"');
76
+ }
77
+ }
78
+ if (!isUndefined(onComplete) && !isFunction(onComplete)) {
79
+ throw new Error("firebase.database().ref().update(_, *) 'onComplete' must be a function if provided.");
80
+ }
81
+ return promiseWithOptionalCallback(this._database.native.update(this.path, {
82
+ values
83
+ }), onComplete);
84
+ }
85
+ setWithPriority(newVal, newPriority, onComplete) {
86
+ if (isUndefined(newVal)) {
87
+ throw new Error("firebase.database().ref().setWithPriority(*) 'newVal' must be defined.");
88
+ }
89
+ if (!isNumber(newPriority) && !isString(newPriority) && !isNull(newPriority)) {
90
+ throw new Error("firebase.database().ref().setWithPriority(_, *) 'newPriority' must be a number, string or null value.");
91
+ }
92
+ if (!isUndefined(onComplete) && !isFunction(onComplete)) {
93
+ throw new Error("firebase.database().ref().setWithPriority(_, _, *) 'onComplete' must be a function if provided.");
94
+ }
95
+ return promiseWithOptionalCallback(this._database.native.setWithPriority(this.path, {
96
+ value: newVal,
97
+ priority: newPriority
98
+ }), onComplete);
99
+ }
100
+ remove(onComplete) {
101
+ if (!isUndefined(onComplete) && !isFunction(onComplete)) {
102
+ throw new Error("firebase.database().ref().remove(*) 'onComplete' must be a function if provided.");
103
+ }
104
+ return promiseWithOptionalCallback(this._database.native.remove(this.path), onComplete);
105
+ }
106
+ transaction(transactionUpdate, onComplete, applyLocally) {
107
+ if (!isFunction(transactionUpdate)) {
108
+ throw new Error("firebase.database().ref().transaction(*) 'transactionUpdate' must be a function.");
109
+ }
110
+ if (!isUndefined(onComplete) && !isFunction(onComplete)) {
111
+ throw new Error("firebase.database().ref().transaction(_, *) 'onComplete' must be a function if provided.");
112
+ }
113
+ if (!isUndefined(applyLocally) && !isBoolean(applyLocally)) {
114
+ throw new Error("firebase.database().ref().transaction(_, _, *) 'applyLocally' must be a boolean value if provided.");
115
+ }
116
+ return new Promise((resolve, reject) => {
117
+ const onCompleteWrapper = (error, committed, snapshotData) => {
118
+ if (isFunction(onComplete)) {
119
+ if (error) {
120
+ onComplete(error, committed, null);
121
+ } else {
122
+ onComplete(null, committed, createDeprecationProxy(new DatabaseDataSnapshot(this, snapshotData)));
123
+ }
124
+ }
125
+ if (error) {
126
+ reject(error);
127
+ return;
128
+ }
129
+ resolve({
130
+ committed,
131
+ snapshot: createDeprecationProxy(new DatabaseDataSnapshot(this, snapshotData))
132
+ });
133
+ };
134
+ this._database._transaction.add(this, transactionUpdate, onCompleteWrapper, applyLocally);
135
+ });
136
+ }
137
+ setPriority(priority, onComplete) {
138
+ if (!isNumber(priority) && !isString(priority) && !isNull(priority)) {
139
+ throw new Error("firebase.database().ref().setPriority(*) 'priority' must be a number, string or null value.");
140
+ }
141
+ if (!isUndefined(onComplete) && !isFunction(onComplete)) {
142
+ throw new Error("firebase.database().ref().setPriority(_, *) 'onComplete' must be a function if provided.");
143
+ }
144
+ return promiseWithOptionalCallback(this._database.native.setPriority(this.path, {
145
+ priority
146
+ }), onComplete);
147
+ }
148
+ push(value, onComplete) {
149
+ if (!isUndefined(onComplete) && !isFunction(onComplete)) {
150
+ throw new Error("firebase.database().ref().push(_, *) 'onComplete' must be a function if provided.");
151
+ }
152
+ const id = generateDatabaseId(this._database._serverTimeOffset);
153
+ if (isUndefined(value) || isNull(value)) {
154
+ return new DatabaseThenableReference(this._database, pathChild(this.path, id), Promise.resolve(apChild(this).child.call(this, id, MODULAR_DEPRECATION_ARG)));
155
+ }
156
+ const pushRef = apChild(this).child.call(this, id, MODULAR_DEPRECATION_ARG);
157
+ const promise = apSet(pushRef).set.call(pushRef, value, onComplete, MODULAR_DEPRECATION_ARG).then(() => pushRef);
158
+ if (onComplete) {
159
+ promise.catch(() => {});
160
+ }
161
+ return new DatabaseThenableReference(this._database, pathChild(this.path, id), promise);
162
+ }
163
+ onDisconnect() {
164
+ return new DatabaseOnDisconnect(this);
165
+ }
166
+ }
167
+ provideReferenceClassForQuery(DatabaseReference);
168
+ provideReferenceClassForThenable(DatabaseReference);
169
+ //# sourceMappingURL=DatabaseReference.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createDeprecationProxy","generateDatabaseId","isBoolean","isFunction","isNull","isNumber","isObject","isString","isUndefined","isValidPath","MODULAR_DEPRECATION_ARG","pathChild","pathParent","promiseWithOptionalCallback","DatabaseDataSnapshot","DatabaseOnDisconnect","DatabaseQuery","provideReferenceClass","provideReferenceClassForQuery","DatabaseQueryModifiers","DatabaseThenableReference","provideReferenceClassForThenable","internalRefs","apChild","reference","apSet","DatabaseReference","constructor","database","path","includes","Error","_database","parent","parentPath","root","child","set","value","onComplete","native","update","values","keys","Object","i","length","setWithPriority","newVal","newPriority","priority","remove","transaction","transactionUpdate","applyLocally","Promise","resolve","reject","onCompleteWrapper","error","committed","snapshotData","snapshot","_transaction","add","setPriority","push","id","_serverTimeOffset","call","pushRef","promise","then","catch","onDisconnect"],"sourceRoot":"../../lib","sources":["DatabaseReference.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,sBAAsB,EACtBC,kBAAkB,EAClBC,SAAS,EACTC,UAAU,EACVC,MAAM,EACNC,QAAQ,EACRC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,CAAC,IAAI,EAAEF,EAAE,EAAEzD,uBAAuB,CAAC;IAE3E,MAAM6D,OAAO,GAAG9C,KAAK,CAAC6C,OAAO,CAAC,CAC3BjC,GAAG,CAACgC,IAAI,CAACC,OAAO,EAAEhC,KAAK,EAAEC,UAAU,EAAE7B,uBAAuB,CAAC,CAC7D8D,IAAI,CAAC,MAAMF,OAAO,CAAC;IAEtB,IAAI/B,UAAU,EAAE;MACdgC,OAAO,CAACE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IACzB;IAEA,OAAO,IAAIrD,yBAAyB,CAClC,IAAI,CAACY,SAAS,EACdrB,SAAS,CAAC,IAAI,CAACkB,IAAI,EAAEsC,EAAE,CAAC,EACxBI,OACF,CAAC;EACH;EAEAG,YAAYA,CAAA,EAAuC;IACjD,OAAO,IAAI3D,oBAAoB,CAAC,IAAI,CAAC;EACvC;AACF;AAEAG,6BAA6B,CAACQ,iBAAiB,CAAC;AAChDL,gCAAgC,CAACK,iBAAiB,CAAC","ignoreList":[]}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ /*
4
+ * Copyright (c) 2016-present Invertase Limited & Contributors
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this library except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ *
18
+ */
19
+
20
+ const DatabaseStatics = {
21
+ ServerValue: {
22
+ TIMESTAMP: {
23
+ '.sv': 'timestamp'
24
+ },
25
+ increment(delta) {
26
+ return {
27
+ '.sv': {
28
+ increment: delta
29
+ }
30
+ };
31
+ }
32
+ }
33
+ };
34
+ export default DatabaseStatics;
35
+ //# sourceMappingURL=DatabaseStatics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DatabaseStatics","ServerValue","TIMESTAMP","increment","delta"],"sourceRoot":"../../lib","sources":["DatabaseStatics.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,eAAe,GAAG;EACtBC,WAAW,EAAE;IACXC,SAAS,EAAE;MACT,KAAK,EAAE;IACT,CAAC;IACDC,SAASA,CAACC,KAAa,EAAU;MAC/B,OAAO;QACL,KAAK,EAAE;UACLD,SAAS,EAAEC;QACb;MACF,CAAC;IACH;EACF;AACF,CAAC;AAED,eAAeJ,eAAe","ignoreList":[]}