@cedarjs/graphql-server 4.0.0-canary.13852 → 4.0.0-canary.13854

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,6 +1,6 @@
1
1
  import type { GraphQLYogaOptions } from './types.js';
2
- export declare const createGraphQLYoga: ({ healthCheckId, loggerConfig, context, getCurrentUser, onException, generateGraphiQLHeader, extraPlugins, authDecoder, cors, services, sdls, directives, armorConfig, allowedOperations, allowIntrospection, allowGraphiQL, defaultError, graphiQLEndpoint, schemaOptions, realtime, trustedDocuments, openTelemetryOptions, includeScalars, }: GraphQLYogaOptions) => {
2
+ export declare const createGraphQLYoga: ({ healthCheckId, loggerConfig, context, getCurrentUser, onException, generateGraphiQLHeader, extraPlugins, authDecoder, cors, services, sdls, directives, armorConfig, allowedOperations, allowIntrospection, allowGraphiQL, defaultError, graphiQLEndpoint, schemaOptions, realtime, trustedDocuments, openTelemetryOptions, includeScalars, }: GraphQLYogaOptions) => Promise<{
3
3
  yoga: ServerAdapter<TServerContext, import("graphql-yoga").YogaServer<TServerContext, TUserContext>>;
4
4
  logger: import("@cedarjs/api/logger").Logger;
5
- };
5
+ }>;
6
6
  //# sourceMappingURL=createGraphQLYoga.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createGraphQLYoga.d.ts","sourceRoot":"","sources":["../../src/createGraphQLYoga.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,kBAAkB,EAAuB,MAAM,YAAY,CAAA;AAEzE,eAAO,MAAM,iBAAiB,GAAI,iVAwB/B,kBAAkB;;;CAwKpB,CAAA"}
1
+ {"version":3,"file":"createGraphQLYoga.d.ts","sourceRoot":"","sources":["../../src/createGraphQLYoga.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,kBAAkB,EAAuB,MAAM,YAAY,CAAA;AAEzE,eAAO,MAAM,iBAAiB,GAAU,iVAwBrC,kBAAkB;;;EAgLpB,CAAA"}
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
  var createGraphQLYoga_exports = {};
20
30
  __export(createGraphQLYoga_exports, {
@@ -32,7 +42,7 @@ var import_introspection = require("./introspection.js");
32
42
  var import_makeMergedSchema = require("./makeMergedSchema.js");
33
43
  var import_plugins = require("./plugins/index.js");
34
44
  var import_makeSubscriptions = require("./subscriptions/makeSubscriptions.js");
35
- const createGraphQLYoga = ({
45
+ const createGraphQLYoga = async ({
36
46
  healthCheckId = "yoga",
37
47
  loggerConfig,
38
48
  context,
@@ -92,6 +102,10 @@ const createGraphQLYoga = ({
92
102
  }
93
103
  try {
94
104
  const plugins = [];
105
+ if (realtime) {
106
+ const { useCedarRealtime } = await import("@cedarjs/realtime");
107
+ plugins.push(useCedarRealtime(realtime));
108
+ }
95
109
  const { disableIntrospection } = (0, import_introspection.configureGraphQLIntrospection)({
96
110
  allowIntrospection
97
111
  });
@@ -11,5 +11,5 @@ import type { GraphQLHandlerOptions } from '../types.js';
11
11
  * export const handler = createGraphQLHandler({ schema, context, getCurrentUser })
12
12
  * ```
13
13
  */
14
- export declare const createGraphQLHandler: ({ healthCheckId, loggerConfig, context, getCurrentUser, onException, generateGraphiQLHeader, extraPlugins, authDecoder, cors, services, sdls, directives, armorConfig, allowedOperations, allowIntrospection, allowGraphiQL, defaultError, graphiQLEndpoint, schemaOptions, openTelemetryOptions, trustedDocuments, }: GraphQLHandlerOptions) => (event: APIGatewayProxyEvent, context: LambdaContext) => Promise<any>;
14
+ export declare const createGraphQLHandler: ({ healthCheckId, loggerConfig, context, getCurrentUser, onException, generateGraphiQLHeader, extraPlugins, authDecoder, cors, services, sdls, directives, armorConfig, allowedOperations, allowIntrospection, allowGraphiQL, defaultError, graphiQLEndpoint, schemaOptions, realtime, openTelemetryOptions, trustedDocuments, }: GraphQLHandlerOptions) => (event: APIGatewayProxyEvent, context: LambdaContext) => Promise<any>;
15
15
  //# sourceMappingURL=graphql.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../../src/functions/graphql.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAEpB,OAAO,IAAI,aAAa,EACzB,MAAM,YAAY,CAAA;AAQnB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AA4CxD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,GAAI,uTAsBlC,qBAAqB,MAyHpB,OAAO,oBAAoB,EAC3B,SAAS,aAAa,KACrB,OAAO,CAAC,GAAG,CAcf,CAAA"}
1
+ {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../../src/functions/graphql.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAEpB,OAAO,IAAI,aAAa,EACzB,MAAM,YAAY,CAAA;AAQnB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AA4CxD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,GAAI,iUAuBlC,qBAAqB,MA8HpB,OAAO,oBAAoB,EAC3B,SAAS,aAAa,KACrB,OAAO,CAAC,GAAG,CAcf,CAAA"}
@@ -83,10 +83,11 @@ const createGraphQLHandler = ({
83
83
  defaultError = "Something went wrong.",
84
84
  graphiQLEndpoint = "/graphql",
85
85
  schemaOptions,
86
+ realtime,
86
87
  openTelemetryOptions,
87
88
  trustedDocuments
88
89
  }) => {
89
- const { yoga, logger } = (0, import_createGraphQLYoga.createGraphQLYoga)({
90
+ const yogaAndLoggerPromise = (0, import_createGraphQLYoga.createGraphQLYoga)({
90
91
  healthCheckId,
91
92
  loggerConfig,
92
93
  context,
@@ -106,11 +107,13 @@ const createGraphQLHandler = ({
106
107
  defaultError,
107
108
  graphiQLEndpoint,
108
109
  schemaOptions,
110
+ realtime,
109
111
  openTelemetryOptions,
110
112
  trustedDocuments
111
113
  });
112
114
  const handlerFn = async (event, requestContext) => {
113
115
  requestContext.callbackWaitsForEmptyEventLoop = false;
116
+ const { yoga, logger } = await yogaAndLoggerPromise;
114
117
  let lambdaResponse;
115
118
  try {
116
119
  const [, rest = ""] = event.path.split(graphiQLEndpoint);
@@ -1,6 +1,6 @@
1
1
  import type { GraphQLYogaOptions } from './types.js';
2
- export declare const createGraphQLYoga: ({ healthCheckId, loggerConfig, context, getCurrentUser, onException, generateGraphiQLHeader, extraPlugins, authDecoder, cors, services, sdls, directives, armorConfig, allowedOperations, allowIntrospection, allowGraphiQL, defaultError, graphiQLEndpoint, schemaOptions, realtime, trustedDocuments, openTelemetryOptions, includeScalars, }: GraphQLYogaOptions) => {
2
+ export declare const createGraphQLYoga: ({ healthCheckId, loggerConfig, context, getCurrentUser, onException, generateGraphiQLHeader, extraPlugins, authDecoder, cors, services, sdls, directives, armorConfig, allowedOperations, allowIntrospection, allowGraphiQL, defaultError, graphiQLEndpoint, schemaOptions, realtime, trustedDocuments, openTelemetryOptions, includeScalars, }: GraphQLYogaOptions) => Promise<{
3
3
  yoga: ServerAdapter<TServerContext, import("graphql-yoga").YogaServer<TServerContext, TUserContext>>;
4
4
  logger: import("@cedarjs/api/logger").Logger;
5
- };
5
+ }>;
6
6
  //# sourceMappingURL=createGraphQLYoga.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createGraphQLYoga.d.ts","sourceRoot":"","sources":["../src/createGraphQLYoga.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,kBAAkB,EAAuB,MAAM,YAAY,CAAA;AAEzE,eAAO,MAAM,iBAAiB,GAAI,iVAwB/B,kBAAkB;;;CAwKpB,CAAA"}
1
+ {"version":3,"file":"createGraphQLYoga.d.ts","sourceRoot":"","sources":["../src/createGraphQLYoga.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,kBAAkB,EAAuB,MAAM,YAAY,CAAA;AAEzE,eAAO,MAAM,iBAAiB,GAAU,iVAwBrC,kBAAkB;;;EAgLpB,CAAA"}
@@ -19,7 +19,7 @@ import {
19
19
  useRedwoodTrustedDocuments
20
20
  } from "./plugins/index.js";
21
21
  import { makeSubscriptions } from "./subscriptions/makeSubscriptions.js";
22
- const createGraphQLYoga = ({
22
+ const createGraphQLYoga = async ({
23
23
  healthCheckId = "yoga",
24
24
  loggerConfig,
25
25
  context,
@@ -79,6 +79,10 @@ const createGraphQLYoga = ({
79
79
  }
80
80
  try {
81
81
  const plugins = [];
82
+ if (realtime) {
83
+ const { useCedarRealtime } = await import("@cedarjs/realtime");
84
+ plugins.push(useCedarRealtime(realtime));
85
+ }
82
86
  const { disableIntrospection } = configureGraphQLIntrospection({
83
87
  allowIntrospection
84
88
  });
@@ -11,5 +11,5 @@ import type { GraphQLHandlerOptions } from '../types.js';
11
11
  * export const handler = createGraphQLHandler({ schema, context, getCurrentUser })
12
12
  * ```
13
13
  */
14
- export declare const createGraphQLHandler: ({ healthCheckId, loggerConfig, context, getCurrentUser, onException, generateGraphiQLHeader, extraPlugins, authDecoder, cors, services, sdls, directives, armorConfig, allowedOperations, allowIntrospection, allowGraphiQL, defaultError, graphiQLEndpoint, schemaOptions, openTelemetryOptions, trustedDocuments, }: GraphQLHandlerOptions) => (event: APIGatewayProxyEvent, context: LambdaContext) => Promise<any>;
14
+ export declare const createGraphQLHandler: ({ healthCheckId, loggerConfig, context, getCurrentUser, onException, generateGraphiQLHeader, extraPlugins, authDecoder, cors, services, sdls, directives, armorConfig, allowedOperations, allowIntrospection, allowGraphiQL, defaultError, graphiQLEndpoint, schemaOptions, realtime, openTelemetryOptions, trustedDocuments, }: GraphQLHandlerOptions) => (event: APIGatewayProxyEvent, context: LambdaContext) => Promise<any>;
15
15
  //# sourceMappingURL=graphql.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../src/functions/graphql.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAEpB,OAAO,IAAI,aAAa,EACzB,MAAM,YAAY,CAAA;AAQnB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AA4CxD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,GAAI,uTAsBlC,qBAAqB,MAyHpB,OAAO,oBAAoB,EAC3B,SAAS,aAAa,KACrB,OAAO,CAAC,GAAG,CAcf,CAAA"}
1
+ {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../src/functions/graphql.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAEpB,OAAO,IAAI,aAAa,EACzB,MAAM,YAAY,CAAA;AAQnB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AA4CxD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,GAAI,iUAuBlC,qBAAqB,MA8HpB,OAAO,oBAAoB,EAC3B,SAAS,aAAa,KACrB,OAAO,CAAC,GAAG,CAcf,CAAA"}
@@ -50,10 +50,11 @@ const createGraphQLHandler = ({
50
50
  defaultError = "Something went wrong.",
51
51
  graphiQLEndpoint = "/graphql",
52
52
  schemaOptions,
53
+ realtime,
53
54
  openTelemetryOptions,
54
55
  trustedDocuments
55
56
  }) => {
56
- const { yoga, logger } = createGraphQLYoga({
57
+ const yogaAndLoggerPromise = createGraphQLYoga({
57
58
  healthCheckId,
58
59
  loggerConfig,
59
60
  context,
@@ -73,11 +74,13 @@ const createGraphQLHandler = ({
73
74
  defaultError,
74
75
  graphiQLEndpoint,
75
76
  schemaOptions,
77
+ realtime,
76
78
  openTelemetryOptions,
77
79
  trustedDocuments
78
80
  });
79
81
  const handlerFn = async (event, requestContext) => {
80
82
  requestContext.callbackWaitsForEmptyEventLoop = false;
83
+ const { yoga, logger } = await yogaAndLoggerPromise;
81
84
  let lambdaResponse;
82
85
  try {
83
86
  const [, rest = ""] = event.path.split(graphiQLEndpoint);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/graphql-server",
3
- "version": "4.0.0-canary.13852+7a35606dae",
3
+ "version": "4.0.0-canary.13854+9d523c78b1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cedarjs/cedar.git",
@@ -37,8 +37,8 @@
37
37
  "test:watch": "yarn test --watch"
38
38
  },
39
39
  "dependencies": {
40
- "@cedarjs/api": "4.0.0-canary.13852",
41
- "@cedarjs/context": "4.0.0-canary.13852",
40
+ "@cedarjs/api": "4.0.0-canary.13854",
41
+ "@cedarjs/context": "4.0.0-canary.13854",
42
42
  "@envelop/core": "5.5.1",
43
43
  "@envelop/depth-limit": "4.0.0",
44
44
  "@envelop/disable-introspection": "6.0.0",
@@ -61,9 +61,9 @@
61
61
  "devDependencies": {
62
62
  "@babel/cli": "7.28.6",
63
63
  "@babel/core": "^7.26.10",
64
- "@cedarjs/framework-tools": "4.0.0-canary.13852",
65
- "@cedarjs/project-config": "4.0.0-canary.13852",
66
- "@cedarjs/realtime": "4.0.0-canary.13852",
64
+ "@cedarjs/framework-tools": "4.0.0-canary.13854",
65
+ "@cedarjs/project-config": "4.0.0-canary.13854",
66
+ "@cedarjs/realtime": "4.0.0-canary.13854",
67
67
  "@envelop/types": "5.2.1",
68
68
  "@types/aws-lambda": "8.10.161",
69
69
  "@types/jsonwebtoken": "9.0.10",
@@ -83,5 +83,5 @@
83
83
  "publishConfig": {
84
84
  "access": "public"
85
85
  },
86
- "gitHead": "7a35606dae967f2df102fd0845c37505d70d24b1"
86
+ "gitHead": "9d523c78b135181dcbcecfdae8e4e1143335f36a"
87
87
  }