@cedarjs/graphql-server 8.0.0-canary.3684 → 8.0.0-canary.3687

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 +1 @@
1
- {"version":3,"file":"createGraphQLServer.d.ts","sourceRoot":"","sources":["../src/createGraphQLServer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAQ3D,OAAO,KAAK,EAAU,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAE9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAEjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AA0B/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAEzE;;;GAGG;AACH,KAAK,sBAAsB,GAAG;IAC5B,GAAG,EAAE,cAAc,CAAA;IACnB,KAAK,EAAE,YAAY,CAAA;CACpB,GAAG,mBAAmB,CAAA;AAEvB;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,kBAAkB,CAAC,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAA;IACvE,MAAM,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,mBAAmB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAA;CACxE;AAED,eAAO,MAAM,mBAAmB,GAAU,iVAwBvC,kBAAkB,KAAG,OAAO,CAAC,kBAAkB,CAmMjD,CAAA"}
1
+ {"version":3,"file":"createGraphQLServer.d.ts","sourceRoot":"","sources":["../src/createGraphQLServer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAQ3D,OAAO,KAAK,EAAU,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAE9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAEjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AA0B/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAGzE;;;GAGG;AACH,KAAK,sBAAsB,GAAG;IAC5B,GAAG,EAAE,cAAc,CAAA;IACnB,KAAK,EAAE,YAAY,CAAA;CACpB,GAAG,mBAAmB,CAAA;AAEvB;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,kBAAkB,CAAC,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAA;IACvE,MAAM,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,mBAAmB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAA;CACxE;AAED,eAAO,MAAM,mBAAmB,GAAU,iVAwBvC,kBAAkB,KAAG,OAAO,CAAC,kBAAkB,CAmMjD,CAAA"}
@@ -25,6 +25,7 @@ import {
25
25
  } from "./plugins/index.js";
26
26
  import { resolveServerAuthState } from "./serverAuthState.js";
27
27
  import { makeSubscriptions } from "./subscriptions/makeSubscriptions.js";
28
+ import { createYogaLogger } from "./yogaLogger.js";
28
29
  const createGraphQLServer = async ({
29
30
  healthCheckId = "yoga",
30
31
  loggerConfig,
@@ -150,7 +151,7 @@ const createGraphQLServer = async ({
150
151
  errorMessage: defaultError,
151
152
  isDev: isDevEnv
152
153
  },
153
- logging: logger,
154
+ logging: createYogaLogger(logger),
154
155
  healthCheckEndpoint: graphiQLEndpoint + "/health",
155
156
  graphqlEndpoint: graphiQLEndpoint,
156
157
  graphiql: configureGraphiQLPlayground({
@@ -1 +1 @@
1
- {"version":3,"file":"useCedarError.d.ts","sourceRoot":"","sources":["../../src/plugins/useCedarError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAO1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAEjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAEtD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,MAAM,KAAG,MAAM,CAAC,mBAAmB,CAsCxE,CAAA"}
1
+ {"version":3,"file":"useCedarError.d.ts","sourceRoot":"","sources":["../../src/plugins/useCedarError.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAI1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAEjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAEtD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,MAAM,KAAG,MAAM,CAAC,mBAAmB,CAsCxE,CAAA"}
@@ -1,7 +1,5 @@
1
- import {
2
- handleStreamOrSingleExecutionResult,
3
- createGraphQLError
4
- } from "graphql-yoga";
1
+ import { GraphQLError } from "graphql";
2
+ import { handleStreamOrSingleExecutionResult } from "graphql-yoga";
5
3
  import { CedarError } from "@cedarjs/api";
6
4
  const useCedarError = (logger) => {
7
5
  return {
@@ -17,7 +15,7 @@ const useCedarError = (logger) => {
17
15
  { custom: { name: error.originalError.name } },
18
16
  "Converting CedarError to GraphQLError"
19
17
  );
20
- return createGraphQLError(error.message, {
18
+ return new GraphQLError(error.message, {
21
19
  extensions: error.extensions
22
20
  });
23
21
  } else {
@@ -0,0 +1,8 @@
1
+ import { Logger as YogaLogger } from 'graphql-yoga';
2
+ import type { Logger } from '@cedarjs/api/logger';
3
+ /**
4
+ * Creates the Logger Yoga logs through. Every message goes to Cedar's logger,
5
+ * and the `trace` level leaves the filtering to that logger's own level.
6
+ */
7
+ export declare function createYogaLogger(logger: Logger): YogaLogger;
8
+ //# sourceMappingURL=yogaLogger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yogaLogger.d.ts","sourceRoot":"","sources":["../src/yogaLogger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,cAAc,CAAA;AAEnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAsDjD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAU3D"}
@@ -0,0 +1,39 @@
1
+ import { PinoLogWriter } from "@graphql-hive/logger/writers/pino";
2
+ import { Logger as YogaLogger } from "graphql-yoga";
3
+ const HIVE_LOG_LEVELS = /* @__PURE__ */ new Set(["trace", "debug", "info", "warn", "error"]);
4
+ function withHiveCompatibleLogLevel(create) {
5
+ const logLevel = process.env.LOG_LEVEL;
6
+ if (logLevel === void 0 || HIVE_LOG_LEVELS.has(logLevel)) {
7
+ return create();
8
+ }
9
+ delete process.env.LOG_LEVEL;
10
+ try {
11
+ return create();
12
+ } finally {
13
+ process.env.LOG_LEVEL = logLevel;
14
+ }
15
+ }
16
+ function wrapLogger(logger) {
17
+ return new Proxy(logger, {
18
+ get(target, property) {
19
+ if (property === "child") {
20
+ return (...args) => wrapLogger(withHiveCompatibleLogLevel(() => target.child(...args)));
21
+ }
22
+ const value = Reflect.get(target, property, target);
23
+ return typeof value === "function" ? value.bind(target) : value;
24
+ }
25
+ });
26
+ }
27
+ function createYogaLogger(logger) {
28
+ return wrapLogger(
29
+ withHiveCompatibleLogLevel(
30
+ () => new YogaLogger({
31
+ level: "trace",
32
+ writers: [new PinoLogWriter(logger)]
33
+ })
34
+ )
35
+ );
36
+ }
37
+ export {
38
+ createYogaLogger
39
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/graphql-server",
3
- "version": "8.0.0-canary.3684",
3
+ "version": "8.0.0-canary.3687",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cedarjs/cedar.git",
@@ -37,30 +37,31 @@
37
37
  "test:watch": "yarn test --watch"
38
38
  },
39
39
  "dependencies": {
40
- "@cedarjs/api": "8.0.0-canary.3684",
41
- "@cedarjs/context": "8.0.0-canary.3684",
42
- "@envelop/core": "5.6.1",
43
- "@envelop/disable-introspection": "6.0.0",
44
- "@envelop/filter-operation-type": "6.0.0",
45
- "@envelop/on-resolve": "4.1.1",
40
+ "@cedarjs/api": "8.0.0-canary.3687",
41
+ "@cedarjs/context": "8.0.0-canary.3687",
42
+ "@envelop/core": "6.0.1",
43
+ "@envelop/disable-introspection": "10.0.1",
44
+ "@envelop/filter-operation-type": "10.0.1",
45
+ "@envelop/on-resolve": "8.0.1",
46
46
  "@escape.tech/graphql-armor": "3.2.0",
47
- "@graphql-tools/merge": "9.2.8",
48
- "@graphql-tools/schema": "10.1.5",
49
- "@graphql-tools/utils": "12.1.0",
50
- "@graphql-yoga/plugin-persisted-operations": "3.24.6",
47
+ "@graphql-hive/logger": "1.1.1",
48
+ "@graphql-tools/merge": "10.0.9",
49
+ "@graphql-tools/schema": "11.0.9",
50
+ "@graphql-tools/utils": "13.2.2",
51
+ "@graphql-yoga/plugin-persisted-operations": "4.1.0",
51
52
  "@opentelemetry/api": "1.10.0",
52
53
  "cookie": "1.1.1",
53
54
  "graphql": "16.15.0",
54
55
  "graphql-scalars": "2.0.1",
55
56
  "graphql-tag": "2.12.7",
56
- "graphql-yoga": "5.24.6",
57
+ "graphql-yoga": "6.1.0",
57
58
  "lodash": "4.18.1",
58
59
  "uuid": "11.1.1"
59
60
  },
60
61
  "devDependencies": {
61
- "@cedarjs/framework-tools": "8.0.0-canary.3684",
62
- "@cedarjs/realtime": "8.0.0-canary.3684",
63
- "@envelop/types": "5.2.2",
62
+ "@cedarjs/framework-tools": "8.0.0-canary.3687",
63
+ "@cedarjs/realtime": "8.0.0-canary.3687",
64
+ "@envelop/types": "6.0.1",
64
65
  "@escape.tech/graphql-armor-types": "0.7.0",
65
66
  "@types/aws-lambda": "8.10.164",
66
67
  "@types/jsonwebtoken": "9.0.10",