(data: T, options?: SetOptions)
| 848 | } |
| 849 | |
| 850 | set(data: T, options?: SetOptions): Promise<void> { |
| 851 | return new Promise((resolve, reject) => { |
| 852 | if (options) { |
| 853 | if (typeof options?.merge === 'boolean') { |
| 854 | this.native.setDataMergeCompletion(serializeItems(data), options.merge, (error) => { |
| 855 | if (error) { |
| 856 | reject(FirebaseError.fromNative(error)); |
| 857 | } else { |
| 858 | resolve(); |
| 859 | } |
| 860 | }); |
| 861 | } else if (options.mergeFields) { |
| 862 | if (Array.isArray(options.mergeFields)) { |
| 863 | if (typeof options.mergeFields[0] === 'string') { |
| 864 | this.native.setDataMergeFieldsCompletion(serializeItems(data), options.mergeFields, (error) => { |
| 865 | if (error) { |
| 866 | reject(FirebaseError.fromNative(error)); |
| 867 | } else { |
| 868 | resolve(); |
| 869 | } |
| 870 | }); |
| 871 | } else { |
| 872 | this.native.setDataMergeFieldsCompletion( |
| 873 | serializeItems(data), |
| 874 | options.mergeFields.map((field) => field.native), |
| 875 | (error) => { |
| 876 | if (error) { |
| 877 | reject(FirebaseError.fromNative(error)); |
| 878 | } else { |
| 879 | resolve(); |
| 880 | } |
| 881 | } |
| 882 | ); |
| 883 | } |
| 884 | } |
| 885 | } |
| 886 | } else { |
| 887 | this.native.setDataCompletion(serializeItems(data), (error) => { |
| 888 | if (error) { |
| 889 | reject(FirebaseError.fromNative(error)); |
| 890 | } else { |
| 891 | resolve(); |
| 892 | } |
| 893 | }); |
| 894 | } |
| 895 | }); |
| 896 | } |
| 897 | |
| 898 | update(data: Partial<{ [K in keyof T]: FieldValue | T[K] }>): Promise<void>; |
| 899 | update(field: FieldPath | keyof T, value: any, moreFieldsAndValues: any[]): Promise<void>; |
nothing calls this directly
no test coverage detected