firebase-functions 6.6.0 → 7.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/lib/_virtual/rolldown_runtime.js +34 -0
  2. package/lib/bin/firebase-functions.js +78 -103
  3. package/lib/common/app.js +35 -55
  4. package/lib/common/change.js +54 -75
  5. package/lib/common/config.js +41 -41
  6. package/lib/common/debug.js +23 -47
  7. package/lib/common/encoding.js +59 -82
  8. package/lib/common/onInit.js +26 -28
  9. package/lib/common/options.js +22 -42
  10. package/lib/common/params.d.ts +6 -6
  11. package/lib/common/params.js +0 -23
  12. package/lib/common/providers/database.js +270 -300
  13. package/lib/common/providers/firestore.js +66 -92
  14. package/lib/common/providers/https.d.ts +0 -1
  15. package/lib/common/providers/https.js +537 -539
  16. package/lib/common/providers/identity.js +393 -444
  17. package/lib/common/providers/tasks.js +64 -98
  18. package/lib/common/timezone.js +544 -542
  19. package/lib/common/trace.d.ts +0 -1
  20. package/lib/common/trace.js +63 -55
  21. package/lib/common/utilities/assertions.d.ts +11 -0
  22. package/lib/common/utilities/assertions.js +18 -0
  23. package/lib/common/utilities/encoder.js +20 -37
  24. package/lib/common/utilities/path-pattern.js +106 -132
  25. package/lib/common/utilities/path.js +28 -27
  26. package/lib/common/utilities/utils.js +23 -45
  27. package/lib/esm/_virtual/rolldown_runtime.mjs +16 -0
  28. package/lib/esm/bin/firebase-functions.mjs +91 -0
  29. package/lib/esm/common/app.mjs +39 -0
  30. package/lib/esm/common/change.mjs +57 -0
  31. package/lib/esm/common/config.mjs +45 -0
  32. package/lib/esm/common/debug.mjs +28 -0
  33. package/lib/esm/common/encoding.mjs +69 -0
  34. package/lib/esm/common/onInit.mjs +33 -0
  35. package/lib/esm/common/options.mjs +22 -0
  36. package/lib/esm/common/params.mjs +1 -0
  37. package/lib/esm/common/providers/database.mjs +269 -0
  38. package/lib/esm/common/providers/firestore.mjs +78 -0
  39. package/lib/esm/common/providers/https.mjs +573 -0
  40. package/lib/esm/common/providers/identity.mjs +428 -0
  41. package/lib/esm/common/providers/tasks.mjs +67 -0
  42. package/lib/esm/common/timezone.mjs +544 -0
  43. package/lib/esm/common/trace.mjs +73 -0
  44. package/lib/esm/common/utilities/assertions.mjs +17 -0
  45. package/lib/esm/common/utilities/encoder.mjs +21 -0
  46. package/lib/esm/common/utilities/path-pattern.mjs +116 -0
  47. package/lib/esm/common/utilities/path.mjs +35 -0
  48. package/lib/esm/common/utilities/utils.mjs +29 -0
  49. package/lib/esm/function-configuration.mjs +1 -0
  50. package/lib/esm/logger/common.mjs +23 -0
  51. package/lib/esm/logger/compat.mjs +25 -0
  52. package/lib/esm/logger/index.mjs +131 -0
  53. package/lib/esm/params/index.mjs +160 -0
  54. package/lib/esm/params/types.mjs +400 -0
  55. package/lib/esm/runtime/loader.mjs +132 -0
  56. package/lib/esm/runtime/manifest.mjs +134 -0
  57. package/lib/esm/types/global.d.mjs +1 -0
  58. package/lib/esm/v1/cloud-functions.mjs +206 -0
  59. package/lib/esm/v1/config.mjs +14 -0
  60. package/lib/esm/v1/function-builder.mjs +252 -0
  61. package/lib/esm/v1/function-configuration.mjs +72 -0
  62. package/lib/esm/v1/index.mjs +27 -0
  63. package/lib/esm/v1/providers/analytics.mjs +212 -0
  64. package/lib/esm/v1/providers/auth.mjs +156 -0
  65. package/lib/esm/v1/providers/database.mjs +243 -0
  66. package/lib/esm/v1/providers/firestore.mjs +131 -0
  67. package/lib/esm/v1/providers/https.mjs +82 -0
  68. package/lib/esm/v1/providers/pubsub.mjs +175 -0
  69. package/lib/esm/v1/providers/remoteConfig.mjs +64 -0
  70. package/lib/esm/v1/providers/storage.mjs +163 -0
  71. package/lib/esm/v1/providers/tasks.mjs +63 -0
  72. package/lib/esm/v1/providers/testLab.mjs +94 -0
  73. package/lib/esm/v2/core.mjs +4 -0
  74. package/lib/esm/v2/index.mjs +28 -0
  75. package/lib/esm/v2/options.mjs +102 -0
  76. package/lib/esm/v2/providers/alerts/alerts.mjs +85 -0
  77. package/lib/esm/v2/providers/alerts/appDistribution.mjs +75 -0
  78. package/lib/esm/v2/providers/alerts/billing.mjs +51 -0
  79. package/lib/esm/v2/providers/alerts/crashlytics.mjs +122 -0
  80. package/lib/esm/v2/providers/alerts/index.mjs +22 -0
  81. package/lib/esm/v2/providers/alerts/performance.mjs +66 -0
  82. package/lib/esm/v2/providers/database.mjs +197 -0
  83. package/lib/esm/v2/providers/dataconnect.mjs +130 -0
  84. package/lib/esm/v2/providers/eventarc.mjs +51 -0
  85. package/lib/esm/v2/providers/firestore.mjs +294 -0
  86. package/lib/esm/v2/providers/https.mjs +210 -0
  87. package/lib/esm/v2/providers/identity.mjs +103 -0
  88. package/lib/esm/v2/providers/pubsub.mjs +148 -0
  89. package/lib/esm/v2/providers/remoteConfig.mjs +52 -0
  90. package/lib/esm/v2/providers/scheduler.mjs +84 -0
  91. package/lib/esm/v2/providers/storage.mjs +155 -0
  92. package/lib/esm/v2/providers/tasks.mjs +65 -0
  93. package/lib/esm/v2/providers/testLab.mjs +53 -0
  94. package/lib/esm/v2/trace.mjs +20 -0
  95. package/lib/function-configuration.d.ts +0 -0
  96. package/lib/function-configuration.js +0 -0
  97. package/lib/logger/common.js +21 -41
  98. package/lib/logger/compat.js +18 -33
  99. package/lib/logger/index.js +119 -130
  100. package/lib/params/index.d.ts +4 -2
  101. package/lib/params/index.js +150 -144
  102. package/lib/params/types.js +389 -423
  103. package/lib/runtime/loader.js +114 -148
  104. package/lib/runtime/manifest.js +106 -126
  105. package/lib/types/global.d.js +0 -0
  106. package/lib/v1/cloud-functions.d.ts +2 -2
  107. package/lib/v1/cloud-functions.js +193 -241
  108. package/lib/v1/config.d.ts +4 -7
  109. package/lib/v1/config.js +13 -75
  110. package/lib/v1/function-builder.js +239 -368
  111. package/lib/v1/function-configuration.js +70 -63
  112. package/lib/v1/index.js +118 -73
  113. package/lib/v1/providers/analytics.js +188 -235
  114. package/lib/v1/providers/auth.d.ts +2 -1
  115. package/lib/v1/providers/auth.js +159 -164
  116. package/lib/v1/providers/database.js +237 -242
  117. package/lib/v1/providers/firestore.js +131 -130
  118. package/lib/v1/providers/https.d.ts +2 -1
  119. package/lib/v1/providers/https.js +79 -86
  120. package/lib/v1/providers/pubsub.js +175 -172
  121. package/lib/v1/providers/remoteConfig.js +64 -68
  122. package/lib/v1/providers/storage.js +161 -163
  123. package/lib/v1/providers/tasks.d.ts +1 -1
  124. package/lib/v1/providers/tasks.js +65 -80
  125. package/lib/v1/providers/testLab.js +94 -94
  126. package/lib/v2/core.d.ts +1 -1
  127. package/lib/v2/core.js +5 -32
  128. package/lib/v2/index.d.ts +6 -3
  129. package/lib/v2/index.js +123 -75
  130. package/lib/v2/options.js +88 -114
  131. package/lib/v2/providers/alerts/alerts.js +76 -95
  132. package/lib/v2/providers/alerts/appDistribution.js +73 -78
  133. package/lib/v2/providers/alerts/billing.js +49 -53
  134. package/lib/v2/providers/alerts/crashlytics.js +110 -102
  135. package/lib/v2/providers/alerts/index.js +56 -53
  136. package/lib/v2/providers/alerts/performance.js +64 -74
  137. package/lib/v2/providers/database.js +177 -180
  138. package/lib/v2/providers/dataconnect.d.ts +95 -0
  139. package/lib/v2/providers/dataconnect.js +137 -0
  140. package/lib/v2/providers/eventarc.js +55 -77
  141. package/lib/v2/providers/firestore.js +262 -260
  142. package/lib/v2/providers/https.d.ts +3 -2
  143. package/lib/v2/providers/https.js +210 -247
  144. package/lib/v2/providers/identity.d.ts +2 -1
  145. package/lib/v2/providers/identity.js +96 -105
  146. package/lib/v2/providers/pubsub.js +149 -167
  147. package/lib/v2/providers/remoteConfig.js +54 -63
  148. package/lib/v2/providers/scheduler.js +84 -96
  149. package/lib/v2/providers/storage.js +147 -162
  150. package/lib/v2/providers/tasks.d.ts +1 -1
  151. package/lib/v2/providers/tasks.js +68 -95
  152. package/lib/v2/providers/testLab.js +55 -64
  153. package/lib/v2/trace.js +18 -19
  154. package/package.json +290 -226
  155. package/protos/compiledFirestore.mjs +3512 -0
  156. package/protos/update.sh +28 -7
@@ -1,186 +1,189 @@
1
- "use strict";
2
- // The MIT License (MIT)
3
- //
4
- // Copyright (c) 2017 Firebase
5
- //
6
- // Permission is hereby granted, free of charge, to any person obtaining a copy
7
- // of this software and associated documentation files (the "Software"), to deal
8
- // in the Software without restriction, including without limitation the rights
9
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- // copies of the Software, and to permit persons to whom the Software is
11
- // furnished to do so, subject to the following conditions:
12
- //
13
- // The above copyright notice and this permission notice shall be included in all
14
- // copies or substantial portions of the Software.
15
- //
16
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- // SOFTWARE.
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.Message = exports.ScheduleBuilder = exports._scheduleWithOptions = exports.schedule = exports.TopicBuilder = exports._topicWithOptions = exports.topic = exports.service = exports.provider = void 0;
25
- const cloud_functions_1 = require("../cloud-functions");
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.js');
2
+ const require_v1_cloud_functions = require('../cloud-functions.js');
3
+
4
+ //#region src/v1/providers/pubsub.ts
5
+ var pubsub_exports = /* @__PURE__ */ require_rolldown_runtime.__export({
6
+ Message: () => Message,
7
+ ScheduleBuilder: () => ScheduleBuilder,
8
+ TopicBuilder: () => TopicBuilder,
9
+ _scheduleWithOptions: () => _scheduleWithOptions,
10
+ _topicWithOptions: () => _topicWithOptions,
11
+ provider: () => provider,
12
+ schedule: () => schedule,
13
+ service: () => service,
14
+ topic: () => topic
15
+ });
26
16
  /** @internal */
27
- exports.provider = "google.pubsub";
17
+ const provider = "google.pubsub";
28
18
  /** @internal */
29
- exports.service = "pubsub.googleapis.com";
19
+ const service = "pubsub.googleapis.com";
30
20
  /**
31
- * Registers a Cloud Function triggered when a Google Cloud Pub/Sub message
32
- * is sent to a specified topic.
33
- *
34
- * @param topic - The Pub/Sub topic to watch for message events.
35
- * @returns Pub/Sub topic builder interface.
36
- */
37
- function topic(topic) {
38
- return _topicWithOptions(topic, {});
21
+ * Registers a Cloud Function triggered when a Google Cloud Pub/Sub message
22
+ * is sent to a specified topic.
23
+ *
24
+ * @param topic - The Pub/Sub topic to watch for message events.
25
+ * @returns Pub/Sub topic builder interface.
26
+ */
27
+ function topic(topic$1) {
28
+ return _topicWithOptions(topic$1, {});
39
29
  }
40
- exports.topic = topic;
41
30
  /** @internal */
42
- function _topicWithOptions(topic, options) {
43
- if (topic.indexOf("/") !== -1) {
44
- throw new Error("Topic name may not have a /");
45
- }
46
- return new TopicBuilder(() => {
47
- if (!process.env.GCLOUD_PROJECT) {
48
- throw new Error("process.env.GCLOUD_PROJECT is not set.");
49
- }
50
- return `projects/${process.env.GCLOUD_PROJECT}/topics/${topic}`;
51
- }, options);
31
+ function _topicWithOptions(topic$1, options) {
32
+ if (topic$1.indexOf("/") !== -1) {
33
+ throw new Error("Topic name may not have a /");
34
+ }
35
+ return new TopicBuilder(() => {
36
+ if (!process.env.GCLOUD_PROJECT) {
37
+ throw new Error("process.env.GCLOUD_PROJECT is not set.");
38
+ }
39
+ return `projects/${process.env.GCLOUD_PROJECT}/topics/${topic$1}`;
40
+ }, options);
52
41
  }
53
- exports._topicWithOptions = _topicWithOptions;
54
42
  /**
55
- * The Google Cloud Pub/Sub topic builder.
56
- *
57
- * Access via `functions.pubsub.topic()`.
58
- */
59
- class TopicBuilder {
60
- /** @hidden */
61
- constructor(triggerResource, options) {
62
- this.triggerResource = triggerResource;
63
- this.options = options;
64
- }
65
- /**
66
- * Event handler that fires every time a Cloud Pub/Sub message is
67
- * published.
68
- *
69
- * @param handler - Event handler that runs every time a Cloud Pub/Sub message
70
- * is published.
71
- * @returns A function that you can export and deploy.
72
- */
73
- onPublish(handler) {
74
- return (0, cloud_functions_1.makeCloudFunction)({
75
- handler,
76
- provider: exports.provider,
77
- service: exports.service,
78
- triggerResource: this.triggerResource,
79
- eventType: "topic.publish",
80
- dataConstructor: (raw) => new Message(raw.data),
81
- options: this.options,
82
- });
83
- }
84
- }
85
- exports.TopicBuilder = TopicBuilder;
43
+ * The Google Cloud Pub/Sub topic builder.
44
+ *
45
+ * Access via `functions.pubsub.topic()`.
46
+ */
47
+ var TopicBuilder = class {
48
+ /** @hidden */
49
+ constructor(triggerResource, options) {
50
+ this.triggerResource = triggerResource;
51
+ this.options = options;
52
+ }
53
+ /**
54
+ * Event handler that fires every time a Cloud Pub/Sub message is
55
+ * published.
56
+ *
57
+ * @param handler - Event handler that runs every time a Cloud Pub/Sub message
58
+ * is published.
59
+ * @returns A function that you can export and deploy.
60
+ */
61
+ onPublish(handler) {
62
+ return require_v1_cloud_functions.makeCloudFunction({
63
+ handler,
64
+ provider,
65
+ service,
66
+ triggerResource: this.triggerResource,
67
+ eventType: "topic.publish",
68
+ dataConstructor: (raw) => new Message(raw.data),
69
+ options: this.options
70
+ });
71
+ }
72
+ };
86
73
  /**
87
- * Registers a Cloud Function to run at specified times.
88
- *
89
- * @param schedule - The schedule, in Unix Crontab or AppEngine syntax.
90
- * @returns ScheduleBuilder interface.
91
- */
92
- function schedule(schedule) {
93
- return _scheduleWithOptions(schedule, {});
74
+ * Registers a Cloud Function to run at specified times.
75
+ *
76
+ * @param schedule - The schedule, in Unix Crontab or AppEngine syntax.
77
+ * @returns ScheduleBuilder interface.
78
+ */
79
+ function schedule(schedule$1) {
80
+ return _scheduleWithOptions(schedule$1, {});
94
81
  }
95
- exports.schedule = schedule;
96
82
  /** @internal */
97
- function _scheduleWithOptions(schedule, options) {
98
- const triggerResource = () => {
99
- if (!process.env.GCLOUD_PROJECT) {
100
- throw new Error("process.env.GCLOUD_PROJECT is not set.");
101
- }
102
- // The CLI will append the correct topic name based on region and function name
103
- return `projects/${process.env.GCLOUD_PROJECT}/topics`;
104
- };
105
- return new ScheduleBuilder(triggerResource, {
106
- ...options,
107
- schedule: { schedule },
108
- });
83
+ function _scheduleWithOptions(schedule$1, options) {
84
+ const triggerResource = () => {
85
+ if (!process.env.GCLOUD_PROJECT) {
86
+ throw new Error("process.env.GCLOUD_PROJECT is not set.");
87
+ }
88
+ return `projects/${process.env.GCLOUD_PROJECT}/topics`;
89
+ };
90
+ return new ScheduleBuilder(triggerResource, {
91
+ ...options,
92
+ schedule: { schedule: schedule$1 }
93
+ });
109
94
  }
110
- exports._scheduleWithOptions = _scheduleWithOptions;
111
95
  /**
112
- * The builder for scheduled functions, which are powered by
113
- * Google Pub/Sub and Cloud Scheduler. Describes the Cloud Scheduler
114
- * job that is deployed to trigger a scheduled function at the provided
115
- * frequency. For more information, see
116
- * [Schedule functions](/docs/functions/schedule-functions).
117
- *
118
- * Access via `functions.pubsub.schedule()`.
119
- */
120
- class ScheduleBuilder {
121
- /** @hidden */
122
- constructor(triggerResource, options) {
123
- this.triggerResource = triggerResource;
124
- this.options = options;
125
- }
126
- retryConfig(config) {
127
- this.options.schedule.retryConfig = config;
128
- return this;
129
- }
130
- timeZone(timeZone) {
131
- this.options.schedule.timeZone = timeZone;
132
- return this;
133
- }
134
- /**
135
- * Event handler for scheduled functions. Triggered whenever the associated
136
- * scheduler job sends a Pub/Sub message.
137
- *
138
- * @param handler - Handler that fires whenever the associated
139
- * scheduler job sends a Pub/Sub message.
140
- * @returns A function that you can export and deploy.
141
- */
142
- onRun(handler) {
143
- const cloudFunction = (0, cloud_functions_1.makeCloudFunction)({
144
- contextOnlyHandler: handler,
145
- provider: exports.provider,
146
- service: exports.service,
147
- triggerResource: this.triggerResource,
148
- eventType: "topic.publish",
149
- options: this.options,
150
- labels: { "deployment-scheduled": "true" },
151
- });
152
- return cloudFunction;
153
- }
154
- }
155
- exports.ScheduleBuilder = ScheduleBuilder;
96
+ * The builder for scheduled functions, which are powered by
97
+ * Google Pub/Sub and Cloud Scheduler. Describes the Cloud Scheduler
98
+ * job that is deployed to trigger a scheduled function at the provided
99
+ * frequency. For more information, see
100
+ * [Schedule functions](/docs/functions/schedule-functions).
101
+ *
102
+ * Access via `functions.pubsub.schedule()`.
103
+ */
104
+ var ScheduleBuilder = class {
105
+ /** @hidden */
106
+ constructor(triggerResource, options) {
107
+ this.triggerResource = triggerResource;
108
+ this.options = options;
109
+ }
110
+ retryConfig(config) {
111
+ this.options.schedule.retryConfig = config;
112
+ return this;
113
+ }
114
+ timeZone(timeZone) {
115
+ this.options.schedule.timeZone = timeZone;
116
+ return this;
117
+ }
118
+ /**
119
+ * Event handler for scheduled functions. Triggered whenever the associated
120
+ * scheduler job sends a Pub/Sub message.
121
+ *
122
+ * @param handler - Handler that fires whenever the associated
123
+ * scheduler job sends a Pub/Sub message.
124
+ * @returns A function that you can export and deploy.
125
+ */
126
+ onRun(handler) {
127
+ const cloudFunction = require_v1_cloud_functions.makeCloudFunction({
128
+ contextOnlyHandler: handler,
129
+ provider,
130
+ service,
131
+ triggerResource: this.triggerResource,
132
+ eventType: "topic.publish",
133
+ options: this.options,
134
+ labels: { "deployment-scheduled": "true" }
135
+ });
136
+ return cloudFunction;
137
+ }
138
+ };
156
139
  /**
157
- * Interface representing a Google Cloud Pub/Sub message.
158
- *
159
- * @param data - Payload of a Pub/Sub message.
160
- */
161
- class Message {
162
- constructor(data) {
163
- [this.data, this.attributes, this._json] = [data.data, data.attributes || {}, data.json];
164
- }
165
- /**
166
- * The JSON data payload of this message object, if any.
167
- */
168
- get json() {
169
- if (typeof this._json === "undefined") {
170
- this._json = JSON.parse(Buffer.from(this.data, "base64").toString("utf8"));
171
- }
172
- return this._json;
173
- }
174
- /**
175
- * Returns a JSON-serializable representation of this object.
176
- *
177
- * @returns A JSON-serializable representation of this object.
178
- */
179
- toJSON() {
180
- return {
181
- data: this.data,
182
- attributes: this.attributes,
183
- };
184
- }
185
- }
140
+ * Interface representing a Google Cloud Pub/Sub message.
141
+ *
142
+ * @param data - Payload of a Pub/Sub message.
143
+ */
144
+ var Message = class {
145
+ constructor(data) {
146
+ [this.data, this.attributes, this._json] = [
147
+ data.data,
148
+ data.attributes || {},
149
+ data.json
150
+ ];
151
+ }
152
+ /**
153
+ * The JSON data payload of this message object, if any.
154
+ */
155
+ get json() {
156
+ if (typeof this._json === "undefined") {
157
+ this._json = JSON.parse(Buffer.from(this.data, "base64").toString("utf8"));
158
+ }
159
+ return this._json;
160
+ }
161
+ /**
162
+ * Returns a JSON-serializable representation of this object.
163
+ *
164
+ * @returns A JSON-serializable representation of this object.
165
+ */
166
+ toJSON() {
167
+ return {
168
+ data: this.data,
169
+ attributes: this.attributes
170
+ };
171
+ }
172
+ };
173
+
174
+ //#endregion
186
175
  exports.Message = Message;
176
+ exports.ScheduleBuilder = ScheduleBuilder;
177
+ exports.TopicBuilder = TopicBuilder;
178
+ exports._scheduleWithOptions = _scheduleWithOptions;
179
+ exports._topicWithOptions = _topicWithOptions;
180
+ exports.provider = provider;
181
+ Object.defineProperty(exports, 'pubsub_exports', {
182
+ enumerable: true,
183
+ get: function () {
184
+ return pubsub_exports;
185
+ }
186
+ });
187
+ exports.schedule = schedule;
188
+ exports.service = service;
189
+ exports.topic = topic;
@@ -1,78 +1,74 @@
1
- "use strict";
2
- // The MIT License (MIT)
3
- //
4
- // Copyright (c) 2018 Firebase
5
- //
6
- // Permission is hereby granted, free of charge, to any person obtaining a copy
7
- // of this software and associated documentation files (the 'Software'), to deal
8
- // in the Software without restriction, including without limitation the rights
9
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- // copies of the Software, and to permit persons to whom the Software is
11
- // furnished to do so, subject to the following conditions:
12
- //
13
- // The above copyright notice and this permission notice shall be included in
14
- // all copies or substantial portions of the Software.
15
- //
16
- // THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- // SOFTWARE.
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.UpdateBuilder = exports._onUpdateWithOptions = exports.onUpdate = exports.service = exports.provider = void 0;
25
- const cloud_functions_1 = require("../cloud-functions");
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.js');
2
+ const require_v1_cloud_functions = require('../cloud-functions.js');
3
+
4
+ //#region src/v1/providers/remoteConfig.ts
5
+ var remoteConfig_exports = /* @__PURE__ */ require_rolldown_runtime.__export({
6
+ UpdateBuilder: () => UpdateBuilder,
7
+ _onUpdateWithOptions: () => _onUpdateWithOptions,
8
+ onUpdate: () => onUpdate,
9
+ provider: () => provider,
10
+ service: () => service
11
+ });
26
12
  /** @internal */
27
- exports.provider = "google.firebase.remoteconfig";
13
+ const provider = "google.firebase.remoteconfig";
28
14
  /** @internal */
29
- exports.service = "firebaseremoteconfig.googleapis.com";
15
+ const service = "firebaseremoteconfig.googleapis.com";
30
16
  /**
31
- * Registers a function that triggers on Firebase Remote Config template
32
- * update events.
33
- *
34
- * @param handler A function that takes the updated Remote Config
35
- * template version metadata as an argument.
36
- *
37
- * @returns A function that you can export and deploy.
38
- */
17
+ * Registers a function that triggers on Firebase Remote Config template
18
+ * update events.
19
+ *
20
+ * @param handler A function that takes the updated Remote Config
21
+ * template version metadata as an argument.
22
+ *
23
+ * @returns A function that you can export and deploy.
24
+ */
39
25
  function onUpdate(handler) {
40
- return _onUpdateWithOptions(handler, {});
26
+ return _onUpdateWithOptions(handler, {});
41
27
  }
42
- exports.onUpdate = onUpdate;
43
28
  /** @internal */
44
29
  function _onUpdateWithOptions(handler, options) {
45
- const triggerResource = () => {
46
- if (!process.env.GCLOUD_PROJECT) {
47
- throw new Error("process.env.GCLOUD_PROJECT is not set.");
48
- }
49
- return `projects/${process.env.GCLOUD_PROJECT}`;
50
- };
51
- return new UpdateBuilder(triggerResource, options).onUpdate(handler);
30
+ const triggerResource = () => {
31
+ if (!process.env.GCLOUD_PROJECT) {
32
+ throw new Error("process.env.GCLOUD_PROJECT is not set.");
33
+ }
34
+ return `projects/${process.env.GCLOUD_PROJECT}`;
35
+ };
36
+ return new UpdateBuilder(triggerResource, options).onUpdate(handler);
52
37
  }
53
- exports._onUpdateWithOptions = _onUpdateWithOptions;
54
38
  /** Builder used to create Cloud Functions for Remote Config. */
55
- class UpdateBuilder {
56
- /** @internal */
57
- constructor(triggerResource, options) {
58
- this.triggerResource = triggerResource;
59
- this.options = options;
60
- }
61
- /**
62
- * Handle all updates (including rollbacks) that affect a Remote Config
63
- * project.
64
- * @param handler A function that takes the updated Remote Config template
65
- * version metadata as an argument.
66
- */
67
- onUpdate(handler) {
68
- return (0, cloud_functions_1.makeCloudFunction)({
69
- handler,
70
- provider: exports.provider,
71
- service: exports.service,
72
- triggerResource: this.triggerResource,
73
- eventType: "update",
74
- options: this.options,
75
- });
76
- }
77
- }
39
+ var UpdateBuilder = class {
40
+ /** @internal */
41
+ constructor(triggerResource, options) {
42
+ this.triggerResource = triggerResource;
43
+ this.options = options;
44
+ }
45
+ /**
46
+ * Handle all updates (including rollbacks) that affect a Remote Config
47
+ * project.
48
+ * @param handler A function that takes the updated Remote Config template
49
+ * version metadata as an argument.
50
+ */
51
+ onUpdate(handler) {
52
+ return require_v1_cloud_functions.makeCloudFunction({
53
+ handler,
54
+ provider,
55
+ service,
56
+ triggerResource: this.triggerResource,
57
+ eventType: "update",
58
+ options: this.options
59
+ });
60
+ }
61
+ };
62
+
63
+ //#endregion
78
64
  exports.UpdateBuilder = UpdateBuilder;
65
+ exports._onUpdateWithOptions = _onUpdateWithOptions;
66
+ exports.onUpdate = onUpdate;
67
+ exports.provider = provider;
68
+ Object.defineProperty(exports, 'remoteConfig_exports', {
69
+ enumerable: true,
70
+ get: function () {
71
+ return remoteConfig_exports;
72
+ }
73
+ });
74
+ exports.service = service;