favesalon-embed 1.0.2 → 1.0.4
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.
- package/dist/{favesalon-embed/_commonjsHelpers-a4f66ccd.js → cjs/_commonjsHelpers-5cfcba41.js} +6 -14
- package/dist/cjs/chat-box_5.cjs.entry.js +17439 -0
- package/dist/cjs/chat-button.cjs.entry.js +55 -0
- package/dist/cjs/colors-38421769.js +69 -0
- package/dist/cjs/favesalon-embed.cjs.js +23 -0
- package/dist/cjs/google-map.cjs.entry.js +52 -0
- package/dist/cjs/index-7f190886.js +4396 -0
- package/dist/cjs/index-dd8176c4.js +1531 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +22 -0
- package/dist/cjs/relativeTime-3721080d.js +9 -0
- package/dist/cjs/salon-booking-modal.cjs.entry.js +30 -0
- package/dist/cjs/salon-booking.cjs.entry.js +51 -0
- package/dist/cjs/salon-gift-card-modal.cjs.entry.js +29 -0
- package/dist/cjs/salon-gift-card.cjs.entry.js +51 -0
- package/dist/cjs/salon-info.cjs.entry.js +33 -0
- package/dist/cjs/salon-latest-reviews.cjs.entry.js +97 -0
- package/dist/cjs/salon-latest-styles_3.cjs.entry.js +241 -0
- package/dist/cjs/salon-lookbook.cjs.entry.js +222 -0
- package/dist/cjs/salon-ranking.cjs.entry.js +60 -0
- package/dist/cjs/salon-reviews.cjs.entry.js +193 -0
- package/dist/cjs/salon-services.cjs.entry.js +81 -0
- package/dist/cjs/salon-stylists.cjs.entry.js +118 -0
- package/dist/cjs/services-d1bdf299.js +21494 -0
- package/dist/cjs/style-detail.cjs.entry.js +312 -0
- package/dist/cjs/utils-c5a33b3c.js +23 -0
- package/dist/collection/collection-manifest.json +33 -0
- package/dist/collection/components/chat-box/index.css +105 -0
- package/dist/collection/components/chat-box/index.js +138 -0
- package/dist/collection/components/chat-button/index.css +101 -0
- package/dist/collection/components/chat-button/index.js +155 -0
- package/dist/collection/components/chat-form/index.css +40 -0
- package/dist/collection/components/chat-form/index.js +79 -0
- package/dist/collection/components/chat-messages/index.css +48 -0
- package/dist/collection/components/chat-messages/index.js +142 -0
- package/dist/collection/components/chat-rooms/index.css +102 -0
- package/dist/collection/components/chat-rooms/index.js +157 -0
- package/dist/collection/components/google-map/assets/map--placeholder.jpeg +0 -0
- package/dist/collection/components/google-map/index.css +5 -0
- package/dist/collection/components/google-map/index.js +90 -0
- package/dist/collection/components/salon-booking/index.css +30 -0
- package/dist/collection/components/salon-booking/index.js +126 -0
- package/dist/collection/components/salon-booking/salon-booking-modal.js +92 -0
- package/dist/collection/components/salon-gift-card/index.css +30 -0
- package/dist/collection/components/salon-gift-card/index.js +126 -0
- package/dist/collection/components/salon-gift-card/salon-gift-card-modal.js +73 -0
- package/dist/collection/components/salon-info/index.css +1 -0
- package/dist/collection/components/salon-info/index.js +77 -0
- package/dist/collection/components/salon-latest-reviews/index.css +11 -0
- package/dist/collection/components/salon-latest-reviews/index.js +163 -0
- package/dist/collection/components/salon-latest-styles/index.css +12 -0
- package/dist/{favesalon-embed/salon-latest-styles.entry.js → collection/components/salon-latest-styles/index.js} +99 -14
- package/dist/collection/components/salon-locations/index.css +24 -0
- package/dist/{favesalon-embed/salon-locations.entry.js → collection/components/salon-locations/index.js} +95 -15
- package/dist/collection/components/salon-lookbook/index.css +15 -0
- package/dist/collection/components/salon-lookbook/index.js +368 -0
- package/dist/collection/components/salon-ranking/index.css +3 -0
- package/dist/collection/components/salon-ranking/index.js +117 -0
- package/dist/collection/components/salon-reviews/index.css +18 -0
- package/dist/collection/components/salon-reviews/index.js +249 -0
- package/dist/collection/components/salon-schedules/index.css +18 -0
- package/dist/{favesalon-embed/salon-schedules.entry.js → collection/components/salon-schedules/index.js} +95 -14
- package/dist/collection/components/salon-services/index.css +1 -0
- package/dist/collection/components/salon-services/index.js +146 -0
- package/dist/collection/components/salon-stylists/index.css +43 -0
- package/dist/collection/components/salon-stylists/index.js +184 -0
- package/dist/collection/components/style-detail/index.css +76 -0
- package/dist/collection/components/style-detail/index.js +386 -0
- package/dist/collection/components/user-avatar/index.css +0 -0
- package/dist/collection/components/user-avatar/index.js +159 -0
- package/dist/collection/constants/colors.js +65 -0
- package/dist/collection/global/global.js +0 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/mocks/users.js +10 -0
- package/dist/collection/services/services.js +295 -0
- package/dist/collection/types/chat.js +23 -0
- package/dist/collection/types/common.js +11 -0
- package/dist/collection/types/review.js +39 -0
- package/dist/collection/types/salon.js +58 -0
- package/dist/collection/types/service.js +24 -0
- package/dist/collection/types/style.js +128 -0
- package/dist/collection/types/stylist.js +30 -0
- package/dist/collection/types/user.js +10 -0
- package/dist/collection/utils/utils.js +23 -0
- package/dist/custom-elements/index.d.ts +12 -0
- package/dist/custom-elements/index.js +44974 -0
- package/dist/esm/_commonjsHelpers-66ac50f5.js +32 -0
- package/dist/esm/chat-box_5.entry.js +17431 -0
- package/dist/{favesalon-embed → esm}/chat-button.entry.js +5 -10
- package/dist/esm/favesalon-embed.js +18 -0
- package/dist/{favesalon-embed → esm}/google-map.entry.js +1 -1
- package/dist/esm/index-0494771f.js +1504 -0
- package/dist/{favesalon-embed/index-00b83e1c.js → esm/index-a1c7583c.js} +15 -425
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +18 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/relativeTime-baa50aa2.js +7 -0
- package/dist/{favesalon-embed → esm}/salon-booking-modal.entry.js +1 -1
- package/dist/{favesalon-embed → esm}/salon-booking.entry.js +3 -3
- package/dist/{favesalon-embed → esm}/salon-gift-card-modal.entry.js +1 -1
- package/dist/{favesalon-embed → esm}/salon-gift-card.entry.js +3 -3
- package/dist/{favesalon-embed → esm}/salon-info.entry.js +3 -3
- package/dist/{favesalon-embed → esm}/salon-latest-reviews.entry.js +4 -4
- package/dist/esm/salon-latest-styles_3.entry.js +235 -0
- package/dist/{favesalon-embed → esm}/salon-lookbook.entry.js +3 -3
- package/dist/{favesalon-embed → esm}/salon-ranking.entry.js +1 -1
- package/dist/{favesalon-embed → esm}/salon-reviews.entry.js +3 -3
- package/dist/{favesalon-embed → esm}/salon-services.entry.js +3 -3
- package/dist/{favesalon-embed → esm}/salon-stylists.entry.js +3 -3
- package/dist/{favesalon-embed/services-7cb8f2a6.js → esm/services-257442e2.js} +99 -2467
- package/dist/{favesalon-embed → esm}/style-detail.entry.js +4 -4
- package/dist/{favesalon-embed/utils-7de9628a.js → esm/utils-e97485e0.js} +0 -3
- package/dist/favesalon-embed/favesalon-embed.css +1 -2439
- package/dist/favesalon-embed/favesalon-embed.esm.js +1 -148
- package/dist/favesalon-embed/index.esm.js +0 -1
- package/dist/favesalon-embed/p-05a1c88a.entry.js +1 -0
- package/dist/favesalon-embed/p-0acf0447.entry.js +1 -0
- package/dist/favesalon-embed/p-0bc4f624.js +1 -0
- package/dist/favesalon-embed/p-1af1515f.entry.js +1 -0
- package/dist/favesalon-embed/p-1cba5fc9.entry.js +1 -0
- package/dist/favesalon-embed/p-39a4ef15.entry.js +1 -0
- package/dist/favesalon-embed/p-3e2cb05b.entry.js +1 -0
- package/dist/favesalon-embed/p-47e646f8.js +1 -0
- package/dist/favesalon-embed/p-487b311f.entry.js +1 -0
- package/dist/favesalon-embed/p-55387c2f.entry.js +1 -0
- package/dist/favesalon-embed/p-566f05b4.entry.js +1 -0
- package/dist/favesalon-embed/p-862a0de0.entry.js +1 -0
- package/dist/favesalon-embed/p-9fe0cbeb.js +2 -0
- package/dist/favesalon-embed/p-a33331cc.js +1 -0
- package/dist/favesalon-embed/p-aeeb7b5f.entry.js +1 -0
- package/dist/favesalon-embed/p-b08e5b54.js +6 -0
- package/dist/favesalon-embed/p-b5cca5fc.entry.js +1 -0
- package/dist/favesalon-embed/p-c7fb7af5.js +1580 -0
- package/dist/favesalon-embed/p-ccab56d8.js +1 -0
- package/dist/favesalon-embed/p-d6e13053.entry.js +1 -0
- package/dist/favesalon-embed/p-dee42d34.entry.js +1 -0
- package/dist/favesalon-embed/p-e661ca1d.entry.js +1 -0
- package/dist/favesalon-embed/p-eeceab9c.entry.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/components/chat-box/index.d.ts +12 -0
- package/dist/types/components/chat-rooms/index.d.ts +12 -0
- package/dist/types/components/user-avatar/index.d.ts +2 -1
- package/dist/types/components.d.ts +45 -2
- package/dist/types/utils/utils.d.ts +1 -0
- package/package.json +1 -1
- package/dist/favesalon-embed/app-globals-15861a7f.js +0 -712
- package/dist/favesalon-embed/app-globals-270fe240.js +0 -712
- package/dist/favesalon-embed/app-globals-437cc3f3.js +0 -712
- package/dist/favesalon-embed/app-globals-b8b0fc7a.js +0 -712
- package/dist/favesalon-embed/chat-form.entry.js +0 -39
- package/dist/favesalon-embed/chat-messages.entry.js +0 -51
- package/dist/favesalon-embed/css-shim-b7d3d95f.js +0 -4
- package/dist/favesalon-embed/dom-64053c71.js +0 -73
- package/dist/favesalon-embed/index-888e99e3.js +0 -3371
- package/dist/favesalon-embed/index-9ad82b12.js +0 -3371
- package/dist/favesalon-embed/index-aa906326.js +0 -3371
- package/dist/favesalon-embed/index-b97af793.js +0 -3371
- package/dist/favesalon-embed/relativeTime-268e64b0.js +0 -7
- package/dist/favesalon-embed/shadow-css-98135883.js +0 -387
- package/dist/favesalon-embed/user-avatar.entry.js +0 -42
- /package/dist/{favesalon-embed → esm}/colors-ea36347a.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as commonjsGlobal, c as createCommonjsModule } from './_commonjsHelpers-66ac50f5.js';
|
|
2
2
|
import { C as Colors } from './colors-ea36347a.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -1181,12 +1181,12 @@ var _baseGet = baseGet;
|
|
|
1181
1181
|
* _.get(object, 'a.b.c', 'default');
|
|
1182
1182
|
* // => 'default'
|
|
1183
1183
|
*/
|
|
1184
|
-
function get
|
|
1184
|
+
function get(object, path, defaultValue) {
|
|
1185
1185
|
var result = object == null ? undefined : _baseGet(object, path);
|
|
1186
1186
|
return result === undefined ? defaultValue : result;
|
|
1187
1187
|
}
|
|
1188
1188
|
|
|
1189
|
-
var get_1 = get
|
|
1189
|
+
var get_1 = get;
|
|
1190
1190
|
|
|
1191
1191
|
/**
|
|
1192
1192
|
* A specialized version of `_.forEach` for arrays without support for
|
|
@@ -1344,7 +1344,7 @@ var stubFalse_1 = stubFalse;
|
|
|
1344
1344
|
|
|
1345
1345
|
var isBuffer_1 = createCommonjsModule(function (module, exports) {
|
|
1346
1346
|
/** Detect free variable `exports`. */
|
|
1347
|
-
var freeExports =
|
|
1347
|
+
var freeExports = exports && !exports.nodeType && exports;
|
|
1348
1348
|
|
|
1349
1349
|
/** Detect free variable `module`. */
|
|
1350
1350
|
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
@@ -1516,7 +1516,7 @@ var _baseUnary = baseUnary;
|
|
|
1516
1516
|
|
|
1517
1517
|
var _nodeUtil = createCommonjsModule(function (module, exports) {
|
|
1518
1518
|
/** Detect free variable `exports`. */
|
|
1519
|
-
var freeExports =
|
|
1519
|
+
var freeExports = exports && !exports.nodeType && exports;
|
|
1520
1520
|
|
|
1521
1521
|
/** Detect free variable `module`. */
|
|
1522
1522
|
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
@@ -3499,8 +3499,6 @@ var sortBy = _baseRest(function(collection, iteratees) {
|
|
|
3499
3499
|
|
|
3500
3500
|
var sortBy_1 = sortBy;
|
|
3501
3501
|
|
|
3502
|
-
'use strict';
|
|
3503
|
-
|
|
3504
3502
|
var bind = function bind(fn, thisArg) {
|
|
3505
3503
|
return function wrap() {
|
|
3506
3504
|
var args = new Array(arguments.length);
|
|
@@ -3511,10 +3509,6 @@ var bind = function bind(fn, thisArg) {
|
|
|
3511
3509
|
};
|
|
3512
3510
|
};
|
|
3513
3511
|
|
|
3514
|
-
'use strict';
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
3512
|
// utils is a library of generic helper functions non-specific to axios
|
|
3519
3513
|
|
|
3520
3514
|
var toString = Object.prototype.toString;
|
|
@@ -3861,10 +3855,6 @@ var utils = {
|
|
|
3861
3855
|
stripBOM: stripBOM
|
|
3862
3856
|
};
|
|
3863
3857
|
|
|
3864
|
-
'use strict';
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
3858
|
function encode(val) {
|
|
3869
3859
|
return encodeURIComponent(val).
|
|
3870
3860
|
replace(/%3A/gi, ':').
|
|
@@ -3932,10 +3922,6 @@ var buildURL = function buildURL(url, params, paramsSerializer) {
|
|
|
3932
3922
|
return url;
|
|
3933
3923
|
};
|
|
3934
3924
|
|
|
3935
|
-
'use strict';
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
3925
|
function InterceptorManager() {
|
|
3940
3926
|
this.handlers = [];
|
|
3941
3927
|
}
|
|
@@ -3987,10 +3973,6 @@ InterceptorManager.prototype.forEach = function forEach(fn) {
|
|
|
3987
3973
|
|
|
3988
3974
|
var InterceptorManager_1 = InterceptorManager;
|
|
3989
3975
|
|
|
3990
|
-
'use strict';
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
3976
|
var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName) {
|
|
3995
3977
|
utils.forEach(headers, function processHeader(value, name) {
|
|
3996
3978
|
if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
|
|
@@ -4000,8 +3982,6 @@ var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName)
|
|
|
4000
3982
|
});
|
|
4001
3983
|
};
|
|
4002
3984
|
|
|
4003
|
-
'use strict';
|
|
4004
|
-
|
|
4005
3985
|
/**
|
|
4006
3986
|
* Update an Error with the specified config, error code, and response.
|
|
4007
3987
|
*
|
|
@@ -4044,10 +4024,6 @@ var enhanceError = function enhanceError(error, config, code, request, response)
|
|
|
4044
4024
|
return error;
|
|
4045
4025
|
};
|
|
4046
4026
|
|
|
4047
|
-
'use strict';
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
4027
|
/**
|
|
4052
4028
|
* Create an Error with the specified message, config, error code, request and response.
|
|
4053
4029
|
*
|
|
@@ -4063,10 +4039,6 @@ var createError = function createError(message, config, code, request, response)
|
|
|
4063
4039
|
return enhanceError(error, config, code, request, response);
|
|
4064
4040
|
};
|
|
4065
4041
|
|
|
4066
|
-
'use strict';
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
4042
|
/**
|
|
4071
4043
|
* Resolve or reject a Promise based on response status.
|
|
4072
4044
|
*
|
|
@@ -4089,10 +4061,6 @@ var settle = function settle(resolve, reject, response) {
|
|
|
4089
4061
|
}
|
|
4090
4062
|
};
|
|
4091
4063
|
|
|
4092
|
-
'use strict';
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
4064
|
var cookies = (
|
|
4097
4065
|
utils.isStandardBrowserEnv() ?
|
|
4098
4066
|
|
|
@@ -4143,8 +4111,6 @@ var cookies = (
|
|
|
4143
4111
|
})()
|
|
4144
4112
|
);
|
|
4145
4113
|
|
|
4146
|
-
'use strict';
|
|
4147
|
-
|
|
4148
4114
|
/**
|
|
4149
4115
|
* Determines whether the specified URL is absolute
|
|
4150
4116
|
*
|
|
@@ -4158,8 +4124,6 @@ var isAbsoluteURL = function isAbsoluteURL(url) {
|
|
|
4158
4124
|
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
|
4159
4125
|
};
|
|
4160
4126
|
|
|
4161
|
-
'use strict';
|
|
4162
|
-
|
|
4163
4127
|
/**
|
|
4164
4128
|
* Creates a new URL by combining the specified URLs
|
|
4165
4129
|
*
|
|
@@ -4173,11 +4137,6 @@ var combineURLs = function combineURLs(baseURL, relativeURL) {
|
|
|
4173
4137
|
: baseURL;
|
|
4174
4138
|
};
|
|
4175
4139
|
|
|
4176
|
-
'use strict';
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
4140
|
/**
|
|
4182
4141
|
* Creates a new URL by combining the baseURL with the requestedURL,
|
|
4183
4142
|
* only when the requestedURL is not already an absolute URL.
|
|
@@ -4194,10 +4153,6 @@ var buildFullPath = function buildFullPath(baseURL, requestedURL) {
|
|
|
4194
4153
|
return requestedURL;
|
|
4195
4154
|
};
|
|
4196
4155
|
|
|
4197
|
-
'use strict';
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
4156
|
// Headers whose duplicates are ignored by node
|
|
4202
4157
|
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
4203
4158
|
var ignoreDuplicateOf = [
|
|
@@ -4248,10 +4203,6 @@ var parseHeaders = function parseHeaders(headers) {
|
|
|
4248
4203
|
return parsed;
|
|
4249
4204
|
};
|
|
4250
4205
|
|
|
4251
|
-
'use strict';
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
4206
|
var isURLSameOrigin = (
|
|
4256
4207
|
utils.isStandardBrowserEnv() ?
|
|
4257
4208
|
|
|
@@ -4317,8 +4268,6 @@ var isURLSameOrigin = (
|
|
|
4317
4268
|
})()
|
|
4318
4269
|
);
|
|
4319
4270
|
|
|
4320
|
-
'use strict';
|
|
4321
|
-
|
|
4322
4271
|
/**
|
|
4323
4272
|
* A `Cancel` is an object that is thrown when an operation is canceled.
|
|
4324
4273
|
*
|
|
@@ -4337,19 +4286,6 @@ Cancel.prototype.__CANCEL__ = true;
|
|
|
4337
4286
|
|
|
4338
4287
|
var Cancel_1 = Cancel;
|
|
4339
4288
|
|
|
4340
|
-
'use strict';
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
4289
|
var xhr = function xhrAdapter(config) {
|
|
4354
4290
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
4355
4291
|
var requestData = config.data;
|
|
@@ -4550,12 +4486,6 @@ var xhr = function xhrAdapter(config) {
|
|
|
4550
4486
|
});
|
|
4551
4487
|
};
|
|
4552
4488
|
|
|
4553
|
-
'use strict';
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
4489
|
var DEFAULT_CONTENT_TYPE = {
|
|
4560
4490
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
4561
4491
|
};
|
|
@@ -4685,11 +4615,6 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
|
4685
4615
|
|
|
4686
4616
|
var defaults_1 = defaults;
|
|
4687
4617
|
|
|
4688
|
-
'use strict';
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
4618
|
/**
|
|
4694
4619
|
* Transform the data for a request or a response
|
|
4695
4620
|
*
|
|
@@ -4708,20 +4633,10 @@ var transformData = function transformData(data, headers, fns) {
|
|
|
4708
4633
|
return data;
|
|
4709
4634
|
};
|
|
4710
4635
|
|
|
4711
|
-
'use strict';
|
|
4712
|
-
|
|
4713
4636
|
var isCancel = function isCancel(value) {
|
|
4714
4637
|
return !!(value && value.__CANCEL__);
|
|
4715
4638
|
};
|
|
4716
4639
|
|
|
4717
|
-
'use strict';
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
4640
|
/**
|
|
4726
4641
|
* Throws a `Cancel` if cancellation has been requested.
|
|
4727
4642
|
*/
|
|
@@ -4802,10 +4717,6 @@ var dispatchRequest = function dispatchRequest(config) {
|
|
|
4802
4717
|
});
|
|
4803
4718
|
};
|
|
4804
4719
|
|
|
4805
|
-
'use strict';
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
4720
|
/**
|
|
4810
4721
|
* Config-specific merge-function which creates a new config-object
|
|
4811
4722
|
* by merging two configuration objects together.
|
|
@@ -4906,8 +4817,6 @@ var data = {
|
|
|
4906
4817
|
"version": "0.22.0"
|
|
4907
4818
|
};
|
|
4908
4819
|
|
|
4909
|
-
'use strict';
|
|
4910
|
-
|
|
4911
4820
|
var VERSION = data.version;
|
|
4912
4821
|
|
|
4913
4822
|
var validators$1 = {};
|
|
@@ -4989,15 +4898,6 @@ var validator = {
|
|
|
4989
4898
|
validators: validators$1
|
|
4990
4899
|
};
|
|
4991
4900
|
|
|
4992
|
-
'use strict';
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
4901
|
var validators = validator.validators;
|
|
5002
4902
|
/**
|
|
5003
4903
|
* Create a new instance of Axios
|
|
@@ -5138,10 +5038,6 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
|
5138
5038
|
|
|
5139
5039
|
var Axios_1 = Axios;
|
|
5140
5040
|
|
|
5141
|
-
'use strict';
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
5041
|
/**
|
|
5146
5042
|
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
|
5147
5043
|
*
|
|
@@ -5258,8 +5154,6 @@ CancelToken.source = function source() {
|
|
|
5258
5154
|
|
|
5259
5155
|
var CancelToken_1 = CancelToken;
|
|
5260
5156
|
|
|
5261
|
-
'use strict';
|
|
5262
|
-
|
|
5263
5157
|
/**
|
|
5264
5158
|
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
|
5265
5159
|
*
|
|
@@ -5286,8 +5180,6 @@ var spread = function spread(callback) {
|
|
|
5286
5180
|
};
|
|
5287
5181
|
};
|
|
5288
5182
|
|
|
5289
|
-
'use strict';
|
|
5290
|
-
|
|
5291
5183
|
/**
|
|
5292
5184
|
* Determines whether the payload is an error thrown by Axios
|
|
5293
5185
|
*
|
|
@@ -5298,14 +5190,6 @@ var isAxiosError = function isAxiosError(payload) {
|
|
|
5298
5190
|
return (typeof payload === 'object') && (payload.isAxiosError === true);
|
|
5299
5191
|
};
|
|
5300
5192
|
|
|
5301
|
-
'use strict';
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
5193
|
/**
|
|
5310
5194
|
* Create an instance of Axios
|
|
5311
5195
|
*
|
|
@@ -5359,16 +5243,10 @@ axios_1.default = _default;
|
|
|
5359
5243
|
|
|
5360
5244
|
var axios = axios_1;
|
|
5361
5245
|
|
|
5362
|
-
const timeFormat = 'HH:mm:ss';
|
|
5363
|
-
const timeFormatAmPm = 'hh:mm A';
|
|
5364
|
-
const dateName = 'dddd';
|
|
5365
5246
|
const dateFormat = 'YYYY-MM-DD';
|
|
5366
5247
|
const dateTimeFormat = 'YYYY-MM-DD HH:mm:ss';
|
|
5367
|
-
const dateTimeFormatAmPm = 'YYYY-MM-DD hh:mm A';
|
|
5368
|
-
const shortDateFormat = 'ddd, MMM DD';
|
|
5369
5248
|
const shortDateYearFormat = 'ddd, MMM DD YYYY';
|
|
5370
5249
|
const apiV1Prefix = 'api';
|
|
5371
|
-
const apiV2Prefix$1 = 'api-ver2';
|
|
5372
5250
|
const defaultImage = 'https://res.cloudinary.com/reckon-mini-sites/image/upload/v1636477599/FaveSalon%20Social%20Website/default/default--picture_w3jvfh.png';
|
|
5373
5251
|
|
|
5374
5252
|
var BusinessHourStatus;
|
|
@@ -6031,12 +5909,6 @@ const getDefaultEmulatorHostnameAndPort = (productName) => {
|
|
|
6031
5909
|
* @public
|
|
6032
5910
|
*/
|
|
6033
5911
|
const getDefaultAppConfig = () => { var _a; return (_a = getDefaults()) === null || _a === void 0 ? void 0 : _a.config; };
|
|
6034
|
-
/**
|
|
6035
|
-
* Returns an experimental setting on the __FIREBASE_DEFAULTS__ object (properties
|
|
6036
|
-
* prefixed by "_")
|
|
6037
|
-
* @public
|
|
6038
|
-
*/
|
|
6039
|
-
const getExperimentalSetting = (name) => { var _a; return (_a = getDefaults()) === null || _a === void 0 ? void 0 : _a[`_${name}`]; };
|
|
6040
5912
|
|
|
6041
5913
|
/**
|
|
6042
5914
|
* @license
|
|
@@ -6182,42 +6054,6 @@ function isMobileCordova() {
|
|
|
6182
6054
|
!!(window['cordova'] || window['phonegap'] || window['PhoneGap']) &&
|
|
6183
6055
|
/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(getUA()));
|
|
6184
6056
|
}
|
|
6185
|
-
/**
|
|
6186
|
-
* Detect Node.js.
|
|
6187
|
-
*
|
|
6188
|
-
* @return true if Node.js environment is detected or specified.
|
|
6189
|
-
*/
|
|
6190
|
-
// Node detection logic from: https://github.com/iliakan/detect-node/
|
|
6191
|
-
function isNode() {
|
|
6192
|
-
var _a;
|
|
6193
|
-
const forceEnvironment = (_a = getDefaults()) === null || _a === void 0 ? void 0 : _a.forceEnvironment;
|
|
6194
|
-
if (forceEnvironment === 'node') {
|
|
6195
|
-
return true;
|
|
6196
|
-
}
|
|
6197
|
-
else if (forceEnvironment === 'browser') {
|
|
6198
|
-
return false;
|
|
6199
|
-
}
|
|
6200
|
-
try {
|
|
6201
|
-
return (Object.prototype.toString.call(global.process) === '[object process]');
|
|
6202
|
-
}
|
|
6203
|
-
catch (e) {
|
|
6204
|
-
return false;
|
|
6205
|
-
}
|
|
6206
|
-
}
|
|
6207
|
-
/**
|
|
6208
|
-
* Detect Browser Environment
|
|
6209
|
-
*/
|
|
6210
|
-
function isBrowser() {
|
|
6211
|
-
return typeof self === 'object' && self.self === self;
|
|
6212
|
-
}
|
|
6213
|
-
function isBrowserExtension() {
|
|
6214
|
-
const runtime = typeof chrome === 'object'
|
|
6215
|
-
? chrome.runtime
|
|
6216
|
-
: typeof browser === 'object'
|
|
6217
|
-
? browser.runtime
|
|
6218
|
-
: undefined;
|
|
6219
|
-
return typeof runtime === 'object' && runtime.id !== undefined;
|
|
6220
|
-
}
|
|
6221
6057
|
/**
|
|
6222
6058
|
* Detect React Native.
|
|
6223
6059
|
*
|
|
@@ -6226,32 +6062,13 @@ function isBrowserExtension() {
|
|
|
6226
6062
|
function isReactNative() {
|
|
6227
6063
|
return (typeof navigator === 'object' && navigator['product'] === 'ReactNative');
|
|
6228
6064
|
}
|
|
6229
|
-
/** Detects Electron apps. */
|
|
6230
|
-
function isElectron() {
|
|
6231
|
-
return getUA().indexOf('Electron/') >= 0;
|
|
6232
|
-
}
|
|
6233
|
-
/** Detects Internet Explorer. */
|
|
6234
|
-
function isIE() {
|
|
6235
|
-
const ua = getUA();
|
|
6236
|
-
return ua.indexOf('MSIE ') >= 0 || ua.indexOf('Trident/') >= 0;
|
|
6237
|
-
}
|
|
6238
|
-
/** Detects Universal Windows Platform apps. */
|
|
6239
|
-
function isUWP() {
|
|
6240
|
-
return getUA().indexOf('MSAppHost/') >= 0;
|
|
6241
|
-
}
|
|
6242
6065
|
/**
|
|
6243
6066
|
* Detect whether the current SDK build is the Node version.
|
|
6244
6067
|
*
|
|
6245
6068
|
* @return true if it's the Node SDK build.
|
|
6246
6069
|
*/
|
|
6247
6070
|
function isNodeSdk() {
|
|
6248
|
-
return CONSTANTS.
|
|
6249
|
-
}
|
|
6250
|
-
/** Returns true if we are running in Safari. */
|
|
6251
|
-
function isSafari() {
|
|
6252
|
-
return (!isNode() &&
|
|
6253
|
-
navigator.userAgent.includes('Safari') &&
|
|
6254
|
-
!navigator.userAgent.includes('Chrome'));
|
|
6071
|
+
return CONSTANTS.NODE_ADMIN === true;
|
|
6255
6072
|
}
|
|
6256
6073
|
/**
|
|
6257
6074
|
* This method checks if indexedDB is supported by current browser/service worker context
|
|
@@ -6299,17 +6116,6 @@ function validateIndexedDBOpenable() {
|
|
|
6299
6116
|
}
|
|
6300
6117
|
});
|
|
6301
6118
|
}
|
|
6302
|
-
/**
|
|
6303
|
-
*
|
|
6304
|
-
* This method checks whether cookie is enabled within current browser
|
|
6305
|
-
* @return true if cookie is enabled within current browser
|
|
6306
|
-
*/
|
|
6307
|
-
function areCookiesEnabled() {
|
|
6308
|
-
if (typeof navigator === 'undefined' || !navigator.cookieEnabled) {
|
|
6309
|
-
return false;
|
|
6310
|
-
}
|
|
6311
|
-
return true;
|
|
6312
|
-
}
|
|
6313
6119
|
|
|
6314
6120
|
/**
|
|
6315
6121
|
* @license
|
|
@@ -6491,53 +6297,6 @@ const decode = function (token) {
|
|
|
6491
6297
|
signature
|
|
6492
6298
|
};
|
|
6493
6299
|
};
|
|
6494
|
-
/**
|
|
6495
|
-
* Decodes a Firebase auth. token and checks the validity of its time-based claims. Will return true if the
|
|
6496
|
-
* token is within the time window authorized by the 'nbf' (not-before) and 'iat' (issued-at) claims.
|
|
6497
|
-
*
|
|
6498
|
-
* Notes:
|
|
6499
|
-
* - May return a false negative if there's no native base64 decoding support.
|
|
6500
|
-
* - Doesn't check if the token is actually valid.
|
|
6501
|
-
*/
|
|
6502
|
-
const isValidTimestamp = function (token) {
|
|
6503
|
-
const claims = decode(token).claims;
|
|
6504
|
-
const now = Math.floor(new Date().getTime() / 1000);
|
|
6505
|
-
let validSince = 0, validUntil = 0;
|
|
6506
|
-
if (typeof claims === 'object') {
|
|
6507
|
-
if (claims.hasOwnProperty('nbf')) {
|
|
6508
|
-
validSince = claims['nbf'];
|
|
6509
|
-
}
|
|
6510
|
-
else if (claims.hasOwnProperty('iat')) {
|
|
6511
|
-
validSince = claims['iat'];
|
|
6512
|
-
}
|
|
6513
|
-
if (claims.hasOwnProperty('exp')) {
|
|
6514
|
-
validUntil = claims['exp'];
|
|
6515
|
-
}
|
|
6516
|
-
else {
|
|
6517
|
-
// token will expire after 24h by default
|
|
6518
|
-
validUntil = validSince + 86400;
|
|
6519
|
-
}
|
|
6520
|
-
}
|
|
6521
|
-
return (!!now &&
|
|
6522
|
-
!!validSince &&
|
|
6523
|
-
!!validUntil &&
|
|
6524
|
-
now >= validSince &&
|
|
6525
|
-
now <= validUntil);
|
|
6526
|
-
};
|
|
6527
|
-
/**
|
|
6528
|
-
* Decodes a Firebase auth. token and returns its issued at time if valid, null otherwise.
|
|
6529
|
-
*
|
|
6530
|
-
* Notes:
|
|
6531
|
-
* - May return null if there's no native base64 decoding support.
|
|
6532
|
-
* - Doesn't check if the token is actually valid.
|
|
6533
|
-
*/
|
|
6534
|
-
const issuedAtTime = function (token) {
|
|
6535
|
-
const claims = decode(token).claims;
|
|
6536
|
-
if (typeof claims === 'object' && claims.hasOwnProperty('iat')) {
|
|
6537
|
-
return claims['iat'];
|
|
6538
|
-
}
|
|
6539
|
-
return null;
|
|
6540
|
-
};
|
|
6541
6300
|
/**
|
|
6542
6301
|
* Decodes a Firebase auth. token and checks the validity of its format. Expects a valid issued-at time.
|
|
6543
6302
|
*
|
|
@@ -6640,33 +6399,6 @@ function isObject(thing) {
|
|
|
6640
6399
|
return thing !== null && typeof thing === 'object';
|
|
6641
6400
|
}
|
|
6642
6401
|
|
|
6643
|
-
/**
|
|
6644
|
-
* @license
|
|
6645
|
-
* Copyright 2022 Google LLC
|
|
6646
|
-
*
|
|
6647
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6648
|
-
* you may not use this file except in compliance with the License.
|
|
6649
|
-
* You may obtain a copy of the License at
|
|
6650
|
-
*
|
|
6651
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
6652
|
-
*
|
|
6653
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
6654
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
6655
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6656
|
-
* See the License for the specific language governing permissions and
|
|
6657
|
-
* limitations under the License.
|
|
6658
|
-
*/
|
|
6659
|
-
/**
|
|
6660
|
-
* Rejects if the given promise doesn't resolve in timeInMS milliseconds.
|
|
6661
|
-
* @internal
|
|
6662
|
-
*/
|
|
6663
|
-
function promiseWithTimeout(promise, timeInMS = 2000) {
|
|
6664
|
-
const deferredPromise = new Deferred();
|
|
6665
|
-
setTimeout(() => deferredPromise.reject('timeout!'), timeInMS);
|
|
6666
|
-
promise.then(deferredPromise.resolve, deferredPromise.reject);
|
|
6667
|
-
return deferredPromise.promise;
|
|
6668
|
-
}
|
|
6669
|
-
|
|
6670
6402
|
/**
|
|
6671
6403
|
* @license
|
|
6672
6404
|
* Copyright 2017 Google LLC
|
|
@@ -6702,32 +6434,6 @@ function querystring(querystringParams) {
|
|
|
6702
6434
|
}
|
|
6703
6435
|
return params.length ? '&' + params.join('&') : '';
|
|
6704
6436
|
}
|
|
6705
|
-
/**
|
|
6706
|
-
* Decodes a querystring (e.g. ?arg=val&arg2=val2) into a params object
|
|
6707
|
-
* (e.g. {arg: 'val', arg2: 'val2'})
|
|
6708
|
-
*/
|
|
6709
|
-
function querystringDecode(querystring) {
|
|
6710
|
-
const obj = {};
|
|
6711
|
-
const tokens = querystring.replace(/^\?/, '').split('&');
|
|
6712
|
-
tokens.forEach(token => {
|
|
6713
|
-
if (token) {
|
|
6714
|
-
const [key, value] = token.split('=');
|
|
6715
|
-
obj[decodeURIComponent(key)] = decodeURIComponent(value);
|
|
6716
|
-
}
|
|
6717
|
-
});
|
|
6718
|
-
return obj;
|
|
6719
|
-
}
|
|
6720
|
-
/**
|
|
6721
|
-
* Extract the query string part of a URL, including the leading question mark (if present).
|
|
6722
|
-
*/
|
|
6723
|
-
function extractQuerystring(url) {
|
|
6724
|
-
const queryStart = url.indexOf('?');
|
|
6725
|
-
if (!queryStart) {
|
|
6726
|
-
return '';
|
|
6727
|
-
}
|
|
6728
|
-
const fragmentStart = url.indexOf('#', queryStart);
|
|
6729
|
-
return url.substring(queryStart, fragmentStart > 0 ? fragmentStart : undefined);
|
|
6730
|
-
}
|
|
6731
6437
|
|
|
6732
6438
|
/**
|
|
6733
6439
|
* @license
|
|
@@ -6984,367 +6690,76 @@ class Sha1 {
|
|
|
6984
6690
|
return digest;
|
|
6985
6691
|
}
|
|
6986
6692
|
}
|
|
6987
|
-
|
|
6988
6693
|
/**
|
|
6989
|
-
*
|
|
6990
|
-
* Thenable).
|
|
6694
|
+
* Generates a string to prefix an error message about failed argument validation
|
|
6991
6695
|
*
|
|
6992
|
-
* @param
|
|
6993
|
-
*
|
|
6994
|
-
* @
|
|
6696
|
+
* @param fnName The function name
|
|
6697
|
+
* @param argName The name of the argument
|
|
6698
|
+
* @return The prefix to add to the error thrown for validation.
|
|
6995
6699
|
*/
|
|
6996
|
-
function
|
|
6997
|
-
|
|
6998
|
-
return proxy.subscribe.bind(proxy);
|
|
6700
|
+
function errorPrefix(fnName, argName) {
|
|
6701
|
+
return `${fnName} failed: ${argName} argument `;
|
|
6999
6702
|
}
|
|
6703
|
+
|
|
6704
|
+
/**
|
|
6705
|
+
* @license
|
|
6706
|
+
* Copyright 2017 Google LLC
|
|
6707
|
+
*
|
|
6708
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6709
|
+
* you may not use this file except in compliance with the License.
|
|
6710
|
+
* You may obtain a copy of the License at
|
|
6711
|
+
*
|
|
6712
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
6713
|
+
*
|
|
6714
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
6715
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
6716
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6717
|
+
* See the License for the specific language governing permissions and
|
|
6718
|
+
* limitations under the License.
|
|
6719
|
+
*/
|
|
6720
|
+
// Code originally came from goog.crypt.stringToUtf8ByteArray, but for some reason they
|
|
6721
|
+
// automatically replaced '\r\n' with '\n', and they didn't handle surrogate pairs,
|
|
6722
|
+
// so it's been modified.
|
|
6723
|
+
// Note that not all Unicode characters appear as single characters in JavaScript strings.
|
|
6724
|
+
// fromCharCode returns the UTF-16 encoding of a character - so some Unicode characters
|
|
6725
|
+
// use 2 characters in Javascript. All 4-byte UTF-8 characters begin with a first
|
|
6726
|
+
// character in the range 0xD800 - 0xDBFF (the first character of a so-called surrogate
|
|
6727
|
+
// pair).
|
|
6728
|
+
// See http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3
|
|
7000
6729
|
/**
|
|
7001
|
-
*
|
|
7002
|
-
*
|
|
6730
|
+
* @param {string} str
|
|
6731
|
+
* @return {Array}
|
|
7003
6732
|
*/
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
this.finalized = false;
|
|
7017
|
-
this.onNoObservers = onNoObservers;
|
|
7018
|
-
// Call the executor asynchronously so subscribers that are called
|
|
7019
|
-
// synchronously after the creation of the subscribe function
|
|
7020
|
-
// can still receive the very first value generated in the executor.
|
|
7021
|
-
this.task
|
|
7022
|
-
.then(() => {
|
|
7023
|
-
executor(this);
|
|
7024
|
-
})
|
|
7025
|
-
.catch(e => {
|
|
7026
|
-
this.error(e);
|
|
7027
|
-
});
|
|
7028
|
-
}
|
|
7029
|
-
next(value) {
|
|
7030
|
-
this.forEachObserver((observer) => {
|
|
7031
|
-
observer.next(value);
|
|
7032
|
-
});
|
|
7033
|
-
}
|
|
7034
|
-
error(error) {
|
|
7035
|
-
this.forEachObserver((observer) => {
|
|
7036
|
-
observer.error(error);
|
|
7037
|
-
});
|
|
7038
|
-
this.close(error);
|
|
7039
|
-
}
|
|
7040
|
-
complete() {
|
|
7041
|
-
this.forEachObserver((observer) => {
|
|
7042
|
-
observer.complete();
|
|
7043
|
-
});
|
|
7044
|
-
this.close();
|
|
7045
|
-
}
|
|
7046
|
-
/**
|
|
7047
|
-
* Subscribe function that can be used to add an Observer to the fan-out list.
|
|
7048
|
-
*
|
|
7049
|
-
* - We require that no event is sent to a subscriber sychronously to their
|
|
7050
|
-
* call to subscribe().
|
|
7051
|
-
*/
|
|
7052
|
-
subscribe(nextOrObserver, error, complete) {
|
|
7053
|
-
let observer;
|
|
7054
|
-
if (nextOrObserver === undefined &&
|
|
7055
|
-
error === undefined &&
|
|
7056
|
-
complete === undefined) {
|
|
7057
|
-
throw new Error('Missing Observer.');
|
|
7058
|
-
}
|
|
7059
|
-
// Assemble an Observer object when passed as callback functions.
|
|
7060
|
-
if (implementsAnyMethods(nextOrObserver, [
|
|
7061
|
-
'next',
|
|
7062
|
-
'error',
|
|
7063
|
-
'complete'
|
|
7064
|
-
])) {
|
|
7065
|
-
observer = nextOrObserver;
|
|
6733
|
+
const stringToByteArray = function (str) {
|
|
6734
|
+
const out = [];
|
|
6735
|
+
let p = 0;
|
|
6736
|
+
for (let i = 0; i < str.length; i++) {
|
|
6737
|
+
let c = str.charCodeAt(i);
|
|
6738
|
+
// Is this the lead surrogate in a surrogate pair?
|
|
6739
|
+
if (c >= 0xd800 && c <= 0xdbff) {
|
|
6740
|
+
const high = c - 0xd800; // the high 10 bits.
|
|
6741
|
+
i++;
|
|
6742
|
+
assert(i < str.length, 'Surrogate pair missing trail surrogate.');
|
|
6743
|
+
const low = str.charCodeAt(i) - 0xdc00; // the low 10 bits.
|
|
6744
|
+
c = 0x10000 + (high << 10) + low;
|
|
7066
6745
|
}
|
|
7067
|
-
|
|
7068
|
-
|
|
7069
|
-
next: nextOrObserver,
|
|
7070
|
-
error,
|
|
7071
|
-
complete
|
|
7072
|
-
};
|
|
6746
|
+
if (c < 128) {
|
|
6747
|
+
out[p++] = c;
|
|
7073
6748
|
}
|
|
7074
|
-
if (
|
|
7075
|
-
|
|
6749
|
+
else if (c < 2048) {
|
|
6750
|
+
out[p++] = (c >> 6) | 192;
|
|
6751
|
+
out[p++] = (c & 63) | 128;
|
|
7076
6752
|
}
|
|
7077
|
-
if (
|
|
7078
|
-
|
|
6753
|
+
else if (c < 65536) {
|
|
6754
|
+
out[p++] = (c >> 12) | 224;
|
|
6755
|
+
out[p++] = ((c >> 6) & 63) | 128;
|
|
6756
|
+
out[p++] = (c & 63) | 128;
|
|
7079
6757
|
}
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
// just respond to the Observer with the final error or complete
|
|
7086
|
-
// event.
|
|
7087
|
-
if (this.finalized) {
|
|
7088
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
7089
|
-
this.task.then(() => {
|
|
7090
|
-
try {
|
|
7091
|
-
if (this.finalError) {
|
|
7092
|
-
observer.error(this.finalError);
|
|
7093
|
-
}
|
|
7094
|
-
else {
|
|
7095
|
-
observer.complete();
|
|
7096
|
-
}
|
|
7097
|
-
}
|
|
7098
|
-
catch (e) {
|
|
7099
|
-
// nothing
|
|
7100
|
-
}
|
|
7101
|
-
return;
|
|
7102
|
-
});
|
|
7103
|
-
}
|
|
7104
|
-
this.observers.push(observer);
|
|
7105
|
-
return unsub;
|
|
7106
|
-
}
|
|
7107
|
-
// Unsubscribe is synchronous - we guarantee that no events are sent to
|
|
7108
|
-
// any unsubscribed Observer.
|
|
7109
|
-
unsubscribeOne(i) {
|
|
7110
|
-
if (this.observers === undefined || this.observers[i] === undefined) {
|
|
7111
|
-
return;
|
|
7112
|
-
}
|
|
7113
|
-
delete this.observers[i];
|
|
7114
|
-
this.observerCount -= 1;
|
|
7115
|
-
if (this.observerCount === 0 && this.onNoObservers !== undefined) {
|
|
7116
|
-
this.onNoObservers(this);
|
|
7117
|
-
}
|
|
7118
|
-
}
|
|
7119
|
-
forEachObserver(fn) {
|
|
7120
|
-
if (this.finalized) {
|
|
7121
|
-
// Already closed by previous event....just eat the additional values.
|
|
7122
|
-
return;
|
|
7123
|
-
}
|
|
7124
|
-
// Since sendOne calls asynchronously - there is no chance that
|
|
7125
|
-
// this.observers will become undefined.
|
|
7126
|
-
for (let i = 0; i < this.observers.length; i++) {
|
|
7127
|
-
this.sendOne(i, fn);
|
|
7128
|
-
}
|
|
7129
|
-
}
|
|
7130
|
-
// Call the Observer via one of it's callback function. We are careful to
|
|
7131
|
-
// confirm that the observe has not been unsubscribed since this asynchronous
|
|
7132
|
-
// function had been queued.
|
|
7133
|
-
sendOne(i, fn) {
|
|
7134
|
-
// Execute the callback asynchronously
|
|
7135
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
7136
|
-
this.task.then(() => {
|
|
7137
|
-
if (this.observers !== undefined && this.observers[i] !== undefined) {
|
|
7138
|
-
try {
|
|
7139
|
-
fn(this.observers[i]);
|
|
7140
|
-
}
|
|
7141
|
-
catch (e) {
|
|
7142
|
-
// Ignore exceptions raised in Observers or missing methods of an
|
|
7143
|
-
// Observer.
|
|
7144
|
-
// Log error to console. b/31404806
|
|
7145
|
-
if (typeof console !== 'undefined' && console.error) {
|
|
7146
|
-
console.error(e);
|
|
7147
|
-
}
|
|
7148
|
-
}
|
|
7149
|
-
}
|
|
7150
|
-
});
|
|
7151
|
-
}
|
|
7152
|
-
close(err) {
|
|
7153
|
-
if (this.finalized) {
|
|
7154
|
-
return;
|
|
7155
|
-
}
|
|
7156
|
-
this.finalized = true;
|
|
7157
|
-
if (err !== undefined) {
|
|
7158
|
-
this.finalError = err;
|
|
7159
|
-
}
|
|
7160
|
-
// Proxy is no longer needed - garbage collect references
|
|
7161
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
7162
|
-
this.task.then(() => {
|
|
7163
|
-
this.observers = undefined;
|
|
7164
|
-
this.onNoObservers = undefined;
|
|
7165
|
-
});
|
|
7166
|
-
}
|
|
7167
|
-
}
|
|
7168
|
-
/** Turn synchronous function into one called asynchronously. */
|
|
7169
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
7170
|
-
function async(fn, onError) {
|
|
7171
|
-
return (...args) => {
|
|
7172
|
-
Promise.resolve(true)
|
|
7173
|
-
.then(() => {
|
|
7174
|
-
fn(...args);
|
|
7175
|
-
})
|
|
7176
|
-
.catch((error) => {
|
|
7177
|
-
if (onError) {
|
|
7178
|
-
onError(error);
|
|
7179
|
-
}
|
|
7180
|
-
});
|
|
7181
|
-
};
|
|
7182
|
-
}
|
|
7183
|
-
/**
|
|
7184
|
-
* Return true if the object passed in implements any of the named methods.
|
|
7185
|
-
*/
|
|
7186
|
-
function implementsAnyMethods(obj, methods) {
|
|
7187
|
-
if (typeof obj !== 'object' || obj === null) {
|
|
7188
|
-
return false;
|
|
7189
|
-
}
|
|
7190
|
-
for (const method of methods) {
|
|
7191
|
-
if (method in obj && typeof obj[method] === 'function') {
|
|
7192
|
-
return true;
|
|
7193
|
-
}
|
|
7194
|
-
}
|
|
7195
|
-
return false;
|
|
7196
|
-
}
|
|
7197
|
-
function noop() {
|
|
7198
|
-
// do nothing
|
|
7199
|
-
}
|
|
7200
|
-
|
|
7201
|
-
/**
|
|
7202
|
-
* @license
|
|
7203
|
-
* Copyright 2017 Google LLC
|
|
7204
|
-
*
|
|
7205
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7206
|
-
* you may not use this file except in compliance with the License.
|
|
7207
|
-
* You may obtain a copy of the License at
|
|
7208
|
-
*
|
|
7209
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7210
|
-
*
|
|
7211
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
7212
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
7213
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
7214
|
-
* See the License for the specific language governing permissions and
|
|
7215
|
-
* limitations under the License.
|
|
7216
|
-
*/
|
|
7217
|
-
/**
|
|
7218
|
-
* Check to make sure the appropriate number of arguments are provided for a public function.
|
|
7219
|
-
* Throws an error if it fails.
|
|
7220
|
-
*
|
|
7221
|
-
* @param fnName The function name
|
|
7222
|
-
* @param minCount The minimum number of arguments to allow for the function call
|
|
7223
|
-
* @param maxCount The maximum number of argument to allow for the function call
|
|
7224
|
-
* @param argCount The actual number of arguments provided.
|
|
7225
|
-
*/
|
|
7226
|
-
const validateArgCount = function (fnName, minCount, maxCount, argCount) {
|
|
7227
|
-
let argError;
|
|
7228
|
-
if (argCount < minCount) {
|
|
7229
|
-
argError = 'at least ' + minCount;
|
|
7230
|
-
}
|
|
7231
|
-
else if (argCount > maxCount) {
|
|
7232
|
-
argError = maxCount === 0 ? 'none' : 'no more than ' + maxCount;
|
|
7233
|
-
}
|
|
7234
|
-
if (argError) {
|
|
7235
|
-
const error = fnName +
|
|
7236
|
-
' failed: Was called with ' +
|
|
7237
|
-
argCount +
|
|
7238
|
-
(argCount === 1 ? ' argument.' : ' arguments.') +
|
|
7239
|
-
' Expects ' +
|
|
7240
|
-
argError +
|
|
7241
|
-
'.';
|
|
7242
|
-
throw new Error(error);
|
|
7243
|
-
}
|
|
7244
|
-
};
|
|
7245
|
-
/**
|
|
7246
|
-
* Generates a string to prefix an error message about failed argument validation
|
|
7247
|
-
*
|
|
7248
|
-
* @param fnName The function name
|
|
7249
|
-
* @param argName The name of the argument
|
|
7250
|
-
* @return The prefix to add to the error thrown for validation.
|
|
7251
|
-
*/
|
|
7252
|
-
function errorPrefix(fnName, argName) {
|
|
7253
|
-
return `${fnName} failed: ${argName} argument `;
|
|
7254
|
-
}
|
|
7255
|
-
/**
|
|
7256
|
-
* @param fnName
|
|
7257
|
-
* @param argumentNumber
|
|
7258
|
-
* @param namespace
|
|
7259
|
-
* @param optional
|
|
7260
|
-
*/
|
|
7261
|
-
function validateNamespace(fnName, namespace, optional) {
|
|
7262
|
-
if (optional && !namespace) {
|
|
7263
|
-
return;
|
|
7264
|
-
}
|
|
7265
|
-
if (typeof namespace !== 'string') {
|
|
7266
|
-
//TODO: I should do more validation here. We only allow certain chars in namespaces.
|
|
7267
|
-
throw new Error(errorPrefix(fnName, 'namespace') + 'must be a valid firebase namespace.');
|
|
7268
|
-
}
|
|
7269
|
-
}
|
|
7270
|
-
function validateCallback(fnName, argumentName,
|
|
7271
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
7272
|
-
callback, optional) {
|
|
7273
|
-
if (optional && !callback) {
|
|
7274
|
-
return;
|
|
7275
|
-
}
|
|
7276
|
-
if (typeof callback !== 'function') {
|
|
7277
|
-
throw new Error(errorPrefix(fnName, argumentName) + 'must be a valid function.');
|
|
7278
|
-
}
|
|
7279
|
-
}
|
|
7280
|
-
function validateContextObject(fnName, argumentName, context, optional) {
|
|
7281
|
-
if (optional && !context) {
|
|
7282
|
-
return;
|
|
7283
|
-
}
|
|
7284
|
-
if (typeof context !== 'object' || context === null) {
|
|
7285
|
-
throw new Error(errorPrefix(fnName, argumentName) + 'must be a valid context object.');
|
|
7286
|
-
}
|
|
7287
|
-
}
|
|
7288
|
-
|
|
7289
|
-
/**
|
|
7290
|
-
* @license
|
|
7291
|
-
* Copyright 2017 Google LLC
|
|
7292
|
-
*
|
|
7293
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7294
|
-
* you may not use this file except in compliance with the License.
|
|
7295
|
-
* You may obtain a copy of the License at
|
|
7296
|
-
*
|
|
7297
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7298
|
-
*
|
|
7299
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
7300
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
7301
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
7302
|
-
* See the License for the specific language governing permissions and
|
|
7303
|
-
* limitations under the License.
|
|
7304
|
-
*/
|
|
7305
|
-
// Code originally came from goog.crypt.stringToUtf8ByteArray, but for some reason they
|
|
7306
|
-
// automatically replaced '\r\n' with '\n', and they didn't handle surrogate pairs,
|
|
7307
|
-
// so it's been modified.
|
|
7308
|
-
// Note that not all Unicode characters appear as single characters in JavaScript strings.
|
|
7309
|
-
// fromCharCode returns the UTF-16 encoding of a character - so some Unicode characters
|
|
7310
|
-
// use 2 characters in Javascript. All 4-byte UTF-8 characters begin with a first
|
|
7311
|
-
// character in the range 0xD800 - 0xDBFF (the first character of a so-called surrogate
|
|
7312
|
-
// pair).
|
|
7313
|
-
// See http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3
|
|
7314
|
-
/**
|
|
7315
|
-
* @param {string} str
|
|
7316
|
-
* @return {Array}
|
|
7317
|
-
*/
|
|
7318
|
-
const stringToByteArray = function (str) {
|
|
7319
|
-
const out = [];
|
|
7320
|
-
let p = 0;
|
|
7321
|
-
for (let i = 0; i < str.length; i++) {
|
|
7322
|
-
let c = str.charCodeAt(i);
|
|
7323
|
-
// Is this the lead surrogate in a surrogate pair?
|
|
7324
|
-
if (c >= 0xd800 && c <= 0xdbff) {
|
|
7325
|
-
const high = c - 0xd800; // the high 10 bits.
|
|
7326
|
-
i++;
|
|
7327
|
-
assert(i < str.length, 'Surrogate pair missing trail surrogate.');
|
|
7328
|
-
const low = str.charCodeAt(i) - 0xdc00; // the low 10 bits.
|
|
7329
|
-
c = 0x10000 + (high << 10) + low;
|
|
7330
|
-
}
|
|
7331
|
-
if (c < 128) {
|
|
7332
|
-
out[p++] = c;
|
|
7333
|
-
}
|
|
7334
|
-
else if (c < 2048) {
|
|
7335
|
-
out[p++] = (c >> 6) | 192;
|
|
7336
|
-
out[p++] = (c & 63) | 128;
|
|
7337
|
-
}
|
|
7338
|
-
else if (c < 65536) {
|
|
7339
|
-
out[p++] = (c >> 12) | 224;
|
|
7340
|
-
out[p++] = ((c >> 6) & 63) | 128;
|
|
7341
|
-
out[p++] = (c & 63) | 128;
|
|
7342
|
-
}
|
|
7343
|
-
else {
|
|
7344
|
-
out[p++] = (c >> 18) | 240;
|
|
7345
|
-
out[p++] = ((c >> 12) & 63) | 128;
|
|
7346
|
-
out[p++] = ((c >> 6) & 63) | 128;
|
|
7347
|
-
out[p++] = (c & 63) | 128;
|
|
6758
|
+
else {
|
|
6759
|
+
out[p++] = (c >> 18) | 240;
|
|
6760
|
+
out[p++] = ((c >> 12) & 63) | 128;
|
|
6761
|
+
out[p++] = ((c >> 6) & 63) | 128;
|
|
6762
|
+
out[p++] = (c & 63) | 128;
|
|
7348
6763
|
}
|
|
7349
6764
|
}
|
|
7350
6765
|
return out;
|
|
@@ -7376,143 +6791,6 @@ const stringLength = function (str) {
|
|
|
7376
6791
|
return p;
|
|
7377
6792
|
};
|
|
7378
6793
|
|
|
7379
|
-
/**
|
|
7380
|
-
* @license
|
|
7381
|
-
* Copyright 2022 Google LLC
|
|
7382
|
-
*
|
|
7383
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7384
|
-
* you may not use this file except in compliance with the License.
|
|
7385
|
-
* You may obtain a copy of the License at
|
|
7386
|
-
*
|
|
7387
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7388
|
-
*
|
|
7389
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
7390
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
7391
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
7392
|
-
* See the License for the specific language governing permissions and
|
|
7393
|
-
* limitations under the License.
|
|
7394
|
-
*/
|
|
7395
|
-
/**
|
|
7396
|
-
* Copied from https://stackoverflow.com/a/2117523
|
|
7397
|
-
* Generates a new uuid.
|
|
7398
|
-
* @public
|
|
7399
|
-
*/
|
|
7400
|
-
const uuidv4 = function () {
|
|
7401
|
-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
|
|
7402
|
-
const r = (Math.random() * 16) | 0, v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
7403
|
-
return v.toString(16);
|
|
7404
|
-
});
|
|
7405
|
-
};
|
|
7406
|
-
|
|
7407
|
-
/**
|
|
7408
|
-
* @license
|
|
7409
|
-
* Copyright 2019 Google LLC
|
|
7410
|
-
*
|
|
7411
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7412
|
-
* you may not use this file except in compliance with the License.
|
|
7413
|
-
* You may obtain a copy of the License at
|
|
7414
|
-
*
|
|
7415
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7416
|
-
*
|
|
7417
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
7418
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
7419
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
7420
|
-
* See the License for the specific language governing permissions and
|
|
7421
|
-
* limitations under the License.
|
|
7422
|
-
*/
|
|
7423
|
-
/**
|
|
7424
|
-
* The amount of milliseconds to exponentially increase.
|
|
7425
|
-
*/
|
|
7426
|
-
const DEFAULT_INTERVAL_MILLIS = 1000;
|
|
7427
|
-
/**
|
|
7428
|
-
* The factor to backoff by.
|
|
7429
|
-
* Should be a number greater than 1.
|
|
7430
|
-
*/
|
|
7431
|
-
const DEFAULT_BACKOFF_FACTOR = 2;
|
|
7432
|
-
/**
|
|
7433
|
-
* The maximum milliseconds to increase to.
|
|
7434
|
-
*
|
|
7435
|
-
* <p>Visible for testing
|
|
7436
|
-
*/
|
|
7437
|
-
const MAX_VALUE_MILLIS = 4 * 60 * 60 * 1000; // Four hours, like iOS and Android.
|
|
7438
|
-
/**
|
|
7439
|
-
* The percentage of backoff time to randomize by.
|
|
7440
|
-
* See
|
|
7441
|
-
* http://go/safe-client-behavior#step-1-determine-the-appropriate-retry-interval-to-handle-spike-traffic
|
|
7442
|
-
* for context.
|
|
7443
|
-
*
|
|
7444
|
-
* <p>Visible for testing
|
|
7445
|
-
*/
|
|
7446
|
-
const RANDOM_FACTOR = 0.5;
|
|
7447
|
-
/**
|
|
7448
|
-
* Based on the backoff method from
|
|
7449
|
-
* https://github.com/google/closure-library/blob/master/closure/goog/math/exponentialbackoff.js.
|
|
7450
|
-
* Extracted here so we don't need to pass metadata and a stateful ExponentialBackoff object around.
|
|
7451
|
-
*/
|
|
7452
|
-
function calculateBackoffMillis(backoffCount, intervalMillis = DEFAULT_INTERVAL_MILLIS, backoffFactor = DEFAULT_BACKOFF_FACTOR) {
|
|
7453
|
-
// Calculates an exponentially increasing value.
|
|
7454
|
-
// Deviation: calculates value from count and a constant interval, so we only need to save value
|
|
7455
|
-
// and count to restore state.
|
|
7456
|
-
const currBaseValue = intervalMillis * Math.pow(backoffFactor, backoffCount);
|
|
7457
|
-
// A random "fuzz" to avoid waves of retries.
|
|
7458
|
-
// Deviation: randomFactor is required.
|
|
7459
|
-
const randomWait = Math.round(
|
|
7460
|
-
// A fraction of the backoff value to add/subtract.
|
|
7461
|
-
// Deviation: changes multiplication order to improve readability.
|
|
7462
|
-
RANDOM_FACTOR *
|
|
7463
|
-
currBaseValue *
|
|
7464
|
-
// A random float (rounded to int by Math.round above) in the range [-1, 1]. Determines
|
|
7465
|
-
// if we add or subtract.
|
|
7466
|
-
(Math.random() - 0.5) *
|
|
7467
|
-
2);
|
|
7468
|
-
// Limits backoff to max to avoid effectively permanent backoff.
|
|
7469
|
-
return Math.min(MAX_VALUE_MILLIS, currBaseValue + randomWait);
|
|
7470
|
-
}
|
|
7471
|
-
|
|
7472
|
-
/**
|
|
7473
|
-
* @license
|
|
7474
|
-
* Copyright 2020 Google LLC
|
|
7475
|
-
*
|
|
7476
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7477
|
-
* you may not use this file except in compliance with the License.
|
|
7478
|
-
* You may obtain a copy of the License at
|
|
7479
|
-
*
|
|
7480
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7481
|
-
*
|
|
7482
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
7483
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
7484
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
7485
|
-
* See the License for the specific language governing permissions and
|
|
7486
|
-
* limitations under the License.
|
|
7487
|
-
*/
|
|
7488
|
-
/**
|
|
7489
|
-
* Provide English ordinal letters after a number
|
|
7490
|
-
*/
|
|
7491
|
-
function ordinal(i) {
|
|
7492
|
-
if (!Number.isFinite(i)) {
|
|
7493
|
-
return `${i}`;
|
|
7494
|
-
}
|
|
7495
|
-
return i + indicator(i);
|
|
7496
|
-
}
|
|
7497
|
-
function indicator(i) {
|
|
7498
|
-
i = Math.abs(i);
|
|
7499
|
-
const cent = i % 100;
|
|
7500
|
-
if (cent >= 10 && cent <= 20) {
|
|
7501
|
-
return 'th';
|
|
7502
|
-
}
|
|
7503
|
-
const dec = i % 10;
|
|
7504
|
-
if (dec === 1) {
|
|
7505
|
-
return 'st';
|
|
7506
|
-
}
|
|
7507
|
-
if (dec === 2) {
|
|
7508
|
-
return 'nd';
|
|
7509
|
-
}
|
|
7510
|
-
if (dec === 3) {
|
|
7511
|
-
return 'rd';
|
|
7512
|
-
}
|
|
7513
|
-
return 'th';
|
|
7514
|
-
}
|
|
7515
|
-
|
|
7516
6794
|
/**
|
|
7517
6795
|
* @license
|
|
7518
6796
|
* Copyright 2021 Google LLC
|
|
@@ -7959,10 +7237,6 @@ class ComponentContainer {
|
|
|
7959
7237
|
* See the License for the specific language governing permissions and
|
|
7960
7238
|
* limitations under the License.
|
|
7961
7239
|
*/
|
|
7962
|
-
/**
|
|
7963
|
-
* A container for all of the Logger instances
|
|
7964
|
-
*/
|
|
7965
|
-
const instances = [];
|
|
7966
7240
|
/**
|
|
7967
7241
|
* The JS SDK supports 5 log levels and also allows a user the ability to
|
|
7968
7242
|
* silence the logs altogether.
|
|
@@ -8048,10 +7322,6 @@ class Logger {
|
|
|
8048
7322
|
* The optional, additional, user-defined log handler for the Logger instance.
|
|
8049
7323
|
*/
|
|
8050
7324
|
this._userLogHandler = null;
|
|
8051
|
-
/**
|
|
8052
|
-
* Capture the current instance for later use
|
|
8053
|
-
*/
|
|
8054
|
-
instances.push(this);
|
|
8055
7325
|
}
|
|
8056
7326
|
get logLevel() {
|
|
8057
7327
|
return this._logLevel;
|
|
@@ -8105,59 +7375,6 @@ class Logger {
|
|
|
8105
7375
|
this._userLogHandler && this._userLogHandler(this, LogLevel.ERROR, ...args);
|
|
8106
7376
|
this._logHandler(this, LogLevel.ERROR, ...args);
|
|
8107
7377
|
}
|
|
8108
|
-
}
|
|
8109
|
-
function setLogLevel$1(level) {
|
|
8110
|
-
instances.forEach(inst => {
|
|
8111
|
-
inst.setLogLevel(level);
|
|
8112
|
-
});
|
|
8113
|
-
}
|
|
8114
|
-
function setUserLogHandler(logCallback, options) {
|
|
8115
|
-
for (const instance of instances) {
|
|
8116
|
-
let customLogLevel = null;
|
|
8117
|
-
if (options && options.level) {
|
|
8118
|
-
customLogLevel = levelStringToEnum[options.level];
|
|
8119
|
-
}
|
|
8120
|
-
if (logCallback === null) {
|
|
8121
|
-
instance.userLogHandler = null;
|
|
8122
|
-
}
|
|
8123
|
-
else {
|
|
8124
|
-
instance.userLogHandler = (instance, level, ...args) => {
|
|
8125
|
-
const message = args
|
|
8126
|
-
.map(arg => {
|
|
8127
|
-
if (arg == null) {
|
|
8128
|
-
return null;
|
|
8129
|
-
}
|
|
8130
|
-
else if (typeof arg === 'string') {
|
|
8131
|
-
return arg;
|
|
8132
|
-
}
|
|
8133
|
-
else if (typeof arg === 'number' || typeof arg === 'boolean') {
|
|
8134
|
-
return arg.toString();
|
|
8135
|
-
}
|
|
8136
|
-
else if (arg instanceof Error) {
|
|
8137
|
-
return arg.message;
|
|
8138
|
-
}
|
|
8139
|
-
else {
|
|
8140
|
-
try {
|
|
8141
|
-
return JSON.stringify(arg);
|
|
8142
|
-
}
|
|
8143
|
-
catch (ignored) {
|
|
8144
|
-
return null;
|
|
8145
|
-
}
|
|
8146
|
-
}
|
|
8147
|
-
})
|
|
8148
|
-
.filter(arg => arg)
|
|
8149
|
-
.join(' ');
|
|
8150
|
-
if (level >= (customLogLevel !== null && customLogLevel !== void 0 ? customLogLevel : instance.logLevel)) {
|
|
8151
|
-
logCallback({
|
|
8152
|
-
level: LogLevel[level].toLowerCase(),
|
|
8153
|
-
message,
|
|
8154
|
-
args,
|
|
8155
|
-
type: instance.name
|
|
8156
|
-
});
|
|
8157
|
-
}
|
|
8158
|
-
};
|
|
8159
|
-
}
|
|
8160
|
-
}
|
|
8161
7378
|
}
|
|
8162
7379
|
|
|
8163
7380
|
const instanceOfAny = (object, constructors) => constructors.some((c) => object instanceof c);
|
|
@@ -8375,20 +7592,6 @@ function openDB(name, version, { blocked, upgrade, blocking, terminated } = {})
|
|
|
8375
7592
|
.catch(() => { });
|
|
8376
7593
|
return openPromise;
|
|
8377
7594
|
}
|
|
8378
|
-
/**
|
|
8379
|
-
* Delete a database.
|
|
8380
|
-
*
|
|
8381
|
-
* @param name Name of the database.
|
|
8382
|
-
*/
|
|
8383
|
-
function deleteDB(name, { blocked } = {}) {
|
|
8384
|
-
const request = indexedDB.deleteDatabase(name);
|
|
8385
|
-
if (blocked) {
|
|
8386
|
-
request.addEventListener('blocked', (event) => blocked(
|
|
8387
|
-
// Casting due to https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1405
|
|
8388
|
-
event.oldVersion, event));
|
|
8389
|
-
}
|
|
8390
|
-
return wrap(request).then(() => undefined);
|
|
8391
|
-
}
|
|
8392
7595
|
|
|
8393
7596
|
const readMethods = ['get', 'getKey', 'getAll', 'getAllKeys', 'count'];
|
|
8394
7597
|
const writeMethods = ['put', 'add', 'delete', 'clear'];
|
|
@@ -8649,13 +7852,6 @@ function _addComponent(app, component) {
|
|
|
8649
7852
|
logger$1.debug(`Component ${component.name} failed to register with FirebaseApp ${app.name}`, e);
|
|
8650
7853
|
}
|
|
8651
7854
|
}
|
|
8652
|
-
/**
|
|
8653
|
-
*
|
|
8654
|
-
* @internal
|
|
8655
|
-
*/
|
|
8656
|
-
function _addOrOverwriteComponent(app, component) {
|
|
8657
|
-
app.container.addOrOverwriteComponent(component);
|
|
8658
|
-
}
|
|
8659
7855
|
/**
|
|
8660
7856
|
*
|
|
8661
7857
|
* @param component - the component to register
|
|
@@ -8694,25 +7890,6 @@ function _getProvider(app, name) {
|
|
|
8694
7890
|
}
|
|
8695
7891
|
return app.container.getProvider(name);
|
|
8696
7892
|
}
|
|
8697
|
-
/**
|
|
8698
|
-
*
|
|
8699
|
-
* @param app - FirebaseApp instance
|
|
8700
|
-
* @param name - service name
|
|
8701
|
-
* @param instanceIdentifier - service instance identifier in case the service supports multiple instances
|
|
8702
|
-
*
|
|
8703
|
-
* @internal
|
|
8704
|
-
*/
|
|
8705
|
-
function _removeServiceInstance(app, name, instanceIdentifier = DEFAULT_ENTRY_NAME) {
|
|
8706
|
-
_getProvider(app, name).clearInstance(instanceIdentifier);
|
|
8707
|
-
}
|
|
8708
|
-
/**
|
|
8709
|
-
* Test only
|
|
8710
|
-
*
|
|
8711
|
-
* @internal
|
|
8712
|
-
*/
|
|
8713
|
-
function _clearComponents() {
|
|
8714
|
-
_components.clear();
|
|
8715
|
-
}
|
|
8716
7893
|
|
|
8717
7894
|
/**
|
|
8718
7895
|
* @license
|
|
@@ -8911,40 +8088,6 @@ function getApp(name = DEFAULT_ENTRY_NAME) {
|
|
|
8911
8088
|
}
|
|
8912
8089
|
return app;
|
|
8913
8090
|
}
|
|
8914
|
-
/**
|
|
8915
|
-
* A (read-only) array of all initialized apps.
|
|
8916
|
-
* @public
|
|
8917
|
-
*/
|
|
8918
|
-
function getApps() {
|
|
8919
|
-
return Array.from(_apps.values());
|
|
8920
|
-
}
|
|
8921
|
-
/**
|
|
8922
|
-
* Renders this app unusable and frees the resources of all associated
|
|
8923
|
-
* services.
|
|
8924
|
-
*
|
|
8925
|
-
* @example
|
|
8926
|
-
* ```javascript
|
|
8927
|
-
* deleteApp(app)
|
|
8928
|
-
* .then(function() {
|
|
8929
|
-
* console.log("App deleted successfully");
|
|
8930
|
-
* })
|
|
8931
|
-
* .catch(function(error) {
|
|
8932
|
-
* console.log("Error deleting app:", error);
|
|
8933
|
-
* });
|
|
8934
|
-
* ```
|
|
8935
|
-
*
|
|
8936
|
-
* @public
|
|
8937
|
-
*/
|
|
8938
|
-
async function deleteApp(app) {
|
|
8939
|
-
const name = app.name;
|
|
8940
|
-
if (_apps.has(name)) {
|
|
8941
|
-
_apps.delete(name);
|
|
8942
|
-
await Promise.all(app.container
|
|
8943
|
-
.getProviders()
|
|
8944
|
-
.map(provider => provider.delete()));
|
|
8945
|
-
app.isDeleted = true;
|
|
8946
|
-
}
|
|
8947
|
-
}
|
|
8948
8091
|
/**
|
|
8949
8092
|
* Registers a library's name and version for platform logging purposes.
|
|
8950
8093
|
* @param library - Name of 1p or 3p library (e.g. firestore, angularfire)
|
|
@@ -8981,31 +8124,6 @@ function registerVersion(libraryKeyOrName, version, variant) {
|
|
|
8981
8124
|
}
|
|
8982
8125
|
_registerComponent(new Component(`${library}-version`, () => ({ library, version }), "VERSION" /* ComponentType.VERSION */));
|
|
8983
8126
|
}
|
|
8984
|
-
/**
|
|
8985
|
-
* Sets log handler for all Firebase SDKs.
|
|
8986
|
-
* @param logCallback - An optional custom log handler that executes user code whenever
|
|
8987
|
-
* the Firebase SDK makes a logging call.
|
|
8988
|
-
*
|
|
8989
|
-
* @public
|
|
8990
|
-
*/
|
|
8991
|
-
function onLog(logCallback, options) {
|
|
8992
|
-
if (logCallback !== null && typeof logCallback !== 'function') {
|
|
8993
|
-
throw ERROR_FACTORY.create("invalid-log-argument" /* AppError.INVALID_LOG_ARGUMENT */);
|
|
8994
|
-
}
|
|
8995
|
-
setUserLogHandler(logCallback, options);
|
|
8996
|
-
}
|
|
8997
|
-
/**
|
|
8998
|
-
* Sets log level for all Firebase SDKs.
|
|
8999
|
-
*
|
|
9000
|
-
* All of the log types above the current log level are captured (i.e. if
|
|
9001
|
-
* you set the log level to `info`, errors are logged, but `debug` and
|
|
9002
|
-
* `verbose` logs are not).
|
|
9003
|
-
*
|
|
9004
|
-
* @public
|
|
9005
|
-
*/
|
|
9006
|
-
function setLogLevel(logLevel) {
|
|
9007
|
-
setLogLevel$1(logLevel);
|
|
9008
|
-
}
|
|
9009
8127
|
|
|
9010
8128
|
/**
|
|
9011
8129
|
* @license
|
|
@@ -9715,7 +8833,7 @@ const isInvalidJSONNumber = function (data) {
|
|
|
9715
8833
|
data === Number.NEGATIVE_INFINITY));
|
|
9716
8834
|
};
|
|
9717
8835
|
const executeWhenDOMReady = function (fn) {
|
|
9718
|
-
if (
|
|
8836
|
+
if (document.readyState === 'complete') {
|
|
9719
8837
|
fn();
|
|
9720
8838
|
}
|
|
9721
8839
|
else {
|
|
@@ -10727,10 +9845,7 @@ class BrowserPollConnection {
|
|
|
10727
9845
|
}
|
|
10728
9846
|
// Static method, use string literal so it can be accessed in a generic way
|
|
10729
9847
|
static isAvailable() {
|
|
10730
|
-
if (
|
|
10731
|
-
return false;
|
|
10732
|
-
}
|
|
10733
|
-
else if (BrowserPollConnection.forceAllow_) {
|
|
9848
|
+
if (BrowserPollConnection.forceAllow_) {
|
|
10734
9849
|
return true;
|
|
10735
9850
|
}
|
|
10736
9851
|
else {
|
|
@@ -10816,9 +9931,6 @@ class BrowserPollConnection {
|
|
|
10816
9931
|
* trigger XHR requests in some browsers (everything but Opera basically).
|
|
10817
9932
|
*/
|
|
10818
9933
|
addDisconnectPingFrame(id, pw) {
|
|
10819
|
-
if (isNodeSdk()) {
|
|
10820
|
-
return;
|
|
10821
|
-
}
|
|
10822
9934
|
this.myDisconnFrame = document.createElement('iframe');
|
|
10823
9935
|
const urlParams = {};
|
|
10824
9936
|
urlParams[FIREBASE_LONGPOLL_DISCONN_FRAME_REQUEST_PARAM] = 't';
|
|
@@ -10865,7 +9977,7 @@ class FirebaseIFrameScriptHolder {
|
|
|
10865
9977
|
// This gets set to false when we're "closing down" the connection (e.g. we're switching transports but there's still
|
|
10866
9978
|
// incoming data from the server that we're waiting for).
|
|
10867
9979
|
this.sendNewPolls = true;
|
|
10868
|
-
|
|
9980
|
+
{
|
|
10869
9981
|
//Each script holder registers a couple of uniquely named callbacks with the window. These are called from the
|
|
10870
9982
|
//iframes where we put the long-polling script tags. We have two callbacks:
|
|
10871
9983
|
// 1) Command Callback - Triggered for control issues, like starting a connection.
|
|
@@ -10899,10 +10011,6 @@ class FirebaseIFrameScriptHolder {
|
|
|
10899
10011
|
log(e);
|
|
10900
10012
|
}
|
|
10901
10013
|
}
|
|
10902
|
-
else {
|
|
10903
|
-
this.commandCB = commandCB;
|
|
10904
|
-
this.onMessageCB = onMessageCB;
|
|
10905
|
-
}
|
|
10906
10014
|
}
|
|
10907
10015
|
/**
|
|
10908
10016
|
* Each browser has its own funny way to handle iframes. Here we mush them all together into one object that I can
|
|
@@ -11096,11 +10204,7 @@ class FirebaseIFrameScriptHolder {
|
|
|
11096
10204
|
* @param loadCB - A callback to be triggered once the script has loaded.
|
|
11097
10205
|
*/
|
|
11098
10206
|
addTag(url, loadCB) {
|
|
11099
|
-
|
|
11100
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11101
|
-
this.doNodeLongPoll(url, loadCB);
|
|
11102
|
-
}
|
|
11103
|
-
else {
|
|
10207
|
+
{
|
|
11104
10208
|
setTimeout(() => {
|
|
11105
10209
|
try {
|
|
11106
10210
|
// if we're already closed, don't add this poll
|
|
@@ -11205,8 +10309,7 @@ class WebSocketConnection {
|
|
|
11205
10309
|
static connectionURL_(repoInfo, transportSessionId, lastSessionId, appCheckToken, applicationId) {
|
|
11206
10310
|
const urlParams = {};
|
|
11207
10311
|
urlParams[VERSION_PARAM] = PROTOCOL_VERSION;
|
|
11208
|
-
if (
|
|
11209
|
-
typeof location !== 'undefined' &&
|
|
10312
|
+
if (typeof location !== 'undefined' &&
|
|
11210
10313
|
location.hostname &&
|
|
11211
10314
|
FORGE_DOMAIN_RE.test(location.hostname)) {
|
|
11212
10315
|
urlParams[REFERER_PARAM] = FORGE_REF;
|
|
@@ -11238,35 +10341,6 @@ class WebSocketConnection {
|
|
|
11238
10341
|
PersistentStorage.set('previous_websocket_failure', true);
|
|
11239
10342
|
try {
|
|
11240
10343
|
let options;
|
|
11241
|
-
if (isNodeSdk()) {
|
|
11242
|
-
const device = this.nodeAdmin ? 'AdminNode' : 'Node';
|
|
11243
|
-
// UA Format: Firebase/<wire_protocol>/<sdk_version>/<platform>/<device>
|
|
11244
|
-
options = {
|
|
11245
|
-
headers: {
|
|
11246
|
-
'User-Agent': `Firebase/${PROTOCOL_VERSION}/${SDK_VERSION}/${process.platform}/${device}`,
|
|
11247
|
-
'X-Firebase-GMPID': this.applicationId || ''
|
|
11248
|
-
}
|
|
11249
|
-
};
|
|
11250
|
-
// If using Node with admin creds, AppCheck-related checks are unnecessary.
|
|
11251
|
-
// Note that we send the credentials here even if they aren't admin credentials, which is
|
|
11252
|
-
// not a problem.
|
|
11253
|
-
// Note that this header is just used to bypass appcheck, and the token should still be sent
|
|
11254
|
-
// through the websocket connection once it is established.
|
|
11255
|
-
if (this.authToken) {
|
|
11256
|
-
options.headers['Authorization'] = `Bearer ${this.authToken}`;
|
|
11257
|
-
}
|
|
11258
|
-
if (this.appCheckToken) {
|
|
11259
|
-
options.headers['X-Firebase-AppCheck'] = this.appCheckToken;
|
|
11260
|
-
}
|
|
11261
|
-
// Plumb appropriate http_proxy environment variable into faye-websocket if it exists.
|
|
11262
|
-
const env = process['env'];
|
|
11263
|
-
const proxy = this.connURL.indexOf('wss://') === 0
|
|
11264
|
-
? env['HTTPS_PROXY'] || env['https_proxy']
|
|
11265
|
-
: env['HTTP_PROXY'] || env['http_proxy'];
|
|
11266
|
-
if (proxy) {
|
|
11267
|
-
options['proxy'] = { origin: proxy };
|
|
11268
|
-
}
|
|
11269
|
-
}
|
|
11270
10344
|
this.mySock = new WebSocketImpl(this.connURL, [], options);
|
|
11271
10345
|
}
|
|
11272
10346
|
catch (e) {
|
|
@@ -13341,14 +12415,6 @@ class PersistentConnection extends ServerActions {
|
|
|
13341
12415
|
sendConnectStats_() {
|
|
13342
12416
|
const stats = {};
|
|
13343
12417
|
let clientName = 'js';
|
|
13344
|
-
if (isNodeSdk()) {
|
|
13345
|
-
if (this.repoInfo_.nodeAdmin) {
|
|
13346
|
-
clientName = 'admin_node';
|
|
13347
|
-
}
|
|
13348
|
-
else {
|
|
13349
|
-
clientName = 'node';
|
|
13350
|
-
}
|
|
13351
|
-
}
|
|
13352
12418
|
stats['sdk.' + clientName + '.' + SDK_VERSION.replace(/\./g, '-')] = 1;
|
|
13353
12419
|
if (isMobileCordova()) {
|
|
13354
12420
|
stats['framework.cordova'] = 1;
|
|
@@ -15944,81 +15010,6 @@ function queryParamsGetNodeFilter(queryParams) {
|
|
|
15944
15010
|
return new RangedFilter(queryParams);
|
|
15945
15011
|
}
|
|
15946
15012
|
}
|
|
15947
|
-
function queryParamsLimitToFirst(queryParams, newLimit) {
|
|
15948
|
-
const newParams = queryParams.copy();
|
|
15949
|
-
newParams.limitSet_ = true;
|
|
15950
|
-
newParams.limit_ = newLimit;
|
|
15951
|
-
newParams.viewFrom_ = "l" /* WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_LEFT */;
|
|
15952
|
-
return newParams;
|
|
15953
|
-
}
|
|
15954
|
-
function queryParamsLimitToLast(queryParams, newLimit) {
|
|
15955
|
-
const newParams = queryParams.copy();
|
|
15956
|
-
newParams.limitSet_ = true;
|
|
15957
|
-
newParams.limit_ = newLimit;
|
|
15958
|
-
newParams.viewFrom_ = "r" /* WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_RIGHT */;
|
|
15959
|
-
return newParams;
|
|
15960
|
-
}
|
|
15961
|
-
function queryParamsStartAt(queryParams, indexValue, key) {
|
|
15962
|
-
const newParams = queryParams.copy();
|
|
15963
|
-
newParams.startSet_ = true;
|
|
15964
|
-
if (indexValue === undefined) {
|
|
15965
|
-
indexValue = null;
|
|
15966
|
-
}
|
|
15967
|
-
newParams.indexStartValue_ = indexValue;
|
|
15968
|
-
if (key != null) {
|
|
15969
|
-
newParams.startNameSet_ = true;
|
|
15970
|
-
newParams.indexStartName_ = key;
|
|
15971
|
-
}
|
|
15972
|
-
else {
|
|
15973
|
-
newParams.startNameSet_ = false;
|
|
15974
|
-
newParams.indexStartName_ = '';
|
|
15975
|
-
}
|
|
15976
|
-
return newParams;
|
|
15977
|
-
}
|
|
15978
|
-
function queryParamsStartAfter(queryParams, indexValue, key) {
|
|
15979
|
-
let params;
|
|
15980
|
-
if (queryParams.index_ === KEY_INDEX || !!key) {
|
|
15981
|
-
params = queryParamsStartAt(queryParams, indexValue, key);
|
|
15982
|
-
}
|
|
15983
|
-
else {
|
|
15984
|
-
params = queryParamsStartAt(queryParams, indexValue, MAX_NAME);
|
|
15985
|
-
}
|
|
15986
|
-
params.startAfterSet_ = true;
|
|
15987
|
-
return params;
|
|
15988
|
-
}
|
|
15989
|
-
function queryParamsEndAt(queryParams, indexValue, key) {
|
|
15990
|
-
const newParams = queryParams.copy();
|
|
15991
|
-
newParams.endSet_ = true;
|
|
15992
|
-
if (indexValue === undefined) {
|
|
15993
|
-
indexValue = null;
|
|
15994
|
-
}
|
|
15995
|
-
newParams.indexEndValue_ = indexValue;
|
|
15996
|
-
if (key !== undefined) {
|
|
15997
|
-
newParams.endNameSet_ = true;
|
|
15998
|
-
newParams.indexEndName_ = key;
|
|
15999
|
-
}
|
|
16000
|
-
else {
|
|
16001
|
-
newParams.endNameSet_ = false;
|
|
16002
|
-
newParams.indexEndName_ = '';
|
|
16003
|
-
}
|
|
16004
|
-
return newParams;
|
|
16005
|
-
}
|
|
16006
|
-
function queryParamsEndBefore(queryParams, indexValue, key) {
|
|
16007
|
-
let params;
|
|
16008
|
-
if (queryParams.index_ === KEY_INDEX || !!key) {
|
|
16009
|
-
params = queryParamsEndAt(queryParams, indexValue, key);
|
|
16010
|
-
}
|
|
16011
|
-
else {
|
|
16012
|
-
params = queryParamsEndAt(queryParams, indexValue, MIN_NAME);
|
|
16013
|
-
}
|
|
16014
|
-
params.endBeforeSet_ = true;
|
|
16015
|
-
return params;
|
|
16016
|
-
}
|
|
16017
|
-
function queryParamsOrderBy(queryParams, index) {
|
|
16018
|
-
const newParams = queryParams.copy();
|
|
16019
|
-
newParams.index_ = index;
|
|
16020
|
-
return newParams;
|
|
16021
|
-
}
|
|
16022
15013
|
/**
|
|
16023
15014
|
* Returns a set of REST query string parameters representing this query.
|
|
16024
15015
|
*
|
|
@@ -16366,49 +15357,6 @@ function sparseSnapshotTreeRemember(sparseSnapshotTree, path, data) {
|
|
|
16366
15357
|
sparseSnapshotTreeRemember(child, path, data);
|
|
16367
15358
|
}
|
|
16368
15359
|
}
|
|
16369
|
-
/**
|
|
16370
|
-
* Purge the data at path from the cache.
|
|
16371
|
-
*
|
|
16372
|
-
* @param path - Path to look up snapshot for.
|
|
16373
|
-
* @returns True if this node should now be removed.
|
|
16374
|
-
*/
|
|
16375
|
-
function sparseSnapshotTreeForget(sparseSnapshotTree, path) {
|
|
16376
|
-
if (pathIsEmpty(path)) {
|
|
16377
|
-
sparseSnapshotTree.value = null;
|
|
16378
|
-
sparseSnapshotTree.children.clear();
|
|
16379
|
-
return true;
|
|
16380
|
-
}
|
|
16381
|
-
else {
|
|
16382
|
-
if (sparseSnapshotTree.value !== null) {
|
|
16383
|
-
if (sparseSnapshotTree.value.isLeafNode()) {
|
|
16384
|
-
// We're trying to forget a node that doesn't exist
|
|
16385
|
-
return false;
|
|
16386
|
-
}
|
|
16387
|
-
else {
|
|
16388
|
-
const value = sparseSnapshotTree.value;
|
|
16389
|
-
sparseSnapshotTree.value = null;
|
|
16390
|
-
value.forEachChild(PRIORITY_INDEX, (key, tree) => {
|
|
16391
|
-
sparseSnapshotTreeRemember(sparseSnapshotTree, new Path(key), tree);
|
|
16392
|
-
});
|
|
16393
|
-
return sparseSnapshotTreeForget(sparseSnapshotTree, path);
|
|
16394
|
-
}
|
|
16395
|
-
}
|
|
16396
|
-
else if (sparseSnapshotTree.children.size > 0) {
|
|
16397
|
-
const childKey = pathGetFront(path);
|
|
16398
|
-
path = pathPopFront(path);
|
|
16399
|
-
if (sparseSnapshotTree.children.has(childKey)) {
|
|
16400
|
-
const safeToRemove = sparseSnapshotTreeForget(sparseSnapshotTree.children.get(childKey), path);
|
|
16401
|
-
if (safeToRemove) {
|
|
16402
|
-
sparseSnapshotTree.children.delete(childKey);
|
|
16403
|
-
}
|
|
16404
|
-
}
|
|
16405
|
-
return sparseSnapshotTree.children.size === 0;
|
|
16406
|
-
}
|
|
16407
|
-
else {
|
|
16408
|
-
return true;
|
|
16409
|
-
}
|
|
16410
|
-
}
|
|
16411
|
-
}
|
|
16412
15360
|
/**
|
|
16413
15361
|
* Recursively iterates through all of the stored tree and calls the
|
|
16414
15362
|
* callback on each one.
|
|
@@ -18528,9 +17476,6 @@ class View {
|
|
|
18528
17476
|
function viewGetServerCache(view) {
|
|
18529
17477
|
return view.viewCache_.serverCache.getNode();
|
|
18530
17478
|
}
|
|
18531
|
-
function viewGetCompleteNode(view) {
|
|
18532
|
-
return viewCacheGetCompleteEventSnap(view.viewCache_);
|
|
18533
|
-
}
|
|
18534
17479
|
function viewGetCompleteServerCache(view, path) {
|
|
18535
17480
|
const cache = viewCacheGetCompleteServerSnap(view.viewCache_);
|
|
18536
17481
|
if (cache) {
|
|
@@ -19203,33 +18148,6 @@ function syncTreeCalcCompleteEventCache(syncTree, path, writeIdsToExclude) {
|
|
|
19203
18148
|
});
|
|
19204
18149
|
return writeTreeCalcCompleteEventCache(writeTree, path, serverCache, writeIdsToExclude, includeHiddenSets);
|
|
19205
18150
|
}
|
|
19206
|
-
function syncTreeGetServerValue(syncTree, query) {
|
|
19207
|
-
const path = query._path;
|
|
19208
|
-
let serverCache = null;
|
|
19209
|
-
// Any covering writes will necessarily be at the root, so really all we need to find is the server cache.
|
|
19210
|
-
// Consider optimizing this once there's a better understanding of what actual behavior will be.
|
|
19211
|
-
syncTree.syncPointTree_.foreachOnPath(path, (pathToSyncPoint, sp) => {
|
|
19212
|
-
const relativePath = newRelativePath(pathToSyncPoint, path);
|
|
19213
|
-
serverCache =
|
|
19214
|
-
serverCache || syncPointGetCompleteServerCache(sp, relativePath);
|
|
19215
|
-
});
|
|
19216
|
-
let syncPoint = syncTree.syncPointTree_.get(path);
|
|
19217
|
-
if (!syncPoint) {
|
|
19218
|
-
syncPoint = new SyncPoint();
|
|
19219
|
-
syncTree.syncPointTree_ = syncTree.syncPointTree_.set(path, syncPoint);
|
|
19220
|
-
}
|
|
19221
|
-
else {
|
|
19222
|
-
serverCache =
|
|
19223
|
-
serverCache || syncPointGetCompleteServerCache(syncPoint, newEmptyPath());
|
|
19224
|
-
}
|
|
19225
|
-
const serverCacheComplete = serverCache != null;
|
|
19226
|
-
const serverCacheNode = serverCacheComplete
|
|
19227
|
-
? new CacheNode(serverCache, true, false)
|
|
19228
|
-
: null;
|
|
19229
|
-
const writesCache = writeTreeChildWrites(syncTree.pendingWriteTree_, query._path);
|
|
19230
|
-
const view = syncPointGetView(syncPoint, query, writesCache, serverCacheComplete ? serverCacheNode.getNode() : ChildrenNode.EMPTY_NODE, serverCacheComplete);
|
|
19231
|
-
return viewGetCompleteNode(view);
|
|
19232
|
-
}
|
|
19233
18151
|
/**
|
|
19234
18152
|
* A helper method that visits all descendant and ancestor SyncPoints, applying the operation.
|
|
19235
18153
|
*
|
|
@@ -19981,36 +18899,6 @@ const validateFirebaseMergeDataArg = function (fnName, data, path, optional) {
|
|
|
19981
18899
|
});
|
|
19982
18900
|
validateFirebaseMergePaths(errorPrefix$1, mergePaths);
|
|
19983
18901
|
};
|
|
19984
|
-
const validatePriority = function (fnName, priority, optional) {
|
|
19985
|
-
if (optional && priority === undefined) {
|
|
19986
|
-
return;
|
|
19987
|
-
}
|
|
19988
|
-
if (isInvalidJSONNumber(priority)) {
|
|
19989
|
-
throw new Error(errorPrefix(fnName, 'priority') +
|
|
19990
|
-
'is ' +
|
|
19991
|
-
priority.toString() +
|
|
19992
|
-
', but must be a valid Firebase priority (a string, finite number, ' +
|
|
19993
|
-
'server value, or null).');
|
|
19994
|
-
}
|
|
19995
|
-
// Special case to allow importing data with a .sv.
|
|
19996
|
-
if (!isValidPriority(priority)) {
|
|
19997
|
-
throw new Error(errorPrefix(fnName, 'priority') +
|
|
19998
|
-
'must be a valid Firebase priority ' +
|
|
19999
|
-
'(a string, finite number, server value, or null).');
|
|
20000
|
-
}
|
|
20001
|
-
};
|
|
20002
|
-
const validateKey = function (fnName, argumentName, key, optional) {
|
|
20003
|
-
if (optional && key === undefined) {
|
|
20004
|
-
return;
|
|
20005
|
-
}
|
|
20006
|
-
if (!isValidKey(key)) {
|
|
20007
|
-
throw new Error(errorPrefix(fnName, argumentName) +
|
|
20008
|
-
'was an invalid key = "' +
|
|
20009
|
-
key +
|
|
20010
|
-
'". Firebase keys must be non-empty strings and ' +
|
|
20011
|
-
'can\'t contain ".", "#", "$", "/", "[", or "]").');
|
|
20012
|
-
}
|
|
20013
|
-
};
|
|
20014
18902
|
/**
|
|
20015
18903
|
* @internal
|
|
20016
18904
|
*/
|
|
@@ -20380,63 +19268,6 @@ function repoUpdateInfo(repo, pathString, value) {
|
|
|
20380
19268
|
function repoGetNextWriteId(repo) {
|
|
20381
19269
|
return repo.nextWriteId_++;
|
|
20382
19270
|
}
|
|
20383
|
-
/**
|
|
20384
|
-
* The purpose of `getValue` is to return the latest known value
|
|
20385
|
-
* satisfying `query`.
|
|
20386
|
-
*
|
|
20387
|
-
* This method will first check for in-memory cached values
|
|
20388
|
-
* belonging to active listeners. If they are found, such values
|
|
20389
|
-
* are considered to be the most up-to-date.
|
|
20390
|
-
*
|
|
20391
|
-
* If the client is not connected, this method will wait until the
|
|
20392
|
-
* repo has established a connection and then request the value for `query`.
|
|
20393
|
-
* If the client is not able to retrieve the query result for another reason,
|
|
20394
|
-
* it reports an error.
|
|
20395
|
-
*
|
|
20396
|
-
* @param query - The query to surface a value for.
|
|
20397
|
-
*/
|
|
20398
|
-
function repoGetValue(repo, query, eventRegistration) {
|
|
20399
|
-
// Only active queries are cached. There is no persisted cache.
|
|
20400
|
-
const cached = syncTreeGetServerValue(repo.serverSyncTree_, query);
|
|
20401
|
-
if (cached != null) {
|
|
20402
|
-
return Promise.resolve(cached);
|
|
20403
|
-
}
|
|
20404
|
-
return repo.server_.get(query).then(payload => {
|
|
20405
|
-
const node = nodeFromJSON(payload).withIndex(query._queryParams.getIndex());
|
|
20406
|
-
/**
|
|
20407
|
-
* Below we simulate the actions of an `onlyOnce` `onValue()` event where:
|
|
20408
|
-
* Add an event registration,
|
|
20409
|
-
* Update data at the path,
|
|
20410
|
-
* Raise any events,
|
|
20411
|
-
* Cleanup the SyncTree
|
|
20412
|
-
*/
|
|
20413
|
-
syncTreeAddEventRegistration(repo.serverSyncTree_, query, eventRegistration, true);
|
|
20414
|
-
let events;
|
|
20415
|
-
if (query._queryParams.loadsAllData()) {
|
|
20416
|
-
events = syncTreeApplyServerOverwrite(repo.serverSyncTree_, query._path, node);
|
|
20417
|
-
}
|
|
20418
|
-
else {
|
|
20419
|
-
const tag = syncTreeTagForQuery(repo.serverSyncTree_, query);
|
|
20420
|
-
events = syncTreeApplyTaggedQueryOverwrite(repo.serverSyncTree_, query._path, node, tag);
|
|
20421
|
-
}
|
|
20422
|
-
/*
|
|
20423
|
-
* We need to raise events in the scenario where `get()` is called at a parent path, and
|
|
20424
|
-
* while the `get()` is pending, `onValue` is called at a child location. While get() is waiting
|
|
20425
|
-
* for the data, `onValue` will register a new event. Then, get() will come back, and update the syncTree
|
|
20426
|
-
* and its corresponding serverCache, including the child location where `onValue` is called. Then,
|
|
20427
|
-
* `onValue` will receive the event from the server, but look at the syncTree and see that the data received
|
|
20428
|
-
* from the server is already at the SyncPoint, and so the `onValue` callback will never get fired.
|
|
20429
|
-
* Calling `eventQueueRaiseEventsForChangedPath()` is the correct way to propagate the events and
|
|
20430
|
-
* ensure the corresponding child events will get fired.
|
|
20431
|
-
*/
|
|
20432
|
-
eventQueueRaiseEventsForChangedPath(repo.eventQueue_, query._path, events);
|
|
20433
|
-
syncTreeRemoveEventRegistration(repo.serverSyncTree_, query, eventRegistration, null, true);
|
|
20434
|
-
return node;
|
|
20435
|
-
}, err => {
|
|
20436
|
-
repoLog(repo, 'get for query ' + stringify(query) + ' failed: ' + err);
|
|
20437
|
-
return Promise.reject(new Error(err));
|
|
20438
|
-
});
|
|
20439
|
-
}
|
|
20440
19271
|
function repoSetWithPriority(repo, path, newVal, newPriority, onComplete) {
|
|
20441
19272
|
repoLog(repo, 'set', {
|
|
20442
19273
|
path: path.toString(),
|
|
@@ -20522,48 +19353,6 @@ function repoRunOnDisconnectEvents(repo) {
|
|
|
20522
19353
|
repo.onDisconnect_ = newSparseSnapshotTree();
|
|
20523
19354
|
eventQueueRaiseEventsForChangedPath(repo.eventQueue_, newEmptyPath(), events);
|
|
20524
19355
|
}
|
|
20525
|
-
function repoOnDisconnectCancel(repo, path, onComplete) {
|
|
20526
|
-
repo.server_.onDisconnectCancel(path.toString(), (status, errorReason) => {
|
|
20527
|
-
if (status === 'ok') {
|
|
20528
|
-
sparseSnapshotTreeForget(repo.onDisconnect_, path);
|
|
20529
|
-
}
|
|
20530
|
-
repoCallOnCompleteCallback(repo, onComplete, status, errorReason);
|
|
20531
|
-
});
|
|
20532
|
-
}
|
|
20533
|
-
function repoOnDisconnectSet(repo, path, value, onComplete) {
|
|
20534
|
-
const newNode = nodeFromJSON(value);
|
|
20535
|
-
repo.server_.onDisconnectPut(path.toString(), newNode.val(/*export=*/ true), (status, errorReason) => {
|
|
20536
|
-
if (status === 'ok') {
|
|
20537
|
-
sparseSnapshotTreeRemember(repo.onDisconnect_, path, newNode);
|
|
20538
|
-
}
|
|
20539
|
-
repoCallOnCompleteCallback(repo, onComplete, status, errorReason);
|
|
20540
|
-
});
|
|
20541
|
-
}
|
|
20542
|
-
function repoOnDisconnectSetWithPriority(repo, path, value, priority, onComplete) {
|
|
20543
|
-
const newNode = nodeFromJSON(value, priority);
|
|
20544
|
-
repo.server_.onDisconnectPut(path.toString(), newNode.val(/*export=*/ true), (status, errorReason) => {
|
|
20545
|
-
if (status === 'ok') {
|
|
20546
|
-
sparseSnapshotTreeRemember(repo.onDisconnect_, path, newNode);
|
|
20547
|
-
}
|
|
20548
|
-
repoCallOnCompleteCallback(repo, onComplete, status, errorReason);
|
|
20549
|
-
});
|
|
20550
|
-
}
|
|
20551
|
-
function repoOnDisconnectUpdate(repo, path, childrenToMerge, onComplete) {
|
|
20552
|
-
if (isEmpty(childrenToMerge)) {
|
|
20553
|
-
log("onDisconnect().update() called with empty data. Don't do anything.");
|
|
20554
|
-
repoCallOnCompleteCallback(repo, onComplete, 'ok', undefined);
|
|
20555
|
-
return;
|
|
20556
|
-
}
|
|
20557
|
-
repo.server_.onDisconnectMerge(path.toString(), childrenToMerge, (status, errorReason) => {
|
|
20558
|
-
if (status === 'ok') {
|
|
20559
|
-
each(childrenToMerge, (childName, childNode) => {
|
|
20560
|
-
const newChildNode = nodeFromJSON(childNode);
|
|
20561
|
-
sparseSnapshotTreeRemember(repo.onDisconnect_, pathChild(path, childName), newChildNode);
|
|
20562
|
-
});
|
|
20563
|
-
}
|
|
20564
|
-
repoCallOnCompleteCallback(repo, onComplete, status, errorReason);
|
|
20565
|
-
});
|
|
20566
|
-
}
|
|
20567
19356
|
function repoAddEventCallbackForQuery(repo, query, eventRegistration) {
|
|
20568
19357
|
let events;
|
|
20569
19358
|
if (pathGetFront(query._path) === '.info') {
|
|
@@ -20591,11 +19380,6 @@ function repoInterrupt(repo) {
|
|
|
20591
19380
|
repo.persistentConnection_.interrupt(INTERRUPT_REASON);
|
|
20592
19381
|
}
|
|
20593
19382
|
}
|
|
20594
|
-
function repoResume(repo) {
|
|
20595
|
-
if (repo.persistentConnection_) {
|
|
20596
|
-
repo.persistentConnection_.resume(INTERRUPT_REASON);
|
|
20597
|
-
}
|
|
20598
|
-
}
|
|
20599
19383
|
function repoLog(repo, ...varArgs) {
|
|
20600
19384
|
let prefix = '';
|
|
20601
19385
|
if (repo.persistentConnection_) {
|
|
@@ -20623,92 +19407,6 @@ function repoCallOnCompleteCallback(repo, callback, status, errorReason) {
|
|
|
20623
19407
|
});
|
|
20624
19408
|
}
|
|
20625
19409
|
}
|
|
20626
|
-
/**
|
|
20627
|
-
* Creates a new transaction, adds it to the transactions we're tracking, and
|
|
20628
|
-
* sends it to the server if possible.
|
|
20629
|
-
*
|
|
20630
|
-
* @param path - Path at which to do transaction.
|
|
20631
|
-
* @param transactionUpdate - Update callback.
|
|
20632
|
-
* @param onComplete - Completion callback.
|
|
20633
|
-
* @param unwatcher - Function that will be called when the transaction no longer
|
|
20634
|
-
* need data updates for `path`.
|
|
20635
|
-
* @param applyLocally - Whether or not to make intermediate results visible
|
|
20636
|
-
*/
|
|
20637
|
-
function repoStartTransaction(repo, path, transactionUpdate, onComplete, unwatcher, applyLocally) {
|
|
20638
|
-
repoLog(repo, 'transaction on ' + path);
|
|
20639
|
-
// Initialize transaction.
|
|
20640
|
-
const transaction = {
|
|
20641
|
-
path,
|
|
20642
|
-
update: transactionUpdate,
|
|
20643
|
-
onComplete,
|
|
20644
|
-
// One of TransactionStatus enums.
|
|
20645
|
-
status: null,
|
|
20646
|
-
// Used when combining transactions at different locations to figure out
|
|
20647
|
-
// which one goes first.
|
|
20648
|
-
order: LUIDGenerator(),
|
|
20649
|
-
// Whether to raise local events for this transaction.
|
|
20650
|
-
applyLocally,
|
|
20651
|
-
// Count of how many times we've retried the transaction.
|
|
20652
|
-
retryCount: 0,
|
|
20653
|
-
// Function to call to clean up our .on() listener.
|
|
20654
|
-
unwatcher,
|
|
20655
|
-
// Stores why a transaction was aborted.
|
|
20656
|
-
abortReason: null,
|
|
20657
|
-
currentWriteId: null,
|
|
20658
|
-
currentInputSnapshot: null,
|
|
20659
|
-
currentOutputSnapshotRaw: null,
|
|
20660
|
-
currentOutputSnapshotResolved: null
|
|
20661
|
-
};
|
|
20662
|
-
// Run transaction initially.
|
|
20663
|
-
const currentState = repoGetLatestState(repo, path, undefined);
|
|
20664
|
-
transaction.currentInputSnapshot = currentState;
|
|
20665
|
-
const newVal = transaction.update(currentState.val());
|
|
20666
|
-
if (newVal === undefined) {
|
|
20667
|
-
// Abort transaction.
|
|
20668
|
-
transaction.unwatcher();
|
|
20669
|
-
transaction.currentOutputSnapshotRaw = null;
|
|
20670
|
-
transaction.currentOutputSnapshotResolved = null;
|
|
20671
|
-
if (transaction.onComplete) {
|
|
20672
|
-
transaction.onComplete(null, false, transaction.currentInputSnapshot);
|
|
20673
|
-
}
|
|
20674
|
-
}
|
|
20675
|
-
else {
|
|
20676
|
-
validateFirebaseData('transaction failed: Data returned ', newVal, transaction.path);
|
|
20677
|
-
// Mark as run and add to our queue.
|
|
20678
|
-
transaction.status = 0 /* TransactionStatus.RUN */;
|
|
20679
|
-
const queueNode = treeSubTree(repo.transactionQueueTree_, path);
|
|
20680
|
-
const nodeQueue = treeGetValue(queueNode) || [];
|
|
20681
|
-
nodeQueue.push(transaction);
|
|
20682
|
-
treeSetValue(queueNode, nodeQueue);
|
|
20683
|
-
// Update visibleData and raise events
|
|
20684
|
-
// Note: We intentionally raise events after updating all of our
|
|
20685
|
-
// transaction state, since the user could start new transactions from the
|
|
20686
|
-
// event callbacks.
|
|
20687
|
-
let priorityForNode;
|
|
20688
|
-
if (typeof newVal === 'object' &&
|
|
20689
|
-
newVal !== null &&
|
|
20690
|
-
contains(newVal, '.priority')) {
|
|
20691
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20692
|
-
priorityForNode = safeGet(newVal, '.priority');
|
|
20693
|
-
assert(isValidPriority(priorityForNode), 'Invalid priority returned by transaction. ' +
|
|
20694
|
-
'Priority must be a valid string, finite number, server value, or null.');
|
|
20695
|
-
}
|
|
20696
|
-
else {
|
|
20697
|
-
const currentNode = syncTreeCalcCompleteEventCache(repo.serverSyncTree_, path) ||
|
|
20698
|
-
ChildrenNode.EMPTY_NODE;
|
|
20699
|
-
priorityForNode = currentNode.getPriority().val();
|
|
20700
|
-
}
|
|
20701
|
-
const serverValues = repoGenerateServerValues(repo);
|
|
20702
|
-
const newNodeUnresolved = nodeFromJSON(newVal, priorityForNode);
|
|
20703
|
-
const newNode = resolveDeferredValueSnapshot(newNodeUnresolved, currentState, serverValues);
|
|
20704
|
-
transaction.currentOutputSnapshotRaw = newNodeUnresolved;
|
|
20705
|
-
transaction.currentOutputSnapshotResolved = newNode;
|
|
20706
|
-
transaction.currentWriteId = repoGetNextWriteId(repo);
|
|
20707
|
-
const events = syncTreeApplyUserOverwrite(repo.serverSyncTree_, path, newNode, transaction.currentWriteId, transaction.applyLocally);
|
|
20708
|
-
eventQueueRaiseEventsForChangedPath(repo.eventQueue_, path, events);
|
|
20709
|
-
repoSendReadyTransactions(repo, repo.transactionQueueTree_);
|
|
20710
|
-
}
|
|
20711
|
-
}
|
|
20712
19410
|
/**
|
|
20713
19411
|
* @param excludeSets - A specific set to exclude
|
|
20714
19412
|
*/
|
|
@@ -21426,7 +20124,7 @@ class CallbackContext {
|
|
|
21426
20124
|
|
|
21427
20125
|
/**
|
|
21428
20126
|
* @license
|
|
21429
|
-
* Copyright
|
|
20127
|
+
* Copyright 2020 Google LLC
|
|
21430
20128
|
*
|
|
21431
20129
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
21432
20130
|
* you may not use this file except in compliance with the License.
|
|
@@ -21441,177 +20139,39 @@ class CallbackContext {
|
|
|
21441
20139
|
* limitations under the License.
|
|
21442
20140
|
*/
|
|
21443
20141
|
/**
|
|
21444
|
-
*
|
|
21445
|
-
* disconnects from the Database server. These updates occur whether your
|
|
21446
|
-
* client disconnects cleanly or not, so you can rely on them to clean up data
|
|
21447
|
-
* even if a connection is dropped or a client crashes.
|
|
21448
|
-
*
|
|
21449
|
-
* The `onDisconnect` class is most commonly used to manage presence in
|
|
21450
|
-
* applications where it is useful to detect how many clients are connected and
|
|
21451
|
-
* when other clients disconnect. See
|
|
21452
|
-
* {@link https://firebase.google.com/docs/database/web/offline-capabilities | Enabling Offline Capabilities in JavaScript}
|
|
21453
|
-
* for more information.
|
|
21454
|
-
*
|
|
21455
|
-
* To avoid problems when a connection is dropped before the requests can be
|
|
21456
|
-
* transferred to the Database server, these functions should be called before
|
|
21457
|
-
* writing any data.
|
|
21458
|
-
*
|
|
21459
|
-
* Note that `onDisconnect` operations are only triggered once. If you want an
|
|
21460
|
-
* operation to occur each time a disconnect occurs, you'll need to re-establish
|
|
21461
|
-
* the `onDisconnect` operations each time you reconnect.
|
|
20142
|
+
* @internal
|
|
21462
20143
|
*/
|
|
21463
|
-
class
|
|
21464
|
-
/**
|
|
21465
|
-
|
|
20144
|
+
class QueryImpl {
|
|
20145
|
+
/**
|
|
20146
|
+
* @hideconstructor
|
|
20147
|
+
*/
|
|
20148
|
+
constructor(_repo, _path, _queryParams, _orderByCalled) {
|
|
21466
20149
|
this._repo = _repo;
|
|
21467
20150
|
this._path = _path;
|
|
20151
|
+
this._queryParams = _queryParams;
|
|
20152
|
+
this._orderByCalled = _orderByCalled;
|
|
21468
20153
|
}
|
|
21469
|
-
|
|
21470
|
-
|
|
21471
|
-
|
|
21472
|
-
|
|
21473
|
-
|
|
21474
|
-
|
|
21475
|
-
|
|
21476
|
-
*
|
|
21477
|
-
* @returns Resolves when synchronization to the server is complete.
|
|
21478
|
-
*/
|
|
21479
|
-
cancel() {
|
|
21480
|
-
const deferred = new Deferred();
|
|
21481
|
-
repoOnDisconnectCancel(this._repo, this._path, deferred.wrapCallback(() => { }));
|
|
21482
|
-
return deferred.promise;
|
|
20154
|
+
get key() {
|
|
20155
|
+
if (pathIsEmpty(this._path)) {
|
|
20156
|
+
return null;
|
|
20157
|
+
}
|
|
20158
|
+
else {
|
|
20159
|
+
return pathGetBack(this._path);
|
|
20160
|
+
}
|
|
21483
20161
|
}
|
|
21484
|
-
|
|
21485
|
-
|
|
21486
|
-
* (due to closing the browser, navigating to a new page, or network issues).
|
|
21487
|
-
*
|
|
21488
|
-
* @returns Resolves when synchronization to the server is complete.
|
|
21489
|
-
*/
|
|
21490
|
-
remove() {
|
|
21491
|
-
validateWritablePath('OnDisconnect.remove', this._path);
|
|
21492
|
-
const deferred = new Deferred();
|
|
21493
|
-
repoOnDisconnectSet(this._repo, this._path, null, deferred.wrapCallback(() => { }));
|
|
21494
|
-
return deferred.promise;
|
|
20162
|
+
get ref() {
|
|
20163
|
+
return new ReferenceImpl(this._repo, this._path);
|
|
21495
20164
|
}
|
|
21496
|
-
|
|
21497
|
-
|
|
21498
|
-
|
|
21499
|
-
|
|
21500
|
-
*
|
|
21501
|
-
* `set()` is especially useful for implementing "presence" systems, where a
|
|
21502
|
-
* value should be changed or cleared when a user disconnects so that they
|
|
21503
|
-
* appear "offline" to other users. See
|
|
21504
|
-
* {@link https://firebase.google.com/docs/database/web/offline-capabilities | Enabling Offline Capabilities in JavaScript}
|
|
21505
|
-
* for more information.
|
|
21506
|
-
*
|
|
21507
|
-
* Note that `onDisconnect` operations are only triggered once. If you want an
|
|
21508
|
-
* operation to occur each time a disconnect occurs, you'll need to re-establish
|
|
21509
|
-
* the `onDisconnect` operations each time.
|
|
21510
|
-
*
|
|
21511
|
-
* @param value - The value to be written to this location on disconnect (can
|
|
21512
|
-
* be an object, array, string, number, boolean, or null).
|
|
21513
|
-
* @returns Resolves when synchronization to the Database is complete.
|
|
21514
|
-
*/
|
|
21515
|
-
set(value) {
|
|
21516
|
-
validateWritablePath('OnDisconnect.set', this._path);
|
|
21517
|
-
validateFirebaseDataArg('OnDisconnect.set', value, this._path, false);
|
|
21518
|
-
const deferred = new Deferred();
|
|
21519
|
-
repoOnDisconnectSet(this._repo, this._path, value, deferred.wrapCallback(() => { }));
|
|
21520
|
-
return deferred.promise;
|
|
20165
|
+
get _queryIdentifier() {
|
|
20166
|
+
const obj = queryParamsGetQueryObject(this._queryParams);
|
|
20167
|
+
const id = ObjectToUniqueKey(obj);
|
|
20168
|
+
return id === '{}' ? 'default' : id;
|
|
21521
20169
|
}
|
|
21522
20170
|
/**
|
|
21523
|
-
*
|
|
21524
|
-
* when the client is disconnected (due to closing the browser, navigating to a
|
|
21525
|
-
* new page, or network issues).
|
|
21526
|
-
*
|
|
21527
|
-
* @param value - The value to be written to this location on disconnect (can
|
|
21528
|
-
* be an object, array, string, number, boolean, or null).
|
|
21529
|
-
* @param priority - The priority to be written (string, number, or null).
|
|
21530
|
-
* @returns Resolves when synchronization to the Database is complete.
|
|
20171
|
+
* An object representation of the query parameters used by this Query.
|
|
21531
20172
|
*/
|
|
21532
|
-
|
|
21533
|
-
|
|
21534
|
-
validateFirebaseDataArg('OnDisconnect.setWithPriority', value, this._path, false);
|
|
21535
|
-
validatePriority('OnDisconnect.setWithPriority', priority, false);
|
|
21536
|
-
const deferred = new Deferred();
|
|
21537
|
-
repoOnDisconnectSetWithPriority(this._repo, this._path, value, priority, deferred.wrapCallback(() => { }));
|
|
21538
|
-
return deferred.promise;
|
|
21539
|
-
}
|
|
21540
|
-
/**
|
|
21541
|
-
* Writes multiple values at this location when the client is disconnected (due
|
|
21542
|
-
* to closing the browser, navigating to a new page, or network issues).
|
|
21543
|
-
*
|
|
21544
|
-
* The `values` argument contains multiple property-value pairs that will be
|
|
21545
|
-
* written to the Database together. Each child property can either be a simple
|
|
21546
|
-
* property (for example, "name") or a relative path (for example, "name/first")
|
|
21547
|
-
* from the current location to the data to update.
|
|
21548
|
-
*
|
|
21549
|
-
* As opposed to the `set()` method, `update()` can be use to selectively update
|
|
21550
|
-
* only the referenced properties at the current location (instead of replacing
|
|
21551
|
-
* all the child properties at the current location).
|
|
21552
|
-
*
|
|
21553
|
-
* @param values - Object containing multiple values.
|
|
21554
|
-
* @returns Resolves when synchronization to the Database is complete.
|
|
21555
|
-
*/
|
|
21556
|
-
update(values) {
|
|
21557
|
-
validateWritablePath('OnDisconnect.update', this._path);
|
|
21558
|
-
validateFirebaseMergeDataArg('OnDisconnect.update', values, this._path, false);
|
|
21559
|
-
const deferred = new Deferred();
|
|
21560
|
-
repoOnDisconnectUpdate(this._repo, this._path, values, deferred.wrapCallback(() => { }));
|
|
21561
|
-
return deferred.promise;
|
|
21562
|
-
}
|
|
21563
|
-
}
|
|
21564
|
-
|
|
21565
|
-
/**
|
|
21566
|
-
* @license
|
|
21567
|
-
* Copyright 2020 Google LLC
|
|
21568
|
-
*
|
|
21569
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
21570
|
-
* you may not use this file except in compliance with the License.
|
|
21571
|
-
* You may obtain a copy of the License at
|
|
21572
|
-
*
|
|
21573
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
21574
|
-
*
|
|
21575
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
21576
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
21577
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21578
|
-
* See the License for the specific language governing permissions and
|
|
21579
|
-
* limitations under the License.
|
|
21580
|
-
*/
|
|
21581
|
-
/**
|
|
21582
|
-
* @internal
|
|
21583
|
-
*/
|
|
21584
|
-
class QueryImpl {
|
|
21585
|
-
/**
|
|
21586
|
-
* @hideconstructor
|
|
21587
|
-
*/
|
|
21588
|
-
constructor(_repo, _path, _queryParams, _orderByCalled) {
|
|
21589
|
-
this._repo = _repo;
|
|
21590
|
-
this._path = _path;
|
|
21591
|
-
this._queryParams = _queryParams;
|
|
21592
|
-
this._orderByCalled = _orderByCalled;
|
|
21593
|
-
}
|
|
21594
|
-
get key() {
|
|
21595
|
-
if (pathIsEmpty(this._path)) {
|
|
21596
|
-
return null;
|
|
21597
|
-
}
|
|
21598
|
-
else {
|
|
21599
|
-
return pathGetBack(this._path);
|
|
21600
|
-
}
|
|
21601
|
-
}
|
|
21602
|
-
get ref() {
|
|
21603
|
-
return new ReferenceImpl(this._repo, this._path);
|
|
21604
|
-
}
|
|
21605
|
-
get _queryIdentifier() {
|
|
21606
|
-
const obj = queryParamsGetQueryObject(this._queryParams);
|
|
21607
|
-
const id = ObjectToUniqueKey(obj);
|
|
21608
|
-
return id === '{}' ? 'default' : id;
|
|
21609
|
-
}
|
|
21610
|
-
/**
|
|
21611
|
-
* An object representation of the query parameters used by this Query.
|
|
21612
|
-
*/
|
|
21613
|
-
get _queryObject() {
|
|
21614
|
-
return queryParamsGetQueryObject(this._queryParams);
|
|
20173
|
+
get _queryObject() {
|
|
20174
|
+
return queryParamsGetQueryObject(this._queryParams);
|
|
21615
20175
|
}
|
|
21616
20176
|
isEqual(other) {
|
|
21617
20177
|
other = getModularInstance(other);
|
|
@@ -21630,80 +20190,6 @@ class QueryImpl {
|
|
|
21630
20190
|
return this._repo.toString() + pathToUrlEncodedString(this._path);
|
|
21631
20191
|
}
|
|
21632
20192
|
}
|
|
21633
|
-
/**
|
|
21634
|
-
* Validates that no other order by call has been made
|
|
21635
|
-
*/
|
|
21636
|
-
function validateNoPreviousOrderByCall(query, fnName) {
|
|
21637
|
-
if (query._orderByCalled === true) {
|
|
21638
|
-
throw new Error(fnName + ": You can't combine multiple orderBy calls.");
|
|
21639
|
-
}
|
|
21640
|
-
}
|
|
21641
|
-
/**
|
|
21642
|
-
* Validates start/end values for queries.
|
|
21643
|
-
*/
|
|
21644
|
-
function validateQueryEndpoints(params) {
|
|
21645
|
-
let startNode = null;
|
|
21646
|
-
let endNode = null;
|
|
21647
|
-
if (params.hasStart()) {
|
|
21648
|
-
startNode = params.getIndexStartValue();
|
|
21649
|
-
}
|
|
21650
|
-
if (params.hasEnd()) {
|
|
21651
|
-
endNode = params.getIndexEndValue();
|
|
21652
|
-
}
|
|
21653
|
-
if (params.getIndex() === KEY_INDEX) {
|
|
21654
|
-
const tooManyArgsError = 'Query: When ordering by key, you may only pass one argument to ' +
|
|
21655
|
-
'startAt(), endAt(), or equalTo().';
|
|
21656
|
-
const wrongArgTypeError = 'Query: When ordering by key, the argument passed to startAt(), startAfter(), ' +
|
|
21657
|
-
'endAt(), endBefore(), or equalTo() must be a string.';
|
|
21658
|
-
if (params.hasStart()) {
|
|
21659
|
-
const startName = params.getIndexStartName();
|
|
21660
|
-
if (startName !== MIN_NAME) {
|
|
21661
|
-
throw new Error(tooManyArgsError);
|
|
21662
|
-
}
|
|
21663
|
-
else if (typeof startNode !== 'string') {
|
|
21664
|
-
throw new Error(wrongArgTypeError);
|
|
21665
|
-
}
|
|
21666
|
-
}
|
|
21667
|
-
if (params.hasEnd()) {
|
|
21668
|
-
const endName = params.getIndexEndName();
|
|
21669
|
-
if (endName !== MAX_NAME) {
|
|
21670
|
-
throw new Error(tooManyArgsError);
|
|
21671
|
-
}
|
|
21672
|
-
else if (typeof endNode !== 'string') {
|
|
21673
|
-
throw new Error(wrongArgTypeError);
|
|
21674
|
-
}
|
|
21675
|
-
}
|
|
21676
|
-
}
|
|
21677
|
-
else if (params.getIndex() === PRIORITY_INDEX) {
|
|
21678
|
-
if ((startNode != null && !isValidPriority(startNode)) ||
|
|
21679
|
-
(endNode != null && !isValidPriority(endNode))) {
|
|
21680
|
-
throw new Error('Query: When ordering by priority, the first argument passed to startAt(), ' +
|
|
21681
|
-
'startAfter() endAt(), endBefore(), or equalTo() must be a valid priority value ' +
|
|
21682
|
-
'(null, a number, or a string).');
|
|
21683
|
-
}
|
|
21684
|
-
}
|
|
21685
|
-
else {
|
|
21686
|
-
assert(params.getIndex() instanceof PathIndex ||
|
|
21687
|
-
params.getIndex() === VALUE_INDEX, 'unknown index type.');
|
|
21688
|
-
if ((startNode != null && typeof startNode === 'object') ||
|
|
21689
|
-
(endNode != null && typeof endNode === 'object')) {
|
|
21690
|
-
throw new Error('Query: First argument passed to startAt(), startAfter(), endAt(), endBefore(), or ' +
|
|
21691
|
-
'equalTo() cannot be an object.');
|
|
21692
|
-
}
|
|
21693
|
-
}
|
|
21694
|
-
}
|
|
21695
|
-
/**
|
|
21696
|
-
* Validates that limit* has been called with the correct combination of parameters
|
|
21697
|
-
*/
|
|
21698
|
-
function validateLimit(params) {
|
|
21699
|
-
if (params.hasStart() &&
|
|
21700
|
-
params.hasEnd() &&
|
|
21701
|
-
params.hasLimit() &&
|
|
21702
|
-
!params.hasAnchoredLimit()) {
|
|
21703
|
-
throw new Error("Query: Can't combine startAt(), startAfter(), endAt(), endBefore(), and limit(). Use " +
|
|
21704
|
-
'limitToFirst() or limitToLast() instead.');
|
|
21705
|
-
}
|
|
21706
|
-
}
|
|
21707
20193
|
/**
|
|
21708
20194
|
* @internal
|
|
21709
20195
|
*/
|
|
@@ -21921,40 +20407,6 @@ function ref(db, path) {
|
|
|
21921
20407
|
db._checkNotDeleted('ref');
|
|
21922
20408
|
return path !== undefined ? child(db._root, path) : db._root;
|
|
21923
20409
|
}
|
|
21924
|
-
/**
|
|
21925
|
-
* Returns a `Reference` representing the location in the Database
|
|
21926
|
-
* corresponding to the provided Firebase URL.
|
|
21927
|
-
*
|
|
21928
|
-
* An exception is thrown if the URL is not a valid Firebase Database URL or it
|
|
21929
|
-
* has a different domain than the current `Database` instance.
|
|
21930
|
-
*
|
|
21931
|
-
* Note that all query parameters (`orderBy`, `limitToLast`, etc.) are ignored
|
|
21932
|
-
* and are not applied to the returned `Reference`.
|
|
21933
|
-
*
|
|
21934
|
-
* @param db - The database instance to obtain a reference for.
|
|
21935
|
-
* @param url - The Firebase URL at which the returned `Reference` will
|
|
21936
|
-
* point.
|
|
21937
|
-
* @returns A `Reference` pointing to the provided
|
|
21938
|
-
* Firebase URL.
|
|
21939
|
-
*/
|
|
21940
|
-
function refFromURL(db, url) {
|
|
21941
|
-
db = getModularInstance(db);
|
|
21942
|
-
db._checkNotDeleted('refFromURL');
|
|
21943
|
-
const parsedURL = parseRepoInfo(url, db._repo.repoInfo_.nodeAdmin);
|
|
21944
|
-
validateUrl('refFromURL', parsedURL);
|
|
21945
|
-
const repoInfo = parsedURL.repoInfo;
|
|
21946
|
-
if (!db._repo.repoInfo_.isCustomHost() &&
|
|
21947
|
-
repoInfo.host !== db._repo.repoInfo_.host) {
|
|
21948
|
-
fatal('refFromURL' +
|
|
21949
|
-
': Host name does not match the current database: ' +
|
|
21950
|
-
'(found ' +
|
|
21951
|
-
repoInfo.host +
|
|
21952
|
-
' but expected ' +
|
|
21953
|
-
db._repo.repoInfo_.host +
|
|
21954
|
-
')');
|
|
21955
|
-
}
|
|
21956
|
-
return ref(db, parsedURL.path.toString());
|
|
21957
|
-
}
|
|
21958
20410
|
/**
|
|
21959
20411
|
* Gets a `Reference` for the location at the specified relative path.
|
|
21960
20412
|
*
|
|
@@ -21976,17 +20428,6 @@ function child(parent, path) {
|
|
|
21976
20428
|
}
|
|
21977
20429
|
return new ReferenceImpl(parent._repo, pathChild(parent._path, path));
|
|
21978
20430
|
}
|
|
21979
|
-
/**
|
|
21980
|
-
* Returns an `OnDisconnect` object - see
|
|
21981
|
-
* {@link https://firebase.google.com/docs/database/web/offline-capabilities | Enabling Offline Capabilities in JavaScript}
|
|
21982
|
-
* for more information on how to use it.
|
|
21983
|
-
*
|
|
21984
|
-
* @param ref - The reference to add OnDisconnect triggers for.
|
|
21985
|
-
*/
|
|
21986
|
-
function onDisconnect(ref) {
|
|
21987
|
-
ref = getModularInstance(ref);
|
|
21988
|
-
return new OnDisconnect(ref._repo, ref._path);
|
|
21989
|
-
}
|
|
21990
20431
|
/**
|
|
21991
20432
|
* Generates a new child location using a unique key and returns its
|
|
21992
20433
|
* `Reference`.
|
|
@@ -22035,24 +20476,6 @@ function push(parent, value) {
|
|
|
22035
20476
|
thennablePushRef.catch = promise.then.bind(promise, undefined);
|
|
22036
20477
|
return thennablePushRef;
|
|
22037
20478
|
}
|
|
22038
|
-
/**
|
|
22039
|
-
* Removes the data at this Database location.
|
|
22040
|
-
*
|
|
22041
|
-
* Any data at child locations will also be deleted.
|
|
22042
|
-
*
|
|
22043
|
-
* The effect of the remove will be visible immediately and the corresponding
|
|
22044
|
-
* event 'value' will be triggered. Synchronization of the remove to the
|
|
22045
|
-
* Firebase servers will also be started, and the returned Promise will resolve
|
|
22046
|
-
* when complete. If provided, the onComplete callback will be called
|
|
22047
|
-
* asynchronously after synchronization has finished.
|
|
22048
|
-
*
|
|
22049
|
-
* @param ref - The location to remove.
|
|
22050
|
-
* @returns Resolves when remove on server is complete.
|
|
22051
|
-
*/
|
|
22052
|
-
function remove(ref) {
|
|
22053
|
-
validateWritablePath('remove', ref._path);
|
|
22054
|
-
return set(ref, null);
|
|
22055
|
-
}
|
|
22056
20479
|
/**
|
|
22057
20480
|
* Writes data to this Database location.
|
|
22058
20481
|
*
|
|
@@ -22091,52 +20514,6 @@ function set(ref, value) {
|
|
|
22091
20514
|
/*priority=*/ null, deferred.wrapCallback(() => { }));
|
|
22092
20515
|
return deferred.promise;
|
|
22093
20516
|
}
|
|
22094
|
-
/**
|
|
22095
|
-
* Sets a priority for the data at this Database location.
|
|
22096
|
-
*
|
|
22097
|
-
* Applications need not use priority but can order collections by
|
|
22098
|
-
* ordinary properties (see
|
|
22099
|
-
* {@link https://firebase.google.com/docs/database/web/lists-of-data#sorting_and_filtering_data | Sorting and filtering data}
|
|
22100
|
-
* ).
|
|
22101
|
-
*
|
|
22102
|
-
* @param ref - The location to write to.
|
|
22103
|
-
* @param priority - The priority to be written (string, number, or null).
|
|
22104
|
-
* @returns Resolves when write to server is complete.
|
|
22105
|
-
*/
|
|
22106
|
-
function setPriority(ref, priority) {
|
|
22107
|
-
ref = getModularInstance(ref);
|
|
22108
|
-
validateWritablePath('setPriority', ref._path);
|
|
22109
|
-
validatePriority('setPriority', priority, false);
|
|
22110
|
-
const deferred = new Deferred();
|
|
22111
|
-
repoSetWithPriority(ref._repo, pathChild(ref._path, '.priority'), priority, null, deferred.wrapCallback(() => { }));
|
|
22112
|
-
return deferred.promise;
|
|
22113
|
-
}
|
|
22114
|
-
/**
|
|
22115
|
-
* Writes data the Database location. Like `set()` but also specifies the
|
|
22116
|
-
* priority for that data.
|
|
22117
|
-
*
|
|
22118
|
-
* Applications need not use priority but can order collections by
|
|
22119
|
-
* ordinary properties (see
|
|
22120
|
-
* {@link https://firebase.google.com/docs/database/web/lists-of-data#sorting_and_filtering_data | Sorting and filtering data}
|
|
22121
|
-
* ).
|
|
22122
|
-
*
|
|
22123
|
-
* @param ref - The location to write to.
|
|
22124
|
-
* @param value - The value to be written (string, number, boolean, object,
|
|
22125
|
-
* array, or null).
|
|
22126
|
-
* @param priority - The priority to be written (string, number, or null).
|
|
22127
|
-
* @returns Resolves when write to server is complete.
|
|
22128
|
-
*/
|
|
22129
|
-
function setWithPriority(ref, value, priority) {
|
|
22130
|
-
validateWritablePath('setWithPriority', ref._path);
|
|
22131
|
-
validateFirebaseDataArg('setWithPriority', value, ref._path, false);
|
|
22132
|
-
validatePriority('setWithPriority', priority, false);
|
|
22133
|
-
if (ref.key === '.length' || ref.key === '.keys') {
|
|
22134
|
-
throw 'setWithPriority failed: ' + ref.key + ' is a read-only object.';
|
|
22135
|
-
}
|
|
22136
|
-
const deferred = new Deferred();
|
|
22137
|
-
repoSetWithPriority(ref._repo, ref._path, value, priority, deferred.wrapCallback(() => { }));
|
|
22138
|
-
return deferred.promise;
|
|
22139
|
-
}
|
|
22140
20517
|
/**
|
|
22141
20518
|
* Writes multiple values to the Database at once.
|
|
22142
20519
|
*
|
|
@@ -22178,22 +20555,6 @@ function update(ref, values) {
|
|
|
22178
20555
|
repoUpdate(ref._repo, ref._path, values, deferred.wrapCallback(() => { }));
|
|
22179
20556
|
return deferred.promise;
|
|
22180
20557
|
}
|
|
22181
|
-
/**
|
|
22182
|
-
* Gets the most up-to-date result for this query.
|
|
22183
|
-
*
|
|
22184
|
-
* @param query - The query to run.
|
|
22185
|
-
* @returns A `Promise` which resolves to the resulting DataSnapshot if a value is
|
|
22186
|
-
* available, or rejects if the client is unable to return a value (e.g., if the
|
|
22187
|
-
* server is unreachable and there is nothing cached).
|
|
22188
|
-
*/
|
|
22189
|
-
function get(query) {
|
|
22190
|
-
query = getModularInstance(query);
|
|
22191
|
-
const callbackContext = new CallbackContext(() => { });
|
|
22192
|
-
const container = new ValueEventRegistration(callbackContext);
|
|
22193
|
-
return repoGetValue(query._repo, query, container).then(node => {
|
|
22194
|
-
return new DataSnapshot(node, new ReferenceImpl(query._repo, query._path), query._queryParams.getIndex());
|
|
22195
|
-
});
|
|
22196
|
-
}
|
|
22197
20558
|
/**
|
|
22198
20559
|
* Represents registration for 'value' events.
|
|
22199
20560
|
*/
|
|
@@ -22318,479 +20679,6 @@ function addEventListener(query, eventType, callback, cancelCallbackOrListenOpti
|
|
|
22318
20679
|
function onValue(query, callback, cancelCallbackOrListenOptions, options) {
|
|
22319
20680
|
return addEventListener(query, 'value', callback, cancelCallbackOrListenOptions, options);
|
|
22320
20681
|
}
|
|
22321
|
-
function onChildAdded(query, callback, cancelCallbackOrListenOptions, options) {
|
|
22322
|
-
return addEventListener(query, 'child_added', callback, cancelCallbackOrListenOptions, options);
|
|
22323
|
-
}
|
|
22324
|
-
function onChildChanged(query, callback, cancelCallbackOrListenOptions, options) {
|
|
22325
|
-
return addEventListener(query, 'child_changed', callback, cancelCallbackOrListenOptions, options);
|
|
22326
|
-
}
|
|
22327
|
-
function onChildMoved(query, callback, cancelCallbackOrListenOptions, options) {
|
|
22328
|
-
return addEventListener(query, 'child_moved', callback, cancelCallbackOrListenOptions, options);
|
|
22329
|
-
}
|
|
22330
|
-
function onChildRemoved(query, callback, cancelCallbackOrListenOptions, options) {
|
|
22331
|
-
return addEventListener(query, 'child_removed', callback, cancelCallbackOrListenOptions, options);
|
|
22332
|
-
}
|
|
22333
|
-
/**
|
|
22334
|
-
* Detaches a callback previously attached with the corresponding `on*()` (`onValue`, `onChildAdded`) listener.
|
|
22335
|
-
* Note: This is not the recommended way to remove a listener. Instead, please use the returned callback function from
|
|
22336
|
-
* the respective `on*` callbacks.
|
|
22337
|
-
*
|
|
22338
|
-
* Detach a callback previously attached with `on*()`. Calling `off()` on a parent listener
|
|
22339
|
-
* will not automatically remove listeners registered on child nodes, `off()`
|
|
22340
|
-
* must also be called on any child listeners to remove the callback.
|
|
22341
|
-
*
|
|
22342
|
-
* If a callback is not specified, all callbacks for the specified eventType
|
|
22343
|
-
* will be removed. Similarly, if no eventType is specified, all callbacks
|
|
22344
|
-
* for the `Reference` will be removed.
|
|
22345
|
-
*
|
|
22346
|
-
* Individual listeners can also be removed by invoking their unsubscribe
|
|
22347
|
-
* callbacks.
|
|
22348
|
-
*
|
|
22349
|
-
* @param query - The query that the listener was registered with.
|
|
22350
|
-
* @param eventType - One of the following strings: "value", "child_added",
|
|
22351
|
-
* "child_changed", "child_removed", or "child_moved." If omitted, all callbacks
|
|
22352
|
-
* for the `Reference` will be removed.
|
|
22353
|
-
* @param callback - The callback function that was passed to `on()` or
|
|
22354
|
-
* `undefined` to remove all callbacks.
|
|
22355
|
-
*/
|
|
22356
|
-
function off(query, eventType, callback) {
|
|
22357
|
-
let container = null;
|
|
22358
|
-
const expCallback = callback ? new CallbackContext(callback) : null;
|
|
22359
|
-
if (eventType === 'value') {
|
|
22360
|
-
container = new ValueEventRegistration(expCallback);
|
|
22361
|
-
}
|
|
22362
|
-
else if (eventType) {
|
|
22363
|
-
container = new ChildEventRegistration(eventType, expCallback);
|
|
22364
|
-
}
|
|
22365
|
-
repoRemoveEventCallbackForQuery(query._repo, query, container);
|
|
22366
|
-
}
|
|
22367
|
-
/**
|
|
22368
|
-
* A `QueryConstraint` is used to narrow the set of documents returned by a
|
|
22369
|
-
* Database query. `QueryConstraint`s are created by invoking {@link endAt},
|
|
22370
|
-
* {@link endBefore}, {@link startAt}, {@link startAfter}, {@link
|
|
22371
|
-
* limitToFirst}, {@link limitToLast}, {@link orderByChild},
|
|
22372
|
-
* {@link orderByChild}, {@link orderByKey} , {@link orderByPriority} ,
|
|
22373
|
-
* {@link orderByValue} or {@link equalTo} and
|
|
22374
|
-
* can then be passed to {@link query} to create a new query instance that
|
|
22375
|
-
* also contains this `QueryConstraint`.
|
|
22376
|
-
*/
|
|
22377
|
-
class QueryConstraint {
|
|
22378
|
-
}
|
|
22379
|
-
class QueryEndAtConstraint extends QueryConstraint {
|
|
22380
|
-
constructor(_value, _key) {
|
|
22381
|
-
super();
|
|
22382
|
-
this._value = _value;
|
|
22383
|
-
this._key = _key;
|
|
22384
|
-
}
|
|
22385
|
-
_apply(query) {
|
|
22386
|
-
validateFirebaseDataArg('endAt', this._value, query._path, true);
|
|
22387
|
-
const newParams = queryParamsEndAt(query._queryParams, this._value, this._key);
|
|
22388
|
-
validateLimit(newParams);
|
|
22389
|
-
validateQueryEndpoints(newParams);
|
|
22390
|
-
if (query._queryParams.hasEnd()) {
|
|
22391
|
-
throw new Error('endAt: Starting point was already set (by another call to endAt, ' +
|
|
22392
|
-
'endBefore or equalTo).');
|
|
22393
|
-
}
|
|
22394
|
-
return new QueryImpl(query._repo, query._path, newParams, query._orderByCalled);
|
|
22395
|
-
}
|
|
22396
|
-
}
|
|
22397
|
-
/**
|
|
22398
|
-
* Creates a `QueryConstraint` with the specified ending point.
|
|
22399
|
-
*
|
|
22400
|
-
* Using `startAt()`, `startAfter()`, `endBefore()`, `endAt()` and `equalTo()`
|
|
22401
|
-
* allows you to choose arbitrary starting and ending points for your queries.
|
|
22402
|
-
*
|
|
22403
|
-
* The ending point is inclusive, so children with exactly the specified value
|
|
22404
|
-
* will be included in the query. The optional key argument can be used to
|
|
22405
|
-
* further limit the range of the query. If it is specified, then children that
|
|
22406
|
-
* have exactly the specified value must also have a key name less than or equal
|
|
22407
|
-
* to the specified key.
|
|
22408
|
-
*
|
|
22409
|
-
* You can read more about `endAt()` in
|
|
22410
|
-
* {@link https://firebase.google.com/docs/database/web/lists-of-data#filtering_data | Filtering data}.
|
|
22411
|
-
*
|
|
22412
|
-
* @param value - The value to end at. The argument type depends on which
|
|
22413
|
-
* `orderBy*()` function was used in this query. Specify a value that matches
|
|
22414
|
-
* the `orderBy*()` type. When used in combination with `orderByKey()`, the
|
|
22415
|
-
* value must be a string.
|
|
22416
|
-
* @param key - The child key to end at, among the children with the previously
|
|
22417
|
-
* specified priority. This argument is only allowed if ordering by child,
|
|
22418
|
-
* value, or priority.
|
|
22419
|
-
*/
|
|
22420
|
-
function endAt(value, key) {
|
|
22421
|
-
validateKey('endAt', 'key', key, true);
|
|
22422
|
-
return new QueryEndAtConstraint(value, key);
|
|
22423
|
-
}
|
|
22424
|
-
class QueryEndBeforeConstraint extends QueryConstraint {
|
|
22425
|
-
constructor(_value, _key) {
|
|
22426
|
-
super();
|
|
22427
|
-
this._value = _value;
|
|
22428
|
-
this._key = _key;
|
|
22429
|
-
}
|
|
22430
|
-
_apply(query) {
|
|
22431
|
-
validateFirebaseDataArg('endBefore', this._value, query._path, false);
|
|
22432
|
-
const newParams = queryParamsEndBefore(query._queryParams, this._value, this._key);
|
|
22433
|
-
validateLimit(newParams);
|
|
22434
|
-
validateQueryEndpoints(newParams);
|
|
22435
|
-
if (query._queryParams.hasEnd()) {
|
|
22436
|
-
throw new Error('endBefore: Starting point was already set (by another call to endAt, ' +
|
|
22437
|
-
'endBefore or equalTo).');
|
|
22438
|
-
}
|
|
22439
|
-
return new QueryImpl(query._repo, query._path, newParams, query._orderByCalled);
|
|
22440
|
-
}
|
|
22441
|
-
}
|
|
22442
|
-
/**
|
|
22443
|
-
* Creates a `QueryConstraint` with the specified ending point (exclusive).
|
|
22444
|
-
*
|
|
22445
|
-
* Using `startAt()`, `startAfter()`, `endBefore()`, `endAt()` and `equalTo()`
|
|
22446
|
-
* allows you to choose arbitrary starting and ending points for your queries.
|
|
22447
|
-
*
|
|
22448
|
-
* The ending point is exclusive. If only a value is provided, children
|
|
22449
|
-
* with a value less than the specified value will be included in the query.
|
|
22450
|
-
* If a key is specified, then children must have a value less than or equal
|
|
22451
|
-
* to the specified value and a key name less than the specified key.
|
|
22452
|
-
*
|
|
22453
|
-
* @param value - The value to end before. The argument type depends on which
|
|
22454
|
-
* `orderBy*()` function was used in this query. Specify a value that matches
|
|
22455
|
-
* the `orderBy*()` type. When used in combination with `orderByKey()`, the
|
|
22456
|
-
* value must be a string.
|
|
22457
|
-
* @param key - The child key to end before, among the children with the
|
|
22458
|
-
* previously specified priority. This argument is only allowed if ordering by
|
|
22459
|
-
* child, value, or priority.
|
|
22460
|
-
*/
|
|
22461
|
-
function endBefore(value, key) {
|
|
22462
|
-
validateKey('endBefore', 'key', key, true);
|
|
22463
|
-
return new QueryEndBeforeConstraint(value, key);
|
|
22464
|
-
}
|
|
22465
|
-
class QueryStartAtConstraint extends QueryConstraint {
|
|
22466
|
-
constructor(_value, _key) {
|
|
22467
|
-
super();
|
|
22468
|
-
this._value = _value;
|
|
22469
|
-
this._key = _key;
|
|
22470
|
-
}
|
|
22471
|
-
_apply(query) {
|
|
22472
|
-
validateFirebaseDataArg('startAt', this._value, query._path, true);
|
|
22473
|
-
const newParams = queryParamsStartAt(query._queryParams, this._value, this._key);
|
|
22474
|
-
validateLimit(newParams);
|
|
22475
|
-
validateQueryEndpoints(newParams);
|
|
22476
|
-
if (query._queryParams.hasStart()) {
|
|
22477
|
-
throw new Error('startAt: Starting point was already set (by another call to startAt, ' +
|
|
22478
|
-
'startBefore or equalTo).');
|
|
22479
|
-
}
|
|
22480
|
-
return new QueryImpl(query._repo, query._path, newParams, query._orderByCalled);
|
|
22481
|
-
}
|
|
22482
|
-
}
|
|
22483
|
-
/**
|
|
22484
|
-
* Creates a `QueryConstraint` with the specified starting point.
|
|
22485
|
-
*
|
|
22486
|
-
* Using `startAt()`, `startAfter()`, `endBefore()`, `endAt()` and `equalTo()`
|
|
22487
|
-
* allows you to choose arbitrary starting and ending points for your queries.
|
|
22488
|
-
*
|
|
22489
|
-
* The starting point is inclusive, so children with exactly the specified value
|
|
22490
|
-
* will be included in the query. The optional key argument can be used to
|
|
22491
|
-
* further limit the range of the query. If it is specified, then children that
|
|
22492
|
-
* have exactly the specified value must also have a key name greater than or
|
|
22493
|
-
* equal to the specified key.
|
|
22494
|
-
*
|
|
22495
|
-
* You can read more about `startAt()` in
|
|
22496
|
-
* {@link https://firebase.google.com/docs/database/web/lists-of-data#filtering_data | Filtering data}.
|
|
22497
|
-
*
|
|
22498
|
-
* @param value - The value to start at. The argument type depends on which
|
|
22499
|
-
* `orderBy*()` function was used in this query. Specify a value that matches
|
|
22500
|
-
* the `orderBy*()` type. When used in combination with `orderByKey()`, the
|
|
22501
|
-
* value must be a string.
|
|
22502
|
-
* @param key - The child key to start at. This argument is only allowed if
|
|
22503
|
-
* ordering by child, value, or priority.
|
|
22504
|
-
*/
|
|
22505
|
-
function startAt(value = null, key) {
|
|
22506
|
-
validateKey('startAt', 'key', key, true);
|
|
22507
|
-
return new QueryStartAtConstraint(value, key);
|
|
22508
|
-
}
|
|
22509
|
-
class QueryStartAfterConstraint extends QueryConstraint {
|
|
22510
|
-
constructor(_value, _key) {
|
|
22511
|
-
super();
|
|
22512
|
-
this._value = _value;
|
|
22513
|
-
this._key = _key;
|
|
22514
|
-
}
|
|
22515
|
-
_apply(query) {
|
|
22516
|
-
validateFirebaseDataArg('startAfter', this._value, query._path, false);
|
|
22517
|
-
const newParams = queryParamsStartAfter(query._queryParams, this._value, this._key);
|
|
22518
|
-
validateLimit(newParams);
|
|
22519
|
-
validateQueryEndpoints(newParams);
|
|
22520
|
-
if (query._queryParams.hasStart()) {
|
|
22521
|
-
throw new Error('startAfter: Starting point was already set (by another call to startAt, ' +
|
|
22522
|
-
'startAfter, or equalTo).');
|
|
22523
|
-
}
|
|
22524
|
-
return new QueryImpl(query._repo, query._path, newParams, query._orderByCalled);
|
|
22525
|
-
}
|
|
22526
|
-
}
|
|
22527
|
-
/**
|
|
22528
|
-
* Creates a `QueryConstraint` with the specified starting point (exclusive).
|
|
22529
|
-
*
|
|
22530
|
-
* Using `startAt()`, `startAfter()`, `endBefore()`, `endAt()` and `equalTo()`
|
|
22531
|
-
* allows you to choose arbitrary starting and ending points for your queries.
|
|
22532
|
-
*
|
|
22533
|
-
* The starting point is exclusive. If only a value is provided, children
|
|
22534
|
-
* with a value greater than the specified value will be included in the query.
|
|
22535
|
-
* If a key is specified, then children must have a value greater than or equal
|
|
22536
|
-
* to the specified value and a a key name greater than the specified key.
|
|
22537
|
-
*
|
|
22538
|
-
* @param value - The value to start after. The argument type depends on which
|
|
22539
|
-
* `orderBy*()` function was used in this query. Specify a value that matches
|
|
22540
|
-
* the `orderBy*()` type. When used in combination with `orderByKey()`, the
|
|
22541
|
-
* value must be a string.
|
|
22542
|
-
* @param key - The child key to start after. This argument is only allowed if
|
|
22543
|
-
* ordering by child, value, or priority.
|
|
22544
|
-
*/
|
|
22545
|
-
function startAfter(value, key) {
|
|
22546
|
-
validateKey('startAfter', 'key', key, true);
|
|
22547
|
-
return new QueryStartAfterConstraint(value, key);
|
|
22548
|
-
}
|
|
22549
|
-
class QueryLimitToFirstConstraint extends QueryConstraint {
|
|
22550
|
-
constructor(_limit) {
|
|
22551
|
-
super();
|
|
22552
|
-
this._limit = _limit;
|
|
22553
|
-
}
|
|
22554
|
-
_apply(query) {
|
|
22555
|
-
if (query._queryParams.hasLimit()) {
|
|
22556
|
-
throw new Error('limitToFirst: Limit was already set (by another call to limitToFirst ' +
|
|
22557
|
-
'or limitToLast).');
|
|
22558
|
-
}
|
|
22559
|
-
return new QueryImpl(query._repo, query._path, queryParamsLimitToFirst(query._queryParams, this._limit), query._orderByCalled);
|
|
22560
|
-
}
|
|
22561
|
-
}
|
|
22562
|
-
/**
|
|
22563
|
-
* Creates a new `QueryConstraint` that if limited to the first specific number
|
|
22564
|
-
* of children.
|
|
22565
|
-
*
|
|
22566
|
-
* The `limitToFirst()` method is used to set a maximum number of children to be
|
|
22567
|
-
* synced for a given callback. If we set a limit of 100, we will initially only
|
|
22568
|
-
* receive up to 100 `child_added` events. If we have fewer than 100 messages
|
|
22569
|
-
* stored in our Database, a `child_added` event will fire for each message.
|
|
22570
|
-
* However, if we have over 100 messages, we will only receive a `child_added`
|
|
22571
|
-
* event for the first 100 ordered messages. As items change, we will receive
|
|
22572
|
-
* `child_removed` events for each item that drops out of the active list so
|
|
22573
|
-
* that the total number stays at 100.
|
|
22574
|
-
*
|
|
22575
|
-
* You can read more about `limitToFirst()` in
|
|
22576
|
-
* {@link https://firebase.google.com/docs/database/web/lists-of-data#filtering_data | Filtering data}.
|
|
22577
|
-
*
|
|
22578
|
-
* @param limit - The maximum number of nodes to include in this query.
|
|
22579
|
-
*/
|
|
22580
|
-
function limitToFirst(limit) {
|
|
22581
|
-
if (typeof limit !== 'number' || Math.floor(limit) !== limit || limit <= 0) {
|
|
22582
|
-
throw new Error('limitToFirst: First argument must be a positive integer.');
|
|
22583
|
-
}
|
|
22584
|
-
return new QueryLimitToFirstConstraint(limit);
|
|
22585
|
-
}
|
|
22586
|
-
class QueryLimitToLastConstraint extends QueryConstraint {
|
|
22587
|
-
constructor(_limit) {
|
|
22588
|
-
super();
|
|
22589
|
-
this._limit = _limit;
|
|
22590
|
-
}
|
|
22591
|
-
_apply(query) {
|
|
22592
|
-
if (query._queryParams.hasLimit()) {
|
|
22593
|
-
throw new Error('limitToLast: Limit was already set (by another call to limitToFirst ' +
|
|
22594
|
-
'or limitToLast).');
|
|
22595
|
-
}
|
|
22596
|
-
return new QueryImpl(query._repo, query._path, queryParamsLimitToLast(query._queryParams, this._limit), query._orderByCalled);
|
|
22597
|
-
}
|
|
22598
|
-
}
|
|
22599
|
-
/**
|
|
22600
|
-
* Creates a new `QueryConstraint` that is limited to return only the last
|
|
22601
|
-
* specified number of children.
|
|
22602
|
-
*
|
|
22603
|
-
* The `limitToLast()` method is used to set a maximum number of children to be
|
|
22604
|
-
* synced for a given callback. If we set a limit of 100, we will initially only
|
|
22605
|
-
* receive up to 100 `child_added` events. If we have fewer than 100 messages
|
|
22606
|
-
* stored in our Database, a `child_added` event will fire for each message.
|
|
22607
|
-
* However, if we have over 100 messages, we will only receive a `child_added`
|
|
22608
|
-
* event for the last 100 ordered messages. As items change, we will receive
|
|
22609
|
-
* `child_removed` events for each item that drops out of the active list so
|
|
22610
|
-
* that the total number stays at 100.
|
|
22611
|
-
*
|
|
22612
|
-
* You can read more about `limitToLast()` in
|
|
22613
|
-
* {@link https://firebase.google.com/docs/database/web/lists-of-data#filtering_data | Filtering data}.
|
|
22614
|
-
*
|
|
22615
|
-
* @param limit - The maximum number of nodes to include in this query.
|
|
22616
|
-
*/
|
|
22617
|
-
function limitToLast(limit) {
|
|
22618
|
-
if (typeof limit !== 'number' || Math.floor(limit) !== limit || limit <= 0) {
|
|
22619
|
-
throw new Error('limitToLast: First argument must be a positive integer.');
|
|
22620
|
-
}
|
|
22621
|
-
return new QueryLimitToLastConstraint(limit);
|
|
22622
|
-
}
|
|
22623
|
-
class QueryOrderByChildConstraint extends QueryConstraint {
|
|
22624
|
-
constructor(_path) {
|
|
22625
|
-
super();
|
|
22626
|
-
this._path = _path;
|
|
22627
|
-
}
|
|
22628
|
-
_apply(query) {
|
|
22629
|
-
validateNoPreviousOrderByCall(query, 'orderByChild');
|
|
22630
|
-
const parsedPath = new Path(this._path);
|
|
22631
|
-
if (pathIsEmpty(parsedPath)) {
|
|
22632
|
-
throw new Error('orderByChild: cannot pass in empty path. Use orderByValue() instead.');
|
|
22633
|
-
}
|
|
22634
|
-
const index = new PathIndex(parsedPath);
|
|
22635
|
-
const newParams = queryParamsOrderBy(query._queryParams, index);
|
|
22636
|
-
validateQueryEndpoints(newParams);
|
|
22637
|
-
return new QueryImpl(query._repo, query._path, newParams,
|
|
22638
|
-
/*orderByCalled=*/ true);
|
|
22639
|
-
}
|
|
22640
|
-
}
|
|
22641
|
-
/**
|
|
22642
|
-
* Creates a new `QueryConstraint` that orders by the specified child key.
|
|
22643
|
-
*
|
|
22644
|
-
* Queries can only order by one key at a time. Calling `orderByChild()`
|
|
22645
|
-
* multiple times on the same query is an error.
|
|
22646
|
-
*
|
|
22647
|
-
* Firebase queries allow you to order your data by any child key on the fly.
|
|
22648
|
-
* However, if you know in advance what your indexes will be, you can define
|
|
22649
|
-
* them via the .indexOn rule in your Security Rules for better performance. See
|
|
22650
|
-
* the{@link https://firebase.google.com/docs/database/security/indexing-data}
|
|
22651
|
-
* rule for more information.
|
|
22652
|
-
*
|
|
22653
|
-
* You can read more about `orderByChild()` in
|
|
22654
|
-
* {@link https://firebase.google.com/docs/database/web/lists-of-data#sort_data | Sort data}.
|
|
22655
|
-
*
|
|
22656
|
-
* @param path - The path to order by.
|
|
22657
|
-
*/
|
|
22658
|
-
function orderByChild(path) {
|
|
22659
|
-
if (path === '$key') {
|
|
22660
|
-
throw new Error('orderByChild: "$key" is invalid. Use orderByKey() instead.');
|
|
22661
|
-
}
|
|
22662
|
-
else if (path === '$priority') {
|
|
22663
|
-
throw new Error('orderByChild: "$priority" is invalid. Use orderByPriority() instead.');
|
|
22664
|
-
}
|
|
22665
|
-
else if (path === '$value') {
|
|
22666
|
-
throw new Error('orderByChild: "$value" is invalid. Use orderByValue() instead.');
|
|
22667
|
-
}
|
|
22668
|
-
validatePathString('orderByChild', 'path', path, false);
|
|
22669
|
-
return new QueryOrderByChildConstraint(path);
|
|
22670
|
-
}
|
|
22671
|
-
class QueryOrderByKeyConstraint extends QueryConstraint {
|
|
22672
|
-
_apply(query) {
|
|
22673
|
-
validateNoPreviousOrderByCall(query, 'orderByKey');
|
|
22674
|
-
const newParams = queryParamsOrderBy(query._queryParams, KEY_INDEX);
|
|
22675
|
-
validateQueryEndpoints(newParams);
|
|
22676
|
-
return new QueryImpl(query._repo, query._path, newParams,
|
|
22677
|
-
/*orderByCalled=*/ true);
|
|
22678
|
-
}
|
|
22679
|
-
}
|
|
22680
|
-
/**
|
|
22681
|
-
* Creates a new `QueryConstraint` that orders by the key.
|
|
22682
|
-
*
|
|
22683
|
-
* Sorts the results of a query by their (ascending) key values.
|
|
22684
|
-
*
|
|
22685
|
-
* You can read more about `orderByKey()` in
|
|
22686
|
-
* {@link https://firebase.google.com/docs/database/web/lists-of-data#sort_data | Sort data}.
|
|
22687
|
-
*/
|
|
22688
|
-
function orderByKey() {
|
|
22689
|
-
return new QueryOrderByKeyConstraint();
|
|
22690
|
-
}
|
|
22691
|
-
class QueryOrderByPriorityConstraint extends QueryConstraint {
|
|
22692
|
-
_apply(query) {
|
|
22693
|
-
validateNoPreviousOrderByCall(query, 'orderByPriority');
|
|
22694
|
-
const newParams = queryParamsOrderBy(query._queryParams, PRIORITY_INDEX);
|
|
22695
|
-
validateQueryEndpoints(newParams);
|
|
22696
|
-
return new QueryImpl(query._repo, query._path, newParams,
|
|
22697
|
-
/*orderByCalled=*/ true);
|
|
22698
|
-
}
|
|
22699
|
-
}
|
|
22700
|
-
/**
|
|
22701
|
-
* Creates a new `QueryConstraint` that orders by priority.
|
|
22702
|
-
*
|
|
22703
|
-
* Applications need not use priority but can order collections by
|
|
22704
|
-
* ordinary properties (see
|
|
22705
|
-
* {@link https://firebase.google.com/docs/database/web/lists-of-data#sort_data | Sort data}
|
|
22706
|
-
* for alternatives to priority.
|
|
22707
|
-
*/
|
|
22708
|
-
function orderByPriority() {
|
|
22709
|
-
return new QueryOrderByPriorityConstraint();
|
|
22710
|
-
}
|
|
22711
|
-
class QueryOrderByValueConstraint extends QueryConstraint {
|
|
22712
|
-
_apply(query) {
|
|
22713
|
-
validateNoPreviousOrderByCall(query, 'orderByValue');
|
|
22714
|
-
const newParams = queryParamsOrderBy(query._queryParams, VALUE_INDEX);
|
|
22715
|
-
validateQueryEndpoints(newParams);
|
|
22716
|
-
return new QueryImpl(query._repo, query._path, newParams,
|
|
22717
|
-
/*orderByCalled=*/ true);
|
|
22718
|
-
}
|
|
22719
|
-
}
|
|
22720
|
-
/**
|
|
22721
|
-
* Creates a new `QueryConstraint` that orders by value.
|
|
22722
|
-
*
|
|
22723
|
-
* If the children of a query are all scalar values (string, number, or
|
|
22724
|
-
* boolean), you can order the results by their (ascending) values.
|
|
22725
|
-
*
|
|
22726
|
-
* You can read more about `orderByValue()` in
|
|
22727
|
-
* {@link https://firebase.google.com/docs/database/web/lists-of-data#sort_data | Sort data}.
|
|
22728
|
-
*/
|
|
22729
|
-
function orderByValue() {
|
|
22730
|
-
return new QueryOrderByValueConstraint();
|
|
22731
|
-
}
|
|
22732
|
-
class QueryEqualToValueConstraint extends QueryConstraint {
|
|
22733
|
-
constructor(_value, _key) {
|
|
22734
|
-
super();
|
|
22735
|
-
this._value = _value;
|
|
22736
|
-
this._key = _key;
|
|
22737
|
-
}
|
|
22738
|
-
_apply(query) {
|
|
22739
|
-
validateFirebaseDataArg('equalTo', this._value, query._path, false);
|
|
22740
|
-
if (query._queryParams.hasStart()) {
|
|
22741
|
-
throw new Error('equalTo: Starting point was already set (by another call to startAt/startAfter or ' +
|
|
22742
|
-
'equalTo).');
|
|
22743
|
-
}
|
|
22744
|
-
if (query._queryParams.hasEnd()) {
|
|
22745
|
-
throw new Error('equalTo: Ending point was already set (by another call to endAt/endBefore or ' +
|
|
22746
|
-
'equalTo).');
|
|
22747
|
-
}
|
|
22748
|
-
return new QueryEndAtConstraint(this._value, this._key)._apply(new QueryStartAtConstraint(this._value, this._key)._apply(query));
|
|
22749
|
-
}
|
|
22750
|
-
}
|
|
22751
|
-
/**
|
|
22752
|
-
* Creates a `QueryConstraint` that includes children that match the specified
|
|
22753
|
-
* value.
|
|
22754
|
-
*
|
|
22755
|
-
* Using `startAt()`, `startAfter()`, `endBefore()`, `endAt()` and `equalTo()`
|
|
22756
|
-
* allows you to choose arbitrary starting and ending points for your queries.
|
|
22757
|
-
*
|
|
22758
|
-
* The optional key argument can be used to further limit the range of the
|
|
22759
|
-
* query. If it is specified, then children that have exactly the specified
|
|
22760
|
-
* value must also have exactly the specified key as their key name. This can be
|
|
22761
|
-
* used to filter result sets with many matches for the same value.
|
|
22762
|
-
*
|
|
22763
|
-
* You can read more about `equalTo()` in
|
|
22764
|
-
* {@link https://firebase.google.com/docs/database/web/lists-of-data#filtering_data | Filtering data}.
|
|
22765
|
-
*
|
|
22766
|
-
* @param value - The value to match for. The argument type depends on which
|
|
22767
|
-
* `orderBy*()` function was used in this query. Specify a value that matches
|
|
22768
|
-
* the `orderBy*()` type. When used in combination with `orderByKey()`, the
|
|
22769
|
-
* value must be a string.
|
|
22770
|
-
* @param key - The child key to start at, among the children with the
|
|
22771
|
-
* previously specified priority. This argument is only allowed if ordering by
|
|
22772
|
-
* child, value, or priority.
|
|
22773
|
-
*/
|
|
22774
|
-
function equalTo(value, key) {
|
|
22775
|
-
validateKey('equalTo', 'key', key, true);
|
|
22776
|
-
return new QueryEqualToValueConstraint(value, key);
|
|
22777
|
-
}
|
|
22778
|
-
/**
|
|
22779
|
-
* Creates a new immutable instance of `Query` that is extended to also include
|
|
22780
|
-
* additional query constraints.
|
|
22781
|
-
*
|
|
22782
|
-
* @param query - The Query instance to use as a base for the new constraints.
|
|
22783
|
-
* @param queryConstraints - The list of `QueryConstraint`s to apply.
|
|
22784
|
-
* @throws if any of the provided query constraints cannot be combined with the
|
|
22785
|
-
* existing or new constraints.
|
|
22786
|
-
*/
|
|
22787
|
-
function query(query, ...queryConstraints) {
|
|
22788
|
-
let queryImpl = getModularInstance(query);
|
|
22789
|
-
for (const constraint of queryConstraints) {
|
|
22790
|
-
queryImpl = constraint._apply(queryImpl);
|
|
22791
|
-
}
|
|
22792
|
-
return queryImpl;
|
|
22793
|
-
}
|
|
22794
20682
|
/**
|
|
22795
20683
|
* Define reference constructor in various modules
|
|
22796
20684
|
*
|
|
@@ -22919,12 +20807,6 @@ function repoManagerCreateRepo(repoInfo, app, authTokenProvider, appCheckProvide
|
|
|
22919
20807
|
appRepos[repoInfo.toURLString()] = repo;
|
|
22920
20808
|
return repo;
|
|
22921
20809
|
}
|
|
22922
|
-
/**
|
|
22923
|
-
* Forces us to use ReadonlyRestClient instead of PersistentConnection for new Repos.
|
|
22924
|
-
*/
|
|
22925
|
-
function repoManagerForceRestClient(forceRestClient) {
|
|
22926
|
-
useRestClient = forceRestClient;
|
|
22927
|
-
}
|
|
22928
20810
|
/**
|
|
22929
20811
|
* Class representing a Firebase Realtime Database.
|
|
22930
20812
|
*/
|
|
@@ -22967,26 +20849,6 @@ class Database {
|
|
|
22967
20849
|
}
|
|
22968
20850
|
}
|
|
22969
20851
|
}
|
|
22970
|
-
function checkTransportInit() {
|
|
22971
|
-
if (TransportManager.IS_TRANSPORT_INITIALIZED) {
|
|
22972
|
-
warn('Transport has already been initialized. Please call this function before calling ref or setting up a listener');
|
|
22973
|
-
}
|
|
22974
|
-
}
|
|
22975
|
-
/**
|
|
22976
|
-
* Force the use of websockets instead of longPolling.
|
|
22977
|
-
*/
|
|
22978
|
-
function forceWebSockets() {
|
|
22979
|
-
checkTransportInit();
|
|
22980
|
-
BrowserPollConnection.forceDisallow();
|
|
22981
|
-
}
|
|
22982
|
-
/**
|
|
22983
|
-
* Force the use of longPolling instead of websockets. This will be ignored if websocket protocol is used in databaseURL.
|
|
22984
|
-
*/
|
|
22985
|
-
function forceLongPolling() {
|
|
22986
|
-
checkTransportInit();
|
|
22987
|
-
WebSocketConnection.forceDisallow();
|
|
22988
|
-
BrowserPollConnection.forceAllow();
|
|
22989
|
-
}
|
|
22990
20852
|
/**
|
|
22991
20853
|
* Returns the instance of the Realtime Database SDK that is associated
|
|
22992
20854
|
* with the provided {@link @firebase/app#FirebaseApp}. Initializes a new instance with
|
|
@@ -23045,51 +20907,6 @@ function connectDatabaseEmulator(db, host, port, options = {}) {
|
|
|
23045
20907
|
// Modify the repo to apply emulator settings
|
|
23046
20908
|
repoManagerApplyEmulatorSettings(repo, host, port, tokenProvider);
|
|
23047
20909
|
}
|
|
23048
|
-
/**
|
|
23049
|
-
* Disconnects from the server (all Database operations will be completed
|
|
23050
|
-
* offline).
|
|
23051
|
-
*
|
|
23052
|
-
* The client automatically maintains a persistent connection to the Database
|
|
23053
|
-
* server, which will remain active indefinitely and reconnect when
|
|
23054
|
-
* disconnected. However, the `goOffline()` and `goOnline()` methods may be used
|
|
23055
|
-
* to control the client connection in cases where a persistent connection is
|
|
23056
|
-
* undesirable.
|
|
23057
|
-
*
|
|
23058
|
-
* While offline, the client will no longer receive data updates from the
|
|
23059
|
-
* Database. However, all Database operations performed locally will continue to
|
|
23060
|
-
* immediately fire events, allowing your application to continue behaving
|
|
23061
|
-
* normally. Additionally, each operation performed locally will automatically
|
|
23062
|
-
* be queued and retried upon reconnection to the Database server.
|
|
23063
|
-
*
|
|
23064
|
-
* To reconnect to the Database and begin receiving remote events, see
|
|
23065
|
-
* `goOnline()`.
|
|
23066
|
-
*
|
|
23067
|
-
* @param db - The instance to disconnect.
|
|
23068
|
-
*/
|
|
23069
|
-
function goOffline(db) {
|
|
23070
|
-
db = getModularInstance(db);
|
|
23071
|
-
db._checkNotDeleted('goOffline');
|
|
23072
|
-
repoInterrupt(db._repo);
|
|
23073
|
-
}
|
|
23074
|
-
/**
|
|
23075
|
-
* Reconnects to the server and synchronizes the offline Database state
|
|
23076
|
-
* with the server state.
|
|
23077
|
-
*
|
|
23078
|
-
* This method should be used after disabling the active connection with
|
|
23079
|
-
* `goOffline()`. Once reconnected, the client will transmit the proper data
|
|
23080
|
-
* and fire the appropriate events so that your client "catches up"
|
|
23081
|
-
* automatically.
|
|
23082
|
-
*
|
|
23083
|
-
* @param db - The instance to reconnect.
|
|
23084
|
-
*/
|
|
23085
|
-
function goOnline(db) {
|
|
23086
|
-
db = getModularInstance(db);
|
|
23087
|
-
db._checkNotDeleted('goOnline');
|
|
23088
|
-
repoResume(db._repo);
|
|
23089
|
-
}
|
|
23090
|
-
function enableLogging(logger, persistent) {
|
|
23091
|
-
enableLogging$1(logger, persistent);
|
|
23092
|
-
}
|
|
23093
20910
|
|
|
23094
20911
|
/**
|
|
23095
20912
|
* @license
|
|
@@ -23119,164 +20936,6 @@ function registerDatabase(variant) {
|
|
|
23119
20936
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
23120
20937
|
registerVersion(name, version, 'esm2017');
|
|
23121
20938
|
}
|
|
23122
|
-
|
|
23123
|
-
/**
|
|
23124
|
-
* @license
|
|
23125
|
-
* Copyright 2020 Google LLC
|
|
23126
|
-
*
|
|
23127
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
23128
|
-
* you may not use this file except in compliance with the License.
|
|
23129
|
-
* You may obtain a copy of the License at
|
|
23130
|
-
*
|
|
23131
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
23132
|
-
*
|
|
23133
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
23134
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
23135
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
23136
|
-
* See the License for the specific language governing permissions and
|
|
23137
|
-
* limitations under the License.
|
|
23138
|
-
*/
|
|
23139
|
-
const SERVER_TIMESTAMP = {
|
|
23140
|
-
'.sv': 'timestamp'
|
|
23141
|
-
};
|
|
23142
|
-
/**
|
|
23143
|
-
* Returns a placeholder value for auto-populating the current timestamp (time
|
|
23144
|
-
* since the Unix epoch, in milliseconds) as determined by the Firebase
|
|
23145
|
-
* servers.
|
|
23146
|
-
*/
|
|
23147
|
-
function serverTimestamp() {
|
|
23148
|
-
return SERVER_TIMESTAMP;
|
|
23149
|
-
}
|
|
23150
|
-
/**
|
|
23151
|
-
* Returns a placeholder value that can be used to atomically increment the
|
|
23152
|
-
* current database value by the provided delta.
|
|
23153
|
-
*
|
|
23154
|
-
* @param delta - the amount to modify the current value atomically.
|
|
23155
|
-
* @returns A placeholder value for modifying data atomically server-side.
|
|
23156
|
-
*/
|
|
23157
|
-
function increment(delta) {
|
|
23158
|
-
return {
|
|
23159
|
-
'.sv': {
|
|
23160
|
-
'increment': delta
|
|
23161
|
-
}
|
|
23162
|
-
};
|
|
23163
|
-
}
|
|
23164
|
-
|
|
23165
|
-
/**
|
|
23166
|
-
* @license
|
|
23167
|
-
* Copyright 2020 Google LLC
|
|
23168
|
-
*
|
|
23169
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
23170
|
-
* you may not use this file except in compliance with the License.
|
|
23171
|
-
* You may obtain a copy of the License at
|
|
23172
|
-
*
|
|
23173
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
23174
|
-
*
|
|
23175
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
23176
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
23177
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
23178
|
-
* See the License for the specific language governing permissions and
|
|
23179
|
-
* limitations under the License.
|
|
23180
|
-
*/
|
|
23181
|
-
/**
|
|
23182
|
-
* A type for the resolve value of {@link runTransaction}.
|
|
23183
|
-
*/
|
|
23184
|
-
class TransactionResult {
|
|
23185
|
-
/** @hideconstructor */
|
|
23186
|
-
constructor(
|
|
23187
|
-
/** Whether the transaction was successfully committed. */
|
|
23188
|
-
committed,
|
|
23189
|
-
/** The resulting data snapshot. */
|
|
23190
|
-
snapshot) {
|
|
23191
|
-
this.committed = committed;
|
|
23192
|
-
this.snapshot = snapshot;
|
|
23193
|
-
}
|
|
23194
|
-
/** Returns a JSON-serializable representation of this object. */
|
|
23195
|
-
toJSON() {
|
|
23196
|
-
return { committed: this.committed, snapshot: this.snapshot.toJSON() };
|
|
23197
|
-
}
|
|
23198
|
-
}
|
|
23199
|
-
/**
|
|
23200
|
-
* Atomically modifies the data at this location.
|
|
23201
|
-
*
|
|
23202
|
-
* Atomically modify the data at this location. Unlike a normal `set()`, which
|
|
23203
|
-
* just overwrites the data regardless of its previous value, `runTransaction()` is
|
|
23204
|
-
* used to modify the existing value to a new value, ensuring there are no
|
|
23205
|
-
* conflicts with other clients writing to the same location at the same time.
|
|
23206
|
-
*
|
|
23207
|
-
* To accomplish this, you pass `runTransaction()` an update function which is
|
|
23208
|
-
* used to transform the current value into a new value. If another client
|
|
23209
|
-
* writes to the location before your new value is successfully written, your
|
|
23210
|
-
* update function will be called again with the new current value, and the
|
|
23211
|
-
* write will be retried. This will happen repeatedly until your write succeeds
|
|
23212
|
-
* without conflict or you abort the transaction by not returning a value from
|
|
23213
|
-
* your update function.
|
|
23214
|
-
*
|
|
23215
|
-
* Note: Modifying data with `set()` will cancel any pending transactions at
|
|
23216
|
-
* that location, so extreme care should be taken if mixing `set()` and
|
|
23217
|
-
* `runTransaction()` to update the same data.
|
|
23218
|
-
*
|
|
23219
|
-
* Note: When using transactions with Security and Firebase Rules in place, be
|
|
23220
|
-
* aware that a client needs `.read` access in addition to `.write` access in
|
|
23221
|
-
* order to perform a transaction. This is because the client-side nature of
|
|
23222
|
-
* transactions requires the client to read the data in order to transactionally
|
|
23223
|
-
* update it.
|
|
23224
|
-
*
|
|
23225
|
-
* @param ref - The location to atomically modify.
|
|
23226
|
-
* @param transactionUpdate - A developer-supplied function which will be passed
|
|
23227
|
-
* the current data stored at this location (as a JavaScript object). The
|
|
23228
|
-
* function should return the new value it would like written (as a JavaScript
|
|
23229
|
-
* object). If `undefined` is returned (i.e. you return with no arguments) the
|
|
23230
|
-
* transaction will be aborted and the data at this location will not be
|
|
23231
|
-
* modified.
|
|
23232
|
-
* @param options - An options object to configure transactions.
|
|
23233
|
-
* @returns A `Promise` that can optionally be used instead of the `onComplete`
|
|
23234
|
-
* callback to handle success and failure.
|
|
23235
|
-
*/
|
|
23236
|
-
function runTransaction(ref,
|
|
23237
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23238
|
-
transactionUpdate, options) {
|
|
23239
|
-
var _a;
|
|
23240
|
-
ref = getModularInstance(ref);
|
|
23241
|
-
validateWritablePath('Reference.transaction', ref._path);
|
|
23242
|
-
if (ref.key === '.length' || ref.key === '.keys') {
|
|
23243
|
-
throw ('Reference.transaction failed: ' + ref.key + ' is a read-only object.');
|
|
23244
|
-
}
|
|
23245
|
-
const applyLocally = (_a = options === null || options === void 0 ? void 0 : options.applyLocally) !== null && _a !== void 0 ? _a : true;
|
|
23246
|
-
const deferred = new Deferred();
|
|
23247
|
-
const promiseComplete = (error, committed, node) => {
|
|
23248
|
-
let dataSnapshot = null;
|
|
23249
|
-
if (error) {
|
|
23250
|
-
deferred.reject(error);
|
|
23251
|
-
}
|
|
23252
|
-
else {
|
|
23253
|
-
dataSnapshot = new DataSnapshot(node, new ReferenceImpl(ref._repo, ref._path), PRIORITY_INDEX);
|
|
23254
|
-
deferred.resolve(new TransactionResult(committed, dataSnapshot));
|
|
23255
|
-
}
|
|
23256
|
-
};
|
|
23257
|
-
// Add a watch to make sure we get server updates.
|
|
23258
|
-
const unwatcher = onValue(ref, () => { });
|
|
23259
|
-
repoStartTransaction(ref._repo, ref._path, transactionUpdate, promiseComplete, unwatcher, applyLocally);
|
|
23260
|
-
return deferred.promise;
|
|
23261
|
-
}
|
|
23262
|
-
|
|
23263
|
-
/**
|
|
23264
|
-
* @license
|
|
23265
|
-
* Copyright 2017 Google LLC
|
|
23266
|
-
*
|
|
23267
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
23268
|
-
* you may not use this file except in compliance with the License.
|
|
23269
|
-
* You may obtain a copy of the License at
|
|
23270
|
-
*
|
|
23271
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
23272
|
-
*
|
|
23273
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
23274
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
23275
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
23276
|
-
* See the License for the specific language governing permissions and
|
|
23277
|
-
* limitations under the License.
|
|
23278
|
-
*/
|
|
23279
|
-
PersistentConnection;
|
|
23280
20939
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23281
20940
|
PersistentConnection.prototype.simpleListen = function (pathString, onComplete) {
|
|
23282
20941
|
this.sendRequest('q', { p: pathString }, onComplete);
|
|
@@ -23285,31 +20944,6 @@ PersistentConnection.prototype.simpleListen = function (pathString, onComplete)
|
|
|
23285
20944
|
PersistentConnection.prototype.echo = function (data, onEcho) {
|
|
23286
20945
|
this.sendRequest('echo', { d: data }, onEcho);
|
|
23287
20946
|
};
|
|
23288
|
-
// RealTimeConnection properties that we use in tests.
|
|
23289
|
-
Connection;
|
|
23290
|
-
/**
|
|
23291
|
-
* @internal
|
|
23292
|
-
*/
|
|
23293
|
-
const hijackHash = function (newHash) {
|
|
23294
|
-
const oldPut = PersistentConnection.prototype.put;
|
|
23295
|
-
PersistentConnection.prototype.put = function (pathString, data, onComplete, hash) {
|
|
23296
|
-
if (hash !== undefined) {
|
|
23297
|
-
hash = newHash();
|
|
23298
|
-
}
|
|
23299
|
-
oldPut.call(this, pathString, data, onComplete, hash);
|
|
23300
|
-
};
|
|
23301
|
-
return function () {
|
|
23302
|
-
PersistentConnection.prototype.put = oldPut;
|
|
23303
|
-
};
|
|
23304
|
-
};
|
|
23305
|
-
RepoInfo;
|
|
23306
|
-
/**
|
|
23307
|
-
* Forces the RepoManager to create Repos that use ReadonlyRestClient instead of PersistentConnection.
|
|
23308
|
-
* @internal
|
|
23309
|
-
*/
|
|
23310
|
-
const forceRestClient = function (forceRestClient) {
|
|
23311
|
-
repoManagerForceRestClient(forceRestClient);
|
|
23312
|
-
};
|
|
23313
20947
|
|
|
23314
20948
|
/**
|
|
23315
20949
|
* Firebase Realtime Database
|
|
@@ -23319,7 +20953,7 @@ const forceRestClient = function (forceRestClient) {
|
|
|
23319
20953
|
registerDatabase();
|
|
23320
20954
|
|
|
23321
20955
|
var dayjs_min = createCommonjsModule(function (module, exports) {
|
|
23322
|
-
!function(t,e){
|
|
20956
|
+
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",$="Invalid Date",l=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},g={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},D="en",v={};v[D]=M;var p=function(t){return t instanceof _},S=function(t,e,n){var r;if(!t)return D;if("string"==typeof t)v[t]&&(r=t),e&&(v[t]=e,r=t);else {var i=t.name;v[i]=t,r=i;}return !n&&r&&(D=r),r||!n&&D},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=g;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t);}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(l);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return O},m.isValid=function(){return !(this.$d.toString()===$)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),$=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},l=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,g="set"+(this.$u?"UTC":"");switch(h){case c:return r?$(1,0):$(31,11);case f:return r?$(1,M):$(0,M+1);case o:var D=this.$locale().weekStart||0,v=(y<D?y+7:y)-D;return $(r?m-v:m+(6-v),M);case a:case d:return l(g+"Hours",0);case u:return l(g+"Minutes",1);case s:return l(g+"Seconds",2);case i:return l(g+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h="set"+(this.$u?"UTC":""),$=(n={},n[a]=h+"Date",n[d]=h+"Date",n[f]=h+"Month",n[c]=h+"FullYear",n[u]=h+"Hours",n[s]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],l=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[$](l),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else $&&this.$d[$](l);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,$=this;r=Number(r);var l=O.p(h),y=function(t){var e=w($);return O.w(e.date(e.date()+Math.round(t*r)),$)};if(l===f)return this.set(f,this.$M+r);if(l===c)return this.set(c,this.$y+r);if(l===a)return y(1);if(l===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[l]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||$;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].substr(0,s)},c=function(t){return O.s(s%12||12,t,"0")},d=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},l={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:O.s(a+1,2,"0"),MMM:h(n.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:h(n.weekdaysMin,this.$W,o,2),ddd:h(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:O.s(s,2,"0"),h:c(1),hh:c(2),a:d(s,u,!0),A:d(s,u,!1),m:String(u),mm:O.s(u,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:i};return r.replace(y,(function(t,e){return e||l[t]||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,$){var l,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,g=this-M,D=O.m(this,M);return D=(l={},l[c]=D/12,l[f]=D,l[h]=D/3,l[o]=(g-m)/6048e5,l[a]=(g-m)/864e5,l[u]=g/n,l[s]=g/e,l[i]=g/t,l)[y]||g,$?D:O.a(D)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return v[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),b=_.prototype;return w.prototype=b,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",f],["$y",c],["$D",d]].forEach((function(t){b[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),w.extend=function(t,e){return t.$i||(t(e,_,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=v[D],w.Ls=v,w.p={},w}));
|
|
23323
20957
|
});
|
|
23324
20958
|
|
|
23325
20959
|
function createService(blob) {
|
|
@@ -23520,8 +21154,6 @@ function createReviewPhoto(blob) {
|
|
|
23520
21154
|
imageUrlThumb: blob.full_image_url_thumb,
|
|
23521
21155
|
};
|
|
23522
21156
|
}
|
|
23523
|
-
class Review {
|
|
23524
|
-
}
|
|
23525
21157
|
function createReview(blob) {
|
|
23526
21158
|
const reviewPhotos = blob.review_photo || [];
|
|
23527
21159
|
const [createdDay, createdTime] = String(blob.create_date).split(' ');
|
|
@@ -23812,7 +21444,7 @@ class HttpService {
|
|
|
23812
21444
|
const roomMessagesRef = ref(this.firebaseDatabase, `${firebaseMessagesNode}/${roomId}`);
|
|
23813
21445
|
const updates = {};
|
|
23814
21446
|
roomMessages.forEach(message => {
|
|
23815
|
-
const
|
|
21447
|
+
const nestedMessage = __rest(message, ["uid"]);
|
|
23816
21448
|
updates[`${message.uid}`] = Object.assign(Object.assign({}, nestedMessage), { unRead: 0 });
|
|
23817
21449
|
});
|
|
23818
21450
|
return update(roomMessagesRef, updates);
|
|
@@ -23851,4 +21483,4 @@ class HttpService {
|
|
|
23851
21483
|
}
|
|
23852
21484
|
const HttpService$1 = () => new HttpService();
|
|
23853
21485
|
|
|
23854
|
-
export { BusinessHourStatus as B, HttpService$1 as H,
|
|
21486
|
+
export { BusinessHourStatus as B, HttpService$1 as H, dateFormat as a, sortBy_1 as b, dayjs_min as d, getSalonImage as g, isVideoMedia as i, shortDateYearFormat as s };
|