@cedarjs/graphql-server 5.0.6 → 5.0.7-next.219

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 (127) hide show
  1. package/dist/createGraphQLYoga.js +19 -19
  2. package/dist/directives/makeDirectives.d.ts +2 -2
  3. package/dist/directives/makeDirectives.d.ts.map +1 -1
  4. package/dist/index.d.ts +2 -2
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +2 -0
  7. package/dist/makeMergedSchema.d.ts +6 -6
  8. package/dist/makeMergedSchema.d.ts.map +1 -1
  9. package/dist/plugins/index.d.ts +8 -8
  10. package/dist/plugins/index.d.ts.map +1 -1
  11. package/dist/plugins/index.js +20 -16
  12. package/dist/plugins/{useRedwoodAuthContext.d.ts → useCedarAuthContext.d.ts} +2 -2
  13. package/dist/plugins/useCedarAuthContext.d.ts.map +1 -0
  14. package/dist/plugins/useCedarAuthContext.js +30 -0
  15. package/dist/{cjs/plugins/useRedwoodError.d.ts → plugins/useCedarError.d.ts} +4 -4
  16. package/dist/plugins/useCedarError.d.ts.map +1 -0
  17. package/dist/plugins/{useRedwoodError.js → useCedarError.js} +5 -5
  18. package/dist/plugins/{useRedwoodGlobalContextSetter.d.ts → useCedarGlobalContextSetter.d.ts} +2 -2
  19. package/dist/plugins/useCedarGlobalContextSetter.d.ts.map +1 -0
  20. package/dist/plugins/{useRedwoodGlobalContextSetter.js → useCedarGlobalContextSetter.js} +2 -2
  21. package/dist/plugins/{useRedwoodLogger.d.ts → useCedarLogger.d.ts} +2 -2
  22. package/dist/plugins/useCedarLogger.d.ts.map +1 -0
  23. package/dist/plugins/{useRedwoodLogger.js → useCedarLogger.js} +2 -2
  24. package/dist/{cjs/plugins/useRedwoodOpenTelemetry.d.ts → plugins/useCedarOpenTelemetry.d.ts} +3 -3
  25. package/dist/plugins/useCedarOpenTelemetry.d.ts.map +1 -0
  26. package/dist/plugins/{useRedwoodOpenTelemetry.js → useCedarOpenTelemetry.js} +3 -3
  27. package/dist/{cjs/plugins/useRedwoodPopulateContext.d.ts → plugins/useCedarPopulateContext.d.ts} +2 -2
  28. package/dist/plugins/useCedarPopulateContext.d.ts.map +1 -0
  29. package/dist/plugins/{useRedwoodPopulateContext.js → useCedarPopulateContext.js} +2 -2
  30. package/dist/{cjs/plugins/useRedwoodTrustedDocuments.d.ts → plugins/useCedarTrustedDocuments.d.ts} +5 -3
  31. package/dist/plugins/useCedarTrustedDocuments.d.ts.map +1 -0
  32. package/dist/plugins/{useRedwoodTrustedDocuments.js → useCedarTrustedDocuments.js} +2 -2
  33. package/dist/plugins/useRedwoodDirective.d.ts +9 -3
  34. package/dist/plugins/useRedwoodDirective.d.ts.map +1 -1
  35. package/dist/plugins/useRedwoodDirective.js +3 -1
  36. package/dist/subscriptions/makeSubscriptions.d.ts +3 -3
  37. package/dist/subscriptions/makeSubscriptions.d.ts.map +1 -1
  38. package/dist/types.d.ts +13 -9
  39. package/dist/types.d.ts.map +1 -1
  40. package/package.json +12 -20
  41. package/dist/cjs/cors.d.ts +0 -10
  42. package/dist/cjs/cors.d.ts.map +0 -1
  43. package/dist/cjs/cors.js +0 -70
  44. package/dist/cjs/createGraphQLYoga.d.ts +0 -6
  45. package/dist/cjs/createGraphQLYoga.d.ts.map +0 -1
  46. package/dist/cjs/createGraphQLYoga.js +0 -193
  47. package/dist/cjs/directives/makeDirectives.d.ts +0 -8
  48. package/dist/cjs/directives/makeDirectives.d.ts.map +0 -1
  49. package/dist/cjs/directives/makeDirectives.js +0 -89
  50. package/dist/cjs/errors.d.ts +0 -32
  51. package/dist/cjs/errors.d.ts.map +0 -1
  52. package/dist/cjs/errors.js +0 -101
  53. package/dist/cjs/functions/graphql.d.ts +0 -15
  54. package/dist/cjs/functions/graphql.d.ts.map +0 -1
  55. package/dist/cjs/functions/graphql.js +0 -201
  56. package/dist/cjs/functions/useRequireAuth.d.ts +0 -12
  57. package/dist/cjs/functions/useRequireAuth.d.ts.map +0 -1
  58. package/dist/cjs/functions/useRequireAuth.js +0 -70
  59. package/dist/cjs/global.api-auto-imports.d.ts +0 -7
  60. package/dist/cjs/global.api-auto-imports.d.ts.map +0 -1
  61. package/dist/cjs/global.api-auto-imports.js +0 -1
  62. package/dist/cjs/globalContext.d.ts +0 -25
  63. package/dist/cjs/globalContext.d.ts.map +0 -1
  64. package/dist/cjs/globalContext.js +0 -55
  65. package/dist/cjs/globalContextStore.d.ts +0 -9
  66. package/dist/cjs/globalContextStore.d.ts.map +0 -1
  67. package/dist/cjs/globalContextStore.js +0 -35
  68. package/dist/cjs/graphiql.d.ts +0 -8
  69. package/dist/cjs/graphiql.d.ts.map +0 -1
  70. package/dist/cjs/graphiql.js +0 -45
  71. package/dist/cjs/index.d.ts +0 -14
  72. package/dist/cjs/index.d.ts.map +0 -1
  73. package/dist/cjs/index.js +0 -75
  74. package/dist/cjs/introspection.d.ts +0 -7
  75. package/dist/cjs/introspection.d.ts.map +0 -1
  76. package/dist/cjs/introspection.js +0 -36
  77. package/dist/cjs/makeMergedSchema.d.ts +0 -17
  78. package/dist/cjs/makeMergedSchema.d.ts.map +0 -1
  79. package/dist/cjs/makeMergedSchema.js +0 -283
  80. package/dist/cjs/package.json +0 -1
  81. package/dist/cjs/plugins/index.d.ts +0 -10
  82. package/dist/cjs/plugins/index.d.ts.map +0 -1
  83. package/dist/cjs/plugins/index.js +0 -52
  84. package/dist/cjs/plugins/useArmor.d.ts +0 -4
  85. package/dist/cjs/plugins/useArmor.d.ts.map +0 -1
  86. package/dist/cjs/plugins/useArmor.js +0 -69
  87. package/dist/cjs/plugins/useRedwoodAuthContext.d.ts +0 -9
  88. package/dist/cjs/plugins/useRedwoodAuthContext.d.ts.map +0 -1
  89. package/dist/cjs/plugins/useRedwoodAuthContext.js +0 -74
  90. package/dist/cjs/plugins/useRedwoodDirective.d.ts +0 -83
  91. package/dist/cjs/plugins/useRedwoodDirective.d.ts.map +0 -1
  92. package/dist/cjs/plugins/useRedwoodDirective.js +0 -166
  93. package/dist/cjs/plugins/useRedwoodError.d.ts.map +0 -1
  94. package/dist/cjs/plugins/useRedwoodError.js +0 -62
  95. package/dist/cjs/plugins/useRedwoodGlobalContextSetter.d.ts +0 -9
  96. package/dist/cjs/plugins/useRedwoodGlobalContextSetter.d.ts.map +0 -1
  97. package/dist/cjs/plugins/useRedwoodGlobalContextSetter.js +0 -35
  98. package/dist/cjs/plugins/useRedwoodLogger.d.ts +0 -115
  99. package/dist/cjs/plugins/useRedwoodLogger.d.ts.map +0 -1
  100. package/dist/cjs/plugins/useRedwoodLogger.js +0 -156
  101. package/dist/cjs/plugins/useRedwoodOpenTelemetry.d.ts.map +0 -1
  102. package/dist/cjs/plugins/useRedwoodOpenTelemetry.js +0 -156
  103. package/dist/cjs/plugins/useRedwoodPopulateContext.d.ts.map +0 -1
  104. package/dist/cjs/plugins/useRedwoodPopulateContext.js +0 -35
  105. package/dist/cjs/plugins/useRedwoodTrustedDocuments.d.ts.map +0 -1
  106. package/dist/cjs/plugins/useRedwoodTrustedDocuments.js +0 -80
  107. package/dist/cjs/rootSchema.d.ts +0 -25
  108. package/dist/cjs/rootSchema.d.ts.map +0 -1
  109. package/dist/cjs/rootSchema.js +0 -108
  110. package/dist/cjs/subscriptions/makeSubscriptions.d.ts +0 -18
  111. package/dist/cjs/subscriptions/makeSubscriptions.d.ts.map +0 -1
  112. package/dist/cjs/subscriptions/makeSubscriptions.js +0 -40
  113. package/dist/cjs/types.d.ts +0 -231
  114. package/dist/cjs/types.d.ts.map +0 -1
  115. package/dist/cjs/types.js +0 -16
  116. package/dist/plugins/useRedwoodAuthContext.d.ts.map +0 -1
  117. package/dist/plugins/useRedwoodAuthContext.js +0 -50
  118. package/dist/plugins/useRedwoodError.d.ts +0 -20
  119. package/dist/plugins/useRedwoodError.d.ts.map +0 -1
  120. package/dist/plugins/useRedwoodGlobalContextSetter.d.ts.map +0 -1
  121. package/dist/plugins/useRedwoodLogger.d.ts.map +0 -1
  122. package/dist/plugins/useRedwoodOpenTelemetry.d.ts +0 -22
  123. package/dist/plugins/useRedwoodOpenTelemetry.d.ts.map +0 -1
  124. package/dist/plugins/useRedwoodPopulateContext.d.ts +0 -9
  125. package/dist/plugins/useRedwoodPopulateContext.d.ts.map +0 -1
  126. package/dist/plugins/useRedwoodTrustedDocuments.d.ts +0 -23
  127. package/dist/plugins/useRedwoodTrustedDocuments.d.ts.map +0 -1
package/dist/types.d.ts CHANGED
@@ -8,9 +8,9 @@ import type { AuthContextPayload, CorsConfig, Decoder } from '@cedarjs/api';
8
8
  import type { CedarRequestContext } from '@cedarjs/api/runtime';
9
9
  import type { CedarRealtimeOptions } from '@cedarjs/realtime';
10
10
  import type { DirectiveGlobImports } from './directives/makeDirectives.js';
11
- import type { useRedwoodDirectiveReturn, DirectivePluginOptions } from './plugins/useRedwoodDirective.js';
12
- import type { LoggerConfig } from './plugins/useRedwoodLogger.js';
13
- import type { RedwoodTrustedDocumentOptions } from './plugins/useRedwoodTrustedDocuments.js';
11
+ import type { LoggerConfig } from './plugins/useCedarLogger.js';
12
+ import type { CedarTrustedDocumentOptions, RedwoodTrustedDocumentOptions } from './plugins/useCedarTrustedDocuments.js';
13
+ import type { UseCedarDirectiveReturn, useRedwoodDirectiveReturn, DirectivePluginOptions } from './plugins/useRedwoodDirective.js';
14
14
  export type Resolver = (...args: unknown[]) => unknown;
15
15
  export type Services = {
16
16
  [funcName: string]: Resolver;
@@ -33,7 +33,7 @@ export interface MakeServicesInterface {
33
33
  }
34
34
  export type MakeServices = (args: MakeServicesInterface) => ServicesGlobImports;
35
35
  export type GraphQLTypeWithFields = GraphQLObjectType | GraphQLInterfaceType;
36
- export type { useRedwoodDirectiveReturn, DirectivePluginOptions };
36
+ export type { UseCedarDirectiveReturn, useRedwoodDirectiveReturn, DirectivePluginOptions, CedarTrustedDocumentOptions, RedwoodTrustedDocumentOptions, };
37
37
  export type GetCurrentUser = (decoded: AuthContextPayload[0], raw: AuthContextPayload[1], req?: AuthContextPayload[2]) => Promise<null | Record<string, unknown>>;
38
38
  export type GenerateGraphiQLHeader = () => string;
39
39
  export type Context = Record<string, unknown>;
@@ -65,7 +65,7 @@ export interface RedwoodGraphQLContext {
65
65
  currentUser?: ThenArg<ReturnType<GetCurrentUser>> | AuthContextPayload | null;
66
66
  [index: string]: unknown;
67
67
  }
68
- export interface RedwoodOpenTelemetryConfig {
68
+ export interface CedarOpenTelemetryConfig {
69
69
  /**
70
70
  * @description Enables the creation of a span for each resolver execution.
71
71
  */
@@ -79,9 +79,13 @@ export interface RedwoodOpenTelemetryConfig {
79
79
  */
80
80
  result: boolean;
81
81
  }
82
- export interface RedwoodScalarConfig {
82
+ /** @deprecated Please use CedarOpenTelemetryConfig */
83
+ export type RedwoodOpenTelemetryConfig = CedarOpenTelemetryConfig;
84
+ export interface CedarScalarConfig {
83
85
  File?: boolean;
84
86
  }
87
+ /** @deprecated Please use CedarScalarConfig */
88
+ export type RedwoodScalarConfig = CedarScalarConfig;
85
89
  /**
86
90
  * GraphQLYogaOptions
87
91
  */
@@ -208,18 +212,18 @@ export type GraphQLYogaOptions = {
208
212
  * @see https://benjie.dev/graphql/trusted-documents
209
213
  * @see https://the-guild.dev/graphql/yoga-server/docs/features/persisted-operations
210
214
  */
211
- trustedDocuments?: RedwoodTrustedDocumentOptions;
215
+ trustedDocuments?: CedarTrustedDocumentOptions;
212
216
  /**
213
217
  * @description Configure OpenTelemetry plugin behaviour
214
218
  */
215
- openTelemetryOptions?: RedwoodOpenTelemetryConfig;
219
+ openTelemetryOptions?: CedarOpenTelemetryConfig;
216
220
  /**
217
221
  * @description Configure which scalars to include in the schema. This should match your
218
222
  * `graphql.includeScalars` configuration in `cedar.toml`.
219
223
  *
220
224
  * The default is to include. You must set to `false` to exclude.
221
225
  */
222
- includeScalars?: RedwoodScalarConfig;
226
+ includeScalars?: CedarScalarConfig;
223
227
  };
224
228
  /**
225
229
  * @description Configure GraphQLHandler with options
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":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AAwB,CAC3C,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/graphql-server",
3
- "version": "5.0.6",
3
+ "version": "5.0.7-next.219",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cedarjs/cedar.git",
@@ -10,13 +10,9 @@
10
10
  "type": "module",
11
11
  "exports": {
12
12
  ".": {
13
- "import": {
13
+ "default": {
14
14
  "types": "./dist/index.d.ts",
15
15
  "default": "./dist/index.js"
16
- },
17
- "require": {
18
- "types": "./dist/cjs/index.d.ts",
19
- "default": "./dist/cjs/index.js"
20
16
  }
21
17
  }
22
18
  },
@@ -28,7 +24,6 @@
28
24
  "build": "node ./build.mts",
29
25
  "build:pack": "yarn pack -o cedarjs-graphql-server.tgz",
30
26
  "build:types": "tsc --build --verbose ./tsconfig.build.json",
31
- "build:types-cjs": "tsc --build --verbose ./tsconfig.cjs.json",
32
27
  "build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx\" --ignore dist --exec \"yarn build\"",
33
28
  "check:attw": "yarn cedar-fwtools-attw",
34
29
  "check:package": "concurrently npm:check:attw yarn:publint",
@@ -37,16 +32,15 @@
37
32
  "test:watch": "yarn test --watch"
38
33
  },
39
34
  "dependencies": {
40
- "@cedarjs/api": "5.0.6",
41
- "@cedarjs/context": "5.0.6",
35
+ "@cedarjs/api": "5.0.7-next.219",
36
+ "@cedarjs/context": "5.0.7-next.219",
42
37
  "@envelop/core": "5.5.1",
43
- "@envelop/depth-limit": "4.0.0",
44
38
  "@envelop/disable-introspection": "6.0.0",
45
39
  "@envelop/filter-operation-type": "6.0.0",
46
40
  "@envelop/on-resolve": "4.1.1",
47
41
  "@escape.tech/graphql-armor": "3.0.1",
48
- "@graphql-tools/merge": "9.1.9",
49
- "@graphql-tools/schema": "10.0.33",
42
+ "@graphql-tools/merge": "9.2.2",
43
+ "@graphql-tools/schema": "10.0.38",
50
44
  "@graphql-tools/utils": "10.11.0",
51
45
  "@graphql-yoga/plugin-persisted-operations": "3.21.2",
52
46
  "@opentelemetry/api": "1.9.1",
@@ -59,22 +53,20 @@
59
53
  "uuid": "11.1.0"
60
54
  },
61
55
  "devDependencies": {
62
- "@babel/cli": "7.29.7",
63
- "@babel/core": "^7.26.10",
64
- "@cedarjs/framework-tools": "5.0.6",
65
- "@cedarjs/project-config": "5.0.6",
66
- "@cedarjs/realtime": "5.0.6",
56
+ "@cedarjs/framework-tools": "5.0.7-next.219",
57
+ "@cedarjs/realtime": "5.0.7-next.219",
67
58
  "@envelop/types": "5.2.1",
59
+ "@escape.tech/graphql-armor-types": "0.6.0",
68
60
  "@types/aws-lambda": "8.10.162",
69
61
  "@types/jsonwebtoken": "9.0.10",
70
62
  "@types/lodash": "4.17.24",
71
- "@whatwg-node/fetch": "0.10.13",
72
63
  "@whatwg-node/promise-helpers": "^1.3.0",
73
64
  "concurrently": "9.2.4",
65
+ "fastify": "5.10.0",
74
66
  "jsonwebtoken": "9.0.3",
75
- "publint": "0.3.21",
67
+ "publint": "0.3.22",
76
68
  "typescript": "5.9.3",
77
- "vitest": "3.2.6"
69
+ "vitest": "4.1.10"
78
70
  },
79
71
  "engines": {
80
72
  "node": ">=24"
@@ -1,10 +0,0 @@
1
- import type { CorsConfig } from '@cedarjs/api';
2
- export declare const mapRwCorsOptionsToYoga: (rwCorsConfig?: CorsConfig, requestOrigin?: string | null) => false | {
3
- origin?: string[] | string;
4
- methods?: string[];
5
- allowedHeaders?: string[];
6
- exposedHeaders?: string[];
7
- credentials?: boolean;
8
- maxAge?: number;
9
- };
10
- //# sourceMappingURL=cors.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cors.d.ts","sourceRoot":"","sources":["../../src/cors.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAE9C,eAAO,MAAM,sBAAsB,GACjC,eAAe,UAAU,EACzB,gBAAgB,MAAM,GAAG,IAAI;;;;;;;CAoD9B,CAAA"}
package/dist/cjs/cors.js DELETED
@@ -1,70 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var cors_exports = {};
20
- __export(cors_exports, {
21
- mapRwCorsOptionsToYoga: () => mapRwCorsOptionsToYoga
22
- });
23
- module.exports = __toCommonJS(cors_exports);
24
- const mapRwCorsOptionsToYoga = (rwCorsConfig, requestOrigin) => {
25
- const yogaCORSOptions = {};
26
- if (!rwCorsConfig) {
27
- return false;
28
- }
29
- if (rwCorsConfig?.methods) {
30
- if (typeof rwCorsConfig.methods === "string") {
31
- yogaCORSOptions.methods = [rwCorsConfig.methods];
32
- } else if (Array.isArray(rwCorsConfig.methods)) {
33
- yogaCORSOptions.methods = rwCorsConfig.methods;
34
- }
35
- }
36
- if (rwCorsConfig?.allowedHeaders) {
37
- if (typeof rwCorsConfig.allowedHeaders === "string") {
38
- yogaCORSOptions.allowedHeaders = [rwCorsConfig.allowedHeaders];
39
- } else if (Array.isArray(rwCorsConfig.allowedHeaders)) {
40
- yogaCORSOptions.allowedHeaders = rwCorsConfig.allowedHeaders;
41
- }
42
- }
43
- if (rwCorsConfig?.exposedHeaders) {
44
- if (typeof rwCorsConfig.exposedHeaders === "string") {
45
- yogaCORSOptions.exposedHeaders = [rwCorsConfig.exposedHeaders];
46
- } else if (Array.isArray(rwCorsConfig.exposedHeaders)) {
47
- yogaCORSOptions.exposedHeaders = rwCorsConfig.exposedHeaders;
48
- }
49
- }
50
- if (rwCorsConfig?.credentials) {
51
- yogaCORSOptions.credentials = rwCorsConfig.credentials;
52
- }
53
- if (rwCorsConfig?.maxAge) {
54
- yogaCORSOptions.maxAge = rwCorsConfig.maxAge;
55
- }
56
- if (rwCorsConfig?.origin) {
57
- if (typeof rwCorsConfig.origin === "string") {
58
- yogaCORSOptions.origin = [rwCorsConfig.origin];
59
- } else if (rwCorsConfig.origin === true) {
60
- yogaCORSOptions.origin = [requestOrigin || "*"];
61
- } else {
62
- yogaCORSOptions.origin = rwCorsConfig.origin;
63
- }
64
- }
65
- return yogaCORSOptions;
66
- };
67
- // Annotate the CommonJS export names for ESM import in node:
68
- 0 && (module.exports = {
69
- mapRwCorsOptionsToYoga
70
- });
@@ -1,6 +0,0 @@
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) => Promise<{
3
- yoga: ServerAdapter<TServerContext, import("graphql-yoga").YogaServer<TServerContext, TUserContext>>;
4
- logger: import("@cedarjs/api/logger").Logger;
5
- }>;
6
- //# sourceMappingURL=createGraphQLYoga.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createGraphQLYoga.d.ts","sourceRoot":"","sources":["../../src/createGraphQLYoga.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,kBAAkB,EAAuB,MAAM,YAAY,CAAA;AAEzE,eAAO,MAAM,iBAAiB,GAAU,iVAwBrC,kBAAkB;;;EAuLpB,CAAA"}
@@ -1,193 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
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
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var createGraphQLYoga_exports = {};
30
- __export(createGraphQLYoga_exports, {
31
- createGraphQLYoga: () => createGraphQLYoga
32
- });
33
- module.exports = __toCommonJS(createGraphQLYoga_exports);
34
- var import_disable_introspection = require("@envelop/disable-introspection");
35
- var import_filter_operation_type = require("@envelop/filter-operation-type");
36
- var import_graphql = require("graphql");
37
- var import_graphql_yoga = require("graphql-yoga");
38
- var import_cors = require("./cors.js");
39
- var import_makeDirectives = require("./directives/makeDirectives.js");
40
- var import_graphiql = require("./graphiql.js");
41
- var import_introspection = require("./introspection.js");
42
- var import_makeMergedSchema = require("./makeMergedSchema.js");
43
- var import_plugins = require("./plugins/index.js");
44
- var import_makeSubscriptions = require("./subscriptions/makeSubscriptions.js");
45
- const createGraphQLYoga = async ({
46
- healthCheckId = "yoga",
47
- loggerConfig,
48
- context,
49
- getCurrentUser,
50
- onException,
51
- generateGraphiQLHeader,
52
- extraPlugins,
53
- authDecoder,
54
- cors,
55
- services,
56
- sdls,
57
- directives = [],
58
- armorConfig,
59
- allowedOperations,
60
- allowIntrospection,
61
- allowGraphiQL,
62
- defaultError = "Something went wrong.",
63
- graphiQLEndpoint = "/graphql",
64
- schemaOptions,
65
- realtime,
66
- trustedDocuments,
67
- openTelemetryOptions,
68
- includeScalars
69
- }) => {
70
- let schema;
71
- let redwoodDirectivePlugins = [];
72
- const logger = loggerConfig.logger;
73
- const isDevEnv = process.env.NODE_ENV === "development";
74
- try {
75
- const projectDirectives = (0, import_makeDirectives.makeDirectivesForPlugin)(directives);
76
- if (projectDirectives.length > 0) {
77
- ;
78
- redwoodDirectivePlugins = projectDirectives.map(
79
- (directive) => (0, import_plugins.useRedwoodDirective)(directive)
80
- );
81
- }
82
- let projectSubscriptions = [];
83
- if (realtime?.subscriptions?.subscriptions) {
84
- projectSubscriptions = (0, import_makeSubscriptions.makeSubscriptions)(
85
- realtime.subscriptions.subscriptions
86
- );
87
- }
88
- schema = (0, import_makeMergedSchema.makeMergedSchema)({
89
- sdls,
90
- services,
91
- directives: projectDirectives,
92
- subscriptions: projectSubscriptions,
93
- schemaOptions,
94
- includeScalars
95
- });
96
- } catch (e) {
97
- logger.fatal(e, "\n \u26A0\uFE0F GraphQL server crashed \n");
98
- if (onException) {
99
- onException();
100
- }
101
- process.exit(1);
102
- }
103
- try {
104
- const plugins = [];
105
- if (realtime) {
106
- const { useCedarRealtime } = await import("@cedarjs/realtime");
107
- plugins.push(useCedarRealtime(realtime));
108
- }
109
- plugins.push((0, import_graphql_yoga.useExecutionCancellation)());
110
- const { disableIntrospection } = (0, import_introspection.configureGraphQLIntrospection)({
111
- allowIntrospection
112
- });
113
- if (disableIntrospection) {
114
- plugins.push((0, import_disable_introspection.useDisableIntrospection)());
115
- }
116
- plugins.push((0, import_plugins.useRedwoodAuthContext)(getCurrentUser, authDecoder));
117
- plugins.push((0, import_plugins.useRedwoodGlobalContextSetter)());
118
- if (context) {
119
- plugins.push((0, import_plugins.useRedwoodPopulateContext)(context));
120
- }
121
- plugins.push(...redwoodDirectivePlugins);
122
- if (openTelemetryOptions !== void 0) {
123
- plugins.push((0, import_plugins.useRedwoodOpenTelemetry)(openTelemetryOptions));
124
- }
125
- plugins.push((0, import_plugins.useArmor)(logger, armorConfig));
126
- const defaultAllowedOperations = [
127
- import_graphql.OperationTypeNode.QUERY,
128
- import_graphql.OperationTypeNode.MUTATION
129
- ];
130
- if (realtime?.subscriptions?.subscriptions) {
131
- defaultAllowedOperations.push(import_graphql.OperationTypeNode.SUBSCRIPTION);
132
- }
133
- plugins.push(
134
- (0, import_filter_operation_type.useFilterAllowedOperations)(allowedOperations || defaultAllowedOperations)
135
- );
136
- if (trustedDocuments && !trustedDocuments.disabled) {
137
- plugins.push((0, import_plugins.useRedwoodTrustedDocuments)(trustedDocuments));
138
- }
139
- if (extraPlugins && extraPlugins.length > 0) {
140
- plugins.push(...extraPlugins);
141
- }
142
- plugins.push((0, import_plugins.useRedwoodError)(logger));
143
- plugins.push(
144
- (0, import_graphql_yoga.useReadinessCheck)({
145
- endpoint: graphiQLEndpoint + "/readiness",
146
- check: async ({ request }) => {
147
- try {
148
- const response = await yoga.fetch(
149
- new URL(graphiQLEndpoint + "/health", request.url)
150
- );
151
- const status = response.headers.get("x-yoga-id") === healthCheckId && request.headers.get("x-yoga-id") === healthCheckId;
152
- return status;
153
- } catch (err) {
154
- logger.error(err);
155
- return false;
156
- }
157
- }
158
- })
159
- );
160
- plugins.push((0, import_plugins.useRedwoodLogger)(loggerConfig));
161
- const yoga = (0, import_graphql_yoga.createYoga)({
162
- id: healthCheckId,
163
- landingPage: isDevEnv,
164
- schema,
165
- plugins,
166
- maskedErrors: {
167
- errorMessage: defaultError,
168
- isDev: isDevEnv
169
- },
170
- logging: logger,
171
- healthCheckEndpoint: graphiQLEndpoint + "/health",
172
- graphqlEndpoint: graphiQLEndpoint,
173
- graphiql: (0, import_graphiql.configureGraphiQLPlayground)({
174
- allowGraphiQL,
175
- generateGraphiQLHeader
176
- }),
177
- cors: (request) => {
178
- const requestOrigin = request.headers.get("origin");
179
- return (0, import_cors.mapRwCorsOptionsToYoga)(cors, requestOrigin);
180
- }
181
- });
182
- return { yoga, logger };
183
- } catch (e) {
184
- if (onException) {
185
- onException();
186
- }
187
- throw e;
188
- }
189
- };
190
- // Annotate the CommonJS export names for ESM import in node:
191
- 0 && (module.exports = {
192
- createGraphQLYoga
193
- });
@@ -1,8 +0,0 @@
1
- import { type DocumentNode } from 'graphql';
2
- import type { RedwoodDirective, TransformerDirective, TransformerDirectiveFunc, ValidatorDirective, ValidatorDirectiveFunc } from '../plugins/useRedwoodDirective.js';
3
- export type DirectiveGlobImports = Record<string, any>;
4
- export declare const makeDirectivesForPlugin: (directiveGlobs: DirectiveGlobImports) => RedwoodDirective[];
5
- export declare const getDirectiveName: (schema: DocumentNode) => string | undefined;
6
- export declare const createValidatorDirective: (schema: DocumentNode, directiveFunc: ValidatorDirectiveFunc) => ValidatorDirective;
7
- export declare const createTransformerDirective: (schema: DocumentNode, directiveFunc: TransformerDirectiveFunc) => TransformerDirective;
8
- //# sourceMappingURL=makeDirectives.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"makeDirectives.d.ts","sourceRoot":"","sources":["../../../src/directives/makeDirectives.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,YAAY,EAAE,MAAM,SAAS,CAAA;AAEjD,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,EACxB,kBAAkB,EAClB,sBAAsB,EACvB,MAAM,mCAAmC,CAAA;AAW1C,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAEtD,eAAO,MAAM,uBAAuB,GAClC,gBAAgB,oBAAoB,KACnC,gBAAgB,EAwBlB,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,QAAQ,YAAY,uBAMpD,CAAA;AAED,eAAO,MAAM,wBAAwB,GACnC,QAAQ,YAAY,EACpB,eAAe,sBAAsB,KACpC,kBAmBF,CAAA;AAED,eAAO,MAAM,0BAA0B,GACrC,QAAQ,YAAY,EACpB,eAAe,wBAAwB,KACtC,oBAmBF,CAAA"}
@@ -1,89 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var makeDirectives_exports = {};
20
- __export(makeDirectives_exports, {
21
- createTransformerDirective: () => createTransformerDirective,
22
- createValidatorDirective: () => createValidatorDirective,
23
- getDirectiveName: () => getDirectiveName,
24
- makeDirectivesForPlugin: () => makeDirectivesForPlugin
25
- });
26
- module.exports = __toCommonJS(makeDirectives_exports);
27
- var import_graphql = require("graphql");
28
- var import_useRedwoodDirective = require("../plugins/useRedwoodDirective.js");
29
- const makeDirectivesForPlugin = (directiveGlobs) => {
30
- return Object.entries(directiveGlobs).flatMap(
31
- ([importedGlobName, exports2]) => {
32
- const [directiveNameFromFile] = importedGlobName.split("_").slice(-2);
33
- const directive = exports2[directiveNameFromFile] || exports2.default;
34
- if (!directive.type) {
35
- throw new Error(
36
- "Please use `createValidatorDirective` or `createTransformerDirective` functions to define your directive"
37
- );
38
- }
39
- return [directive];
40
- }
41
- );
42
- };
43
- const getDirectiveName = (schema) => {
44
- const definition = schema.definitions.find(
45
- (definition2) => definition2.kind === import_graphql.Kind.DIRECTIVE_DEFINITION
46
- );
47
- return definition?.name?.value;
48
- };
49
- const createValidatorDirective = (schema, directiveFunc) => {
50
- const directiveName = getDirectiveName(schema);
51
- if (!directiveName) {
52
- throw new Error("Could not parse directive schema");
53
- }
54
- if (typeof directiveFunc !== "function") {
55
- throw new Error(
56
- `Directive validation function not implemented for @${directiveName}`
57
- );
58
- }
59
- return {
60
- name: directiveName,
61
- schema,
62
- onResolvedValue: directiveFunc,
63
- type: import_useRedwoodDirective.DirectiveType.VALIDATOR
64
- };
65
- };
66
- const createTransformerDirective = (schema, directiveFunc) => {
67
- const directiveName = getDirectiveName(schema);
68
- if (!directiveName) {
69
- throw new Error("Could not parse directive schema");
70
- }
71
- if (typeof directiveFunc !== "function") {
72
- throw new Error(
73
- `Directive transformer function not implemented for @${directiveName}`
74
- );
75
- }
76
- return {
77
- name: directiveName,
78
- schema,
79
- onResolvedValue: directiveFunc,
80
- type: import_useRedwoodDirective.DirectiveType.TRANSFORMER
81
- };
82
- };
83
- // Annotate the CommonJS export names for ESM import in node:
84
- 0 && (module.exports = {
85
- createTransformerDirective,
86
- createValidatorDirective,
87
- getDirectiveName,
88
- makeDirectivesForPlugin
89
- });
@@ -1,32 +0,0 @@
1
- import { GraphQLError } from 'graphql';
2
- export declare class CedarGraphQLError extends GraphQLError {
3
- constructor(message: string, extensions?: Record<string, any>, originalError?: Error & {
4
- readonly extensions?: unknown;
5
- });
6
- }
7
- /** @deprecated Use `CedarGraphQLError` instead */
8
- export declare const RedwoodGraphQLError: typeof CedarGraphQLError;
9
- /** @deprecated Use `CedarGraphQLError` instead */
10
- export type RedwoodGraphQLError = CedarGraphQLError;
11
- export declare class SyntaxError extends CedarGraphQLError {
12
- constructor(message: string);
13
- }
14
- export declare class ValidationError extends CedarGraphQLError {
15
- constructor(message: string);
16
- }
17
- export declare class AuthenticationError extends CedarGraphQLError {
18
- constructor(message: string);
19
- }
20
- export declare class ForbiddenError extends CedarGraphQLError {
21
- constructor(message: string);
22
- }
23
- export declare class PersistedQueryNotFoundError extends CedarGraphQLError {
24
- constructor();
25
- }
26
- export declare class PersistedQueryNotSupportedError extends CedarGraphQLError {
27
- constructor();
28
- }
29
- export declare class UserInputError extends CedarGraphQLError {
30
- constructor(message: string, properties?: Record<string, any>);
31
- }
32
- //# sourceMappingURL=errors.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,qBAAa,iBAAkB,SAAQ,YAAY;gBAE/C,OAAO,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAChC,aAAa,CAAC,EAAE,KAAK,GAAG;QACtB,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;KAC9B;CAYJ;AAED,kDAAkD;AAClD,eAAO,MAAM,mBAAmB,0BAAoB,CAAA;AASpD,kDAAkD;AAClD,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,CAAA;AAEnD,qBAAa,WAAY,SAAQ,iBAAiB;gBACpC,OAAO,EAAE,MAAM;CAK5B;AAED,qBAAa,eAAgB,SAAQ,iBAAiB;gBACxC,OAAO,EAAE,MAAM;CAK5B;AAED,qBAAa,mBAAoB,SAAQ,iBAAiB;gBAC5C,OAAO,EAAE,MAAM;CAK5B;AAED,qBAAa,cAAe,SAAQ,iBAAiB;gBACvC,OAAO,EAAE,MAAM;CAK5B;AAED,qBAAa,2BAA4B,SAAQ,iBAAiB;;CAMjE;AAED,qBAAa,+BAAgC,SAAQ,iBAAiB;;CAQrE;AAED,qBAAa,cAAe,SAAQ,iBAAiB;gBACvC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAK9D"}