firebase-functions 7.0.5 → 7.0.6

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.
@@ -1,9 +1,9 @@
1
1
  import { debug, error, warn } from "../../logger/index.mjs";
2
2
  import { getApp } from "../app.mjs";
3
3
  import { isDebugFeatureEnabled } from "../debug.mjs";
4
- import { getAuth } from "firebase-admin/auth";
5
4
  import cors from "cors";
6
5
  import { getAppCheck } from "firebase-admin/app-check";
6
+ import { getAuth } from "firebase-admin/auth";
7
7
 
8
8
  //#region src/common/providers/https.ts
9
9
  const JWT_REGEX = /^[a-zA-Z0-9\-_=]+?\.[a-zA-Z0-9\-_=]+?\.([a-zA-Z0-9\-_=]+)?$/;
@@ -5,9 +5,9 @@ import { firebaseConfig } from "../common/config.mjs";
5
5
  import { setApp } from "../common/app.mjs";
6
6
  import { Change } from "../common/change.mjs";
7
7
  import { onInit } from "../common/onInit.mjs";
8
+ import { config } from "./config.mjs";
8
9
  import { DEFAULT_FAILURE_POLICY, INGRESS_SETTINGS_OPTIONS, MAX_NUMBER_USER_LABELS, MAX_TIMEOUT_SECONDS, MIN_TIMEOUT_SECONDS, SUPPORTED_REGIONS, VALID_MEMORY_OPTIONS, VPC_EGRESS_SETTINGS_OPTIONS } from "./function-configuration.mjs";
9
10
  import { makeCloudFunction, optionsToEndpoint, optionsToTrigger } from "./cloud-functions.mjs";
10
- import { config } from "./config.mjs";
11
11
  import { analytics_exports } from "./providers/analytics.mjs";
12
12
  import { auth_exports } from "./providers/auth.mjs";
13
13
  import { database_exports } from "./providers/database.mjs";
@@ -1,8 +1,8 @@
1
1
  import { __export } from "../../_virtual/rolldown_runtime.mjs";
2
2
  import { initV1Endpoint } from "../../runtime/manifest.mjs";
3
- import { makeCloudFunction, optionsToEndpoint, optionsToTrigger } from "../cloud-functions.mjs";
4
3
  import { HttpsError } from "../../common/providers/https.mjs";
5
4
  import { UserRecordMetadata, userRecordConstructor, wrapHandler } from "../../common/providers/identity.mjs";
5
+ import { makeCloudFunction, optionsToEndpoint, optionsToTrigger } from "../cloud-functions.mjs";
6
6
 
7
7
  //#region src/v1/providers/auth.ts
8
8
  var auth_exports = /* @__PURE__ */ __export({
@@ -1,10 +1,10 @@
1
1
  import { __export } from "../../_virtual/rolldown_runtime.mjs";
2
2
  import { firebaseConfig } from "../../common/config.mjs";
3
3
  import { getApp } from "../../common/app.mjs";
4
- import { makeCloudFunction } from "../cloud-functions.mjs";
5
4
  import { normalizePath } from "../../common/utilities/path.mjs";
6
5
  import { DataSnapshot } from "../../common/providers/database.mjs";
7
6
  import { applyChange } from "../../common/utilities/utils.mjs";
7
+ import { makeCloudFunction } from "../cloud-functions.mjs";
8
8
 
9
9
  //#region src/v1/providers/database.ts
10
10
  var database_exports = /* @__PURE__ */ __export({
@@ -1,7 +1,7 @@
1
1
  import { __export } from "../../_virtual/rolldown_runtime.mjs";
2
2
  import { Change } from "../../common/change.mjs";
3
- import { makeCloudFunction } from "../cloud-functions.mjs";
4
3
  import { createBeforeSnapshotFromJson, createSnapshotFromJson } from "../../common/providers/firestore.mjs";
4
+ import { makeCloudFunction } from "../cloud-functions.mjs";
5
5
  import { posix } from "path";
6
6
 
7
7
  //#region src/v1/providers/firestore.ts
@@ -2,9 +2,9 @@ import { __export } from "../../_virtual/rolldown_runtime.mjs";
2
2
  import { initV1Endpoint } from "../../runtime/manifest.mjs";
3
3
  import { convertIfPresent, convertInvoker } from "../../common/encoding.mjs";
4
4
  import { withInit } from "../../common/onInit.mjs";
5
- import { optionsToEndpoint, optionsToTrigger } from "../cloud-functions.mjs";
6
- import { HttpsError, onCallHandler, withErrorHandler } from "../../common/providers/https.mjs";
7
5
  import { wrapTraceContext } from "../../v2/trace.mjs";
6
+ import { HttpsError, onCallHandler, withErrorHandler } from "../../common/providers/https.mjs";
7
+ import { optionsToEndpoint, optionsToTrigger } from "../cloud-functions.mjs";
8
8
 
9
9
  //#region src/v1/providers/https.ts
10
10
  var https_exports = /* @__PURE__ */ __export({
@@ -1,8 +1,8 @@
1
1
  import { __export } from "../../_virtual/rolldown_runtime.mjs";
2
2
  import { initTaskQueueTrigger, initV1Endpoint } from "../../runtime/manifest.mjs";
3
3
  import { convertIfPresent, convertInvoker, copyIfPresent } from "../../common/encoding.mjs";
4
- import { optionsToEndpoint, optionsToTrigger } from "../cloud-functions.mjs";
5
4
  import { onDispatchHandler } from "../../common/providers/tasks.mjs";
5
+ import { optionsToEndpoint, optionsToTrigger } from "../cloud-functions.mjs";
6
6
 
7
7
  //#region src/v1/providers/tasks.ts
8
8
  var tasks_exports = /* @__PURE__ */ __export({
@@ -4,7 +4,6 @@ import { params_exports } from "../params/index.mjs";
4
4
  import { setApp } from "../common/app.mjs";
5
5
  import { Change } from "../common/change.mjs";
6
6
  import { onInit } from "../common/onInit.mjs";
7
- import { config } from "../v1/config.mjs";
8
7
  import "./core.mjs";
9
8
  import { setGlobalOptions } from "./options.mjs";
10
9
  import { alerts_exports } from "./providers/alerts/index.mjs";
@@ -20,6 +19,7 @@ import { remoteConfig_exports } from "./providers/remoteConfig.mjs";
20
19
  import { testLab_exports } from "./providers/testLab.mjs";
21
20
  import { firestore_exports } from "./providers/firestore.mjs";
22
21
  import { dataconnect_exports } from "./providers/dataconnect/index.mjs";
22
+ import { config } from "../v1/config.mjs";
23
23
 
24
24
  //#region src/v2/index.ts
25
25
  const app = { setEmulatedAdminApp: setApp };
@@ -2,12 +2,12 @@ import { __export } from "../../_virtual/rolldown_runtime.mjs";
2
2
  import { initV2Endpoint } from "../../runtime/manifest.mjs";
3
3
  import { getApp } from "../../common/app.mjs";
4
4
  import { withInit } from "../../common/onInit.mjs";
5
- import { normalizePath } from "../../common/utilities/path.mjs";
6
- import { DataSnapshot } from "../../common/providers/database.mjs";
7
- import { applyChange } from "../../common/utilities/utils.mjs";
8
5
  import { wrapTraceContext } from "../trace.mjs";
9
6
  import { getGlobalOptions, optionsToEndpoint } from "../options.mjs";
7
+ import { normalizePath } from "../../common/utilities/path.mjs";
8
+ import { DataSnapshot } from "../../common/providers/database.mjs";
10
9
  import { PathPattern } from "../../common/utilities/path-pattern.mjs";
10
+ import { applyChange } from "../../common/utilities/utils.mjs";
11
11
 
12
12
  //#region src/v2/providers/database.ts
13
13
  var database_exports = /* @__PURE__ */ __export({
@@ -1,9 +1,9 @@
1
1
  import { initV2Endpoint } from "../../../runtime/manifest.mjs";
2
2
  import { convertIfPresent, convertInvoker } from "../../../common/encoding.mjs";
3
3
  import { withInit } from "../../../common/onInit.mjs";
4
- import { withErrorHandler } from "../../../common/providers/https.mjs";
5
4
  import { wrapTraceContext } from "../../trace.mjs";
6
5
  import { getGlobalOptions, optionsToEndpoint } from "../../options.mjs";
6
+ import { withErrorHandler } from "../../../common/providers/https.mjs";
7
7
  import express from "express";
8
8
  import fs from "fs";
9
9
  import { ApolloServer } from "@apollo/server";
@@ -11,6 +11,15 @@ import { expressMiddleware } from "@as-integrations/express4";
11
11
 
12
12
  //#region src/v2/providers/dataconnect/graphql.ts
13
13
  const FIREBASE_AUTH_HEADER = "X-Firebase-Auth-Token";
14
+ const PRELUDE_GQL = [
15
+ "scalar UUID",
16
+ "scalar Int64",
17
+ "scalar Any",
18
+ "scalar Void",
19
+ "scalar True",
20
+ "scalar Date",
21
+ "scalar Timestamp"
22
+ ].join("\n");
14
23
  /** @hidden */
15
24
  async function initGraphqlServer(opts) {
16
25
  if (!opts.schema && !opts.schemaFilePath || opts.schema && opts.schemaFilePath) {
@@ -19,6 +28,7 @@ async function initGraphqlServer(opts) {
19
28
  if (opts.schemaFilePath) {
20
29
  opts.schema = fs.readFileSync(opts.schemaFilePath, "utf-8");
21
30
  }
31
+ const schemaWithPrelude = PRELUDE_GQL + "\n" + opts.schema;
22
32
  if (!opts.resolvers.query && !opts.resolvers.mutation) {
23
33
  throw new Error("At least one query or mutation resolver must be provided.");
24
34
  }
@@ -33,7 +43,7 @@ async function initGraphqlServer(opts) {
33
43
  const serverPromise = (async () => {
34
44
  const app = express();
35
45
  const server = new ApolloServer({
36
- typeDefs: opts.schema,
46
+ typeDefs: schemaWithPrelude,
37
47
  resolvers: apolloResolvers
38
48
  });
39
49
  await server.start();
@@ -1,9 +1,9 @@
1
1
  import { __export } from "../../../_virtual/rolldown_runtime.mjs";
2
2
  import { initV2Endpoint } from "../../../runtime/manifest.mjs";
3
3
  import { withInit } from "../../../common/onInit.mjs";
4
- import { normalizePath } from "../../../common/utilities/path.mjs";
5
4
  import { wrapTraceContext } from "../../trace.mjs";
6
5
  import { getGlobalOptions, optionsToEndpoint } from "../../options.mjs";
6
+ import { normalizePath } from "../../../common/utilities/path.mjs";
7
7
  import { PathPattern } from "../../../common/utilities/path-pattern.mjs";
8
8
 
9
9
  //#region src/v2/providers/dataconnect/index.ts
@@ -3,12 +3,12 @@ import { error } from "../../logger/index.mjs";
3
3
  import { initV2Endpoint } from "../../runtime/manifest.mjs";
4
4
  import { Change } from "../../common/change.mjs";
5
5
  import { withInit } from "../../common/onInit.mjs";
6
- import { normalizePath } from "../../common/utilities/path.mjs";
7
- import { createBeforeSnapshotFromJson, createBeforeSnapshotFromProtobuf, createSnapshotFromJson, createSnapshotFromProtobuf } from "../../common/providers/firestore.mjs";
8
- import { wrapTraceContext } from "../trace.mjs";
9
6
  import "../core.mjs";
7
+ import { wrapTraceContext } from "../trace.mjs";
10
8
  import { getGlobalOptions, optionsToEndpoint } from "../options.mjs";
9
+ import { normalizePath } from "../../common/utilities/path.mjs";
11
10
  import { PathPattern } from "../../common/utilities/path-pattern.mjs";
11
+ import { createBeforeSnapshotFromJson, createBeforeSnapshotFromProtobuf, createSnapshotFromJson, createSnapshotFromProtobuf } from "../../common/providers/firestore.mjs";
12
12
 
13
13
  //#region src/v2/providers/firestore.ts
14
14
  var firestore_exports = /* @__PURE__ */ __export({
@@ -6,9 +6,9 @@ import { initV2Endpoint } from "../../runtime/manifest.mjs";
6
6
  import { isDebugFeatureEnabled } from "../../common/debug.mjs";
7
7
  import { convertIfPresent, convertInvoker, copyIfPresent } from "../../common/encoding.mjs";
8
8
  import { withInit } from "../../common/onInit.mjs";
9
- import { HttpsError, onCallHandler, withErrorHandler } from "../../common/providers/https.mjs";
10
9
  import { wrapTraceContext } from "../trace.mjs";
11
10
  import { getGlobalOptions, optionsToEndpoint, optionsToTriggerAnnotations } from "../options.mjs";
11
+ import { HttpsError, onCallHandler, withErrorHandler } from "../../common/providers/https.mjs";
12
12
  import cors from "cors";
13
13
 
14
14
  //#region src/v2/providers/https.ts
@@ -1,10 +1,10 @@
1
1
  import { __export } from "../../_virtual/rolldown_runtime.mjs";
2
2
  import { initV2Endpoint } from "../../runtime/manifest.mjs";
3
3
  import { withInit } from "../../common/onInit.mjs";
4
- import { HttpsError } from "../../common/providers/https.mjs";
5
- import { wrapHandler } from "../../common/providers/identity.mjs";
6
4
  import { wrapTraceContext } from "../trace.mjs";
7
5
  import { getGlobalOptions, optionsToEndpoint } from "../options.mjs";
6
+ import { HttpsError } from "../../common/providers/https.mjs";
7
+ import { wrapHandler } from "../../common/providers/identity.mjs";
8
8
 
9
9
  //#region src/v2/providers/identity.ts
10
10
  var identity_exports = /* @__PURE__ */ __export({
@@ -3,8 +3,8 @@ import { initTaskQueueTrigger, initV2Endpoint } from "../../runtime/manifest.mjs
3
3
  import { convertIfPresent, convertInvoker, copyIfPresent } from "../../common/encoding.mjs";
4
4
  import { withInit } from "../../common/onInit.mjs";
5
5
  import { wrapTraceContext } from "../trace.mjs";
6
- import { onDispatchHandler } from "../../common/providers/tasks.mjs";
7
6
  import { getGlobalOptions, optionsToEndpoint, optionsToTriggerAnnotations } from "../options.mjs";
7
+ import { onDispatchHandler } from "../../common/providers/tasks.mjs";
8
8
 
9
9
  //#region src/v2/providers/tasks.ts
10
10
  var tasks_exports = /* @__PURE__ */ __export({ onTaskDispatched: () => onTaskDispatched });
@@ -16,6 +16,15 @@ __as_integrations_express4 = require_rolldown_runtime.__toESM(__as_integrations_
16
16
 
17
17
  //#region src/v2/providers/dataconnect/graphql.ts
18
18
  const FIREBASE_AUTH_HEADER = "X-Firebase-Auth-Token";
19
+ const PRELUDE_GQL = [
20
+ "scalar UUID",
21
+ "scalar Int64",
22
+ "scalar Any",
23
+ "scalar Void",
24
+ "scalar True",
25
+ "scalar Date",
26
+ "scalar Timestamp"
27
+ ].join("\n");
19
28
  /** @hidden */
20
29
  async function initGraphqlServer(opts) {
21
30
  if (!opts.schema && !opts.schemaFilePath || opts.schema && opts.schemaFilePath) {
@@ -24,6 +33,7 @@ async function initGraphqlServer(opts) {
24
33
  if (opts.schemaFilePath) {
25
34
  opts.schema = fs.default.readFileSync(opts.schemaFilePath, "utf-8");
26
35
  }
36
+ const schemaWithPrelude = PRELUDE_GQL + "\n" + opts.schema;
27
37
  if (!opts.resolvers.query && !opts.resolvers.mutation) {
28
38
  throw new Error("At least one query or mutation resolver must be provided.");
29
39
  }
@@ -38,7 +48,7 @@ async function initGraphqlServer(opts) {
38
48
  const serverPromise = (async () => {
39
49
  const app = (0, express.default)();
40
50
  const server = new __apollo_server.ApolloServer({
41
- typeDefs: opts.schema,
51
+ typeDefs: schemaWithPrelude,
42
52
  resolvers: apolloResolvers
43
53
  });
44
54
  await server.start();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firebase-functions",
3
- "version": "7.0.5",
3
+ "version": "7.0.6",
4
4
  "description": "Firebase SDK for Cloud Functions",
5
5
  "keywords": [
6
6
  "firebase",