No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.esm5.js 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. import firebase from '@firebase/app-compat';
  2. import { httpsCallable, httpsCallableFromURL, connectFunctionsEmulator } from '@firebase/functions';
  3. import { FirebaseError } from '@firebase/util';
  4. import { Component } from '@firebase/component';
  5. var name = "@firebase/functions-compat";
  6. var version = "0.3.1";
  7. /**
  8. * @license
  9. * Copyright 2020 Google LLC
  10. *
  11. * Licensed under the Apache License, Version 2.0 (the "License");
  12. * you may not use this file except in compliance with the License.
  13. * You may obtain a copy of the License at
  14. *
  15. * http://www.apache.org/licenses/LICENSE-2.0
  16. *
  17. * Unless required by applicable law or agreed to in writing, software
  18. * distributed under the License is distributed on an "AS IS" BASIS,
  19. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  20. * See the License for the specific language governing permissions and
  21. * limitations under the License.
  22. */
  23. var FunctionsService = /** @class */ (function () {
  24. function FunctionsService(app, _delegate) {
  25. this.app = app;
  26. this._delegate = _delegate;
  27. this._region = this._delegate.region;
  28. this._customDomain = this._delegate.customDomain;
  29. }
  30. FunctionsService.prototype.httpsCallable = function (name, options) {
  31. return httpsCallable(this._delegate, name, options);
  32. };
  33. FunctionsService.prototype.httpsCallableFromURL = function (url, options) {
  34. return httpsCallableFromURL(this._delegate, url, options);
  35. };
  36. /**
  37. * Deprecated in pre-modularized repo, does not exist in modularized
  38. * functions package, need to convert to "host" and "port" args that
  39. * `useFunctionsEmulatorExp` takes.
  40. * @deprecated
  41. */
  42. FunctionsService.prototype.useFunctionsEmulator = function (origin) {
  43. var match = origin.match('[a-zA-Z]+://([a-zA-Z0-9.-]+)(?::([0-9]+))?');
  44. if (match == null) {
  45. throw new FirebaseError('functions', 'No origin provided to useFunctionsEmulator()');
  46. }
  47. if (match[2] == null) {
  48. throw new FirebaseError('functions', 'Port missing in origin provided to useFunctionsEmulator()');
  49. }
  50. return connectFunctionsEmulator(this._delegate, match[1], Number(match[2]));
  51. };
  52. FunctionsService.prototype.useEmulator = function (host, port) {
  53. return connectFunctionsEmulator(this._delegate, host, port);
  54. };
  55. return FunctionsService;
  56. }());
  57. /**
  58. * @license
  59. * Copyright 2020 Google LLC
  60. *
  61. * Licensed under the Apache License, Version 2.0 (the "License");
  62. * you may not use this file except in compliance with the License.
  63. * You may obtain a copy of the License at
  64. *
  65. * http://www.apache.org/licenses/LICENSE-2.0
  66. *
  67. * Unless required by applicable law or agreed to in writing, software
  68. * distributed under the License is distributed on an "AS IS" BASIS,
  69. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  70. * See the License for the specific language governing permissions and
  71. * limitations under the License.
  72. */
  73. var DEFAULT_REGION = 'us-central1';
  74. var factory = function (container, _a) {
  75. var regionOrCustomDomain = _a.instanceIdentifier;
  76. // Dependencies
  77. var app = container.getProvider('app-compat').getImmediate();
  78. var functionsServiceExp = container.getProvider('functions').getImmediate({
  79. identifier: regionOrCustomDomain !== null && regionOrCustomDomain !== void 0 ? regionOrCustomDomain : DEFAULT_REGION
  80. });
  81. return new FunctionsService(app, functionsServiceExp);
  82. };
  83. function registerFunctions() {
  84. var namespaceExports = {
  85. Functions: FunctionsService
  86. };
  87. firebase.INTERNAL.registerComponent(new Component('functions-compat', factory, "PUBLIC" /* ComponentType.PUBLIC */)
  88. .setServiceProps(namespaceExports)
  89. .setMultipleInstances(true));
  90. }
  91. /**
  92. * @license
  93. * Copyright 2020 Google LLC
  94. *
  95. * Licensed under the Apache License, Version 2.0 (the "License");
  96. * you may not use this file except in compliance with the License.
  97. * You may obtain a copy of the License at
  98. *
  99. * http://www.apache.org/licenses/LICENSE-2.0
  100. *
  101. * Unless required by applicable law or agreed to in writing, software
  102. * distributed under the License is distributed on an "AS IS" BASIS,
  103. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  104. * See the License for the specific language governing permissions and
  105. * limitations under the License.
  106. */
  107. registerFunctions();
  108. firebase.registerVersion(name, version);
  109. //# sourceMappingURL=index.esm5.js.map