@cedarjs/graphql-server 0.6.1-next.0 → 0.7.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 (148) hide show
  1. package/dist/cjs/cors.d.ts +10 -0
  2. package/dist/cjs/cors.d.ts.map +1 -0
  3. package/dist/cjs/cors.js +70 -0
  4. package/dist/cjs/createGraphQLYoga.d.ts +6 -0
  5. package/dist/cjs/createGraphQLYoga.d.ts.map +1 -0
  6. package/dist/cjs/createGraphQLYoga.js +178 -0
  7. package/dist/cjs/directives/makeDirectives.d.ts +8 -0
  8. package/dist/cjs/directives/makeDirectives.d.ts.map +1 -0
  9. package/dist/cjs/directives/makeDirectives.js +89 -0
  10. package/dist/cjs/errors.d.ts +28 -0
  11. package/dist/cjs/errors.d.ts.map +1 -0
  12. package/dist/cjs/errors.js +98 -0
  13. package/dist/cjs/functions/graphql.d.ts +15 -0
  14. package/dist/cjs/functions/graphql.d.ts.map +1 -0
  15. package/dist/cjs/functions/graphql.js +141 -0
  16. package/dist/cjs/functions/useRequireAuth.d.ts +12 -0
  17. package/dist/cjs/functions/useRequireAuth.d.ts.map +1 -0
  18. package/dist/cjs/functions/useRequireAuth.js +70 -0
  19. package/dist/cjs/global.api-auto-imports.d.ts +5 -0
  20. package/dist/cjs/global.api-auto-imports.d.ts.map +1 -0
  21. package/dist/cjs/global.api-auto-imports.js +1 -0
  22. package/dist/cjs/globalContext.d.ts +25 -0
  23. package/dist/cjs/globalContext.d.ts.map +1 -0
  24. package/dist/cjs/globalContext.js +55 -0
  25. package/dist/cjs/globalContextStore.d.ts +9 -0
  26. package/dist/cjs/globalContextStore.d.ts.map +1 -0
  27. package/dist/cjs/globalContextStore.js +35 -0
  28. package/dist/cjs/graphiql.d.ts +8 -0
  29. package/dist/cjs/graphiql.d.ts.map +1 -0
  30. package/dist/cjs/graphiql.js +45 -0
  31. package/dist/cjs/index.d.ts +14 -0
  32. package/dist/cjs/index.d.ts.map +1 -0
  33. package/dist/cjs/index.js +75 -0
  34. package/dist/cjs/introspection.d.ts +7 -0
  35. package/dist/cjs/introspection.d.ts.map +1 -0
  36. package/dist/cjs/introspection.js +36 -0
  37. package/dist/cjs/makeMergedSchema.d.ts +17 -0
  38. package/dist/cjs/makeMergedSchema.d.ts.map +1 -0
  39. package/dist/cjs/makeMergedSchema.js +283 -0
  40. package/dist/cjs/package.json +1 -0
  41. package/dist/cjs/plugins/index.d.ts +10 -0
  42. package/dist/cjs/plugins/index.d.ts.map +1 -0
  43. package/dist/cjs/plugins/index.js +52 -0
  44. package/dist/cjs/plugins/useArmor.d.ts +4 -0
  45. package/dist/cjs/plugins/useArmor.d.ts.map +1 -0
  46. package/dist/cjs/plugins/useArmor.js +69 -0
  47. package/dist/cjs/plugins/useRedwoodAuthContext.d.ts +9 -0
  48. package/dist/cjs/plugins/useRedwoodAuthContext.d.ts.map +1 -0
  49. package/dist/cjs/plugins/useRedwoodAuthContext.js +61 -0
  50. package/dist/cjs/plugins/useRedwoodDirective.d.ts +83 -0
  51. package/dist/cjs/plugins/useRedwoodDirective.d.ts.map +1 -0
  52. package/dist/cjs/plugins/useRedwoodDirective.js +166 -0
  53. package/dist/cjs/plugins/useRedwoodError.d.ts +20 -0
  54. package/dist/cjs/plugins/useRedwoodError.d.ts.map +1 -0
  55. package/dist/cjs/plugins/useRedwoodError.js +63 -0
  56. package/dist/cjs/plugins/useRedwoodGlobalContextSetter.d.ts +9 -0
  57. package/dist/cjs/plugins/useRedwoodGlobalContextSetter.d.ts.map +1 -0
  58. package/dist/cjs/plugins/useRedwoodGlobalContextSetter.js +35 -0
  59. package/dist/cjs/plugins/useRedwoodLogger.d.ts +115 -0
  60. package/dist/cjs/plugins/useRedwoodLogger.d.ts.map +1 -0
  61. package/dist/cjs/plugins/useRedwoodLogger.js +149 -0
  62. package/dist/cjs/plugins/useRedwoodOpenTelemetry.d.ts +22 -0
  63. package/dist/cjs/plugins/useRedwoodOpenTelemetry.d.ts.map +1 -0
  64. package/dist/cjs/plugins/useRedwoodOpenTelemetry.js +156 -0
  65. package/dist/cjs/plugins/useRedwoodPopulateContext.d.ts +9 -0
  66. package/dist/cjs/plugins/useRedwoodPopulateContext.d.ts.map +1 -0
  67. package/dist/cjs/plugins/useRedwoodPopulateContext.js +35 -0
  68. package/dist/cjs/plugins/useRedwoodTrustedDocuments.d.ts +23 -0
  69. package/dist/cjs/plugins/useRedwoodTrustedDocuments.d.ts.map +1 -0
  70. package/dist/cjs/plugins/useRedwoodTrustedDocuments.js +80 -0
  71. package/dist/cjs/rootSchema.d.ts +25 -0
  72. package/dist/cjs/rootSchema.d.ts.map +1 -0
  73. package/dist/cjs/rootSchema.js +97 -0
  74. package/dist/cjs/subscriptions/makeSubscriptions.d.ts +18 -0
  75. package/dist/cjs/subscriptions/makeSubscriptions.d.ts.map +1 -0
  76. package/dist/cjs/subscriptions/makeSubscriptions.js +40 -0
  77. package/dist/cjs/types.d.ts +215 -0
  78. package/dist/cjs/types.d.ts.map +1 -0
  79. package/dist/cjs/types.js +16 -0
  80. package/dist/cors.js +2 -26
  81. package/dist/createGraphQLYoga.d.ts +1 -1
  82. package/dist/createGraphQLYoga.d.ts.map +1 -1
  83. package/dist/createGraphQLYoga.js +45 -59
  84. package/dist/directives/makeDirectives.d.ts +1 -1
  85. package/dist/directives/makeDirectives.d.ts.map +1 -1
  86. package/dist/directives/makeDirectives.js +9 -36
  87. package/dist/errors.js +5 -36
  88. package/dist/functions/graphql.d.ts +1 -1
  89. package/dist/functions/graphql.d.ts.map +1 -1
  90. package/dist/functions/graphql.js +6 -30
  91. package/dist/functions/useRequireAuth.d.ts +1 -1
  92. package/dist/functions/useRequireAuth.d.ts.map +1 -1
  93. package/dist/functions/useRequireAuth.js +9 -33
  94. package/dist/global.api-auto-imports.js +0 -1
  95. package/dist/globalContext.js +6 -32
  96. package/dist/globalContextStore.d.ts +1 -1
  97. package/dist/globalContextStore.d.ts.map +1 -1
  98. package/dist/globalContextStore.js +4 -28
  99. package/dist/graphiql.d.ts +1 -1
  100. package/dist/graphiql.d.ts.map +1 -1
  101. package/dist/graphiql.js +2 -26
  102. package/dist/index.d.ts +12 -11
  103. package/dist/index.d.ts.map +1 -1
  104. package/dist/index.js +24 -82
  105. package/dist/introspection.d.ts +1 -1
  106. package/dist/introspection.d.ts.map +1 -1
  107. package/dist/introspection.js +2 -26
  108. package/dist/makeMergedSchema.d.ts +3 -3
  109. package/dist/makeMergedSchema.d.ts.map +1 -1
  110. package/dist/makeMergedSchema.js +19 -49
  111. package/dist/plugins/index.d.ts +9 -9
  112. package/dist/plugins/index.d.ts.map +1 -1
  113. package/dist/plugins/index.js +11 -43
  114. package/dist/plugins/useArmor.d.ts +2 -2
  115. package/dist/plugins/useArmor.d.ts.map +1 -1
  116. package/dist/plugins/useArmor.js +4 -28
  117. package/dist/plugins/useRedwoodAuthContext.d.ts +1 -1
  118. package/dist/plugins/useRedwoodAuthContext.d.ts.map +1 -1
  119. package/dist/plugins/useRedwoodAuthContext.js +4 -28
  120. package/dist/plugins/useRedwoodDirective.js +9 -37
  121. package/dist/plugins/useRedwoodError.d.ts +1 -1
  122. package/dist/plugins/useRedwoodError.d.ts.map +1 -1
  123. package/dist/plugins/useRedwoodError.js +10 -31
  124. package/dist/plugins/useRedwoodGlobalContextSetter.d.ts +1 -1
  125. package/dist/plugins/useRedwoodGlobalContextSetter.d.ts.map +1 -1
  126. package/dist/plugins/useRedwoodGlobalContextSetter.js +4 -28
  127. package/dist/plugins/useRedwoodLogger.d.ts +1 -1
  128. package/dist/plugins/useRedwoodLogger.d.ts.map +1 -1
  129. package/dist/plugins/useRedwoodLogger.js +10 -34
  130. package/dist/plugins/useRedwoodOpenTelemetry.d.ts +1 -1
  131. package/dist/plugins/useRedwoodOpenTelemetry.d.ts.map +1 -1
  132. package/dist/plugins/useRedwoodOpenTelemetry.js +11 -46
  133. package/dist/plugins/useRedwoodPopulateContext.d.ts +1 -1
  134. package/dist/plugins/useRedwoodPopulateContext.d.ts.map +1 -1
  135. package/dist/plugins/useRedwoodPopulateContext.js +2 -26
  136. package/dist/plugins/useRedwoodTrustedDocuments.d.ts +1 -1
  137. package/dist/plugins/useRedwoodTrustedDocuments.d.ts.map +1 -1
  138. package/dist/plugins/useRedwoodTrustedDocuments.js +4 -28
  139. package/dist/rootSchema.js +26 -54
  140. package/dist/subscriptions/makeSubscriptions.js +5 -29
  141. package/dist/types.d.ts +4 -4
  142. package/dist/types.d.ts.map +1 -1
  143. package/dist/types.js +0 -16
  144. package/package.json +27 -10
  145. package/dist/plugins/__fixtures__/common.d.ts +0 -9
  146. package/dist/plugins/__fixtures__/common.d.ts.map +0 -1
  147. package/dist/plugins/__fixtures__/envelop-testing.d.ts +0 -55
  148. package/dist/plugins/__fixtures__/envelop-testing.d.ts.map +0 -1
@@ -0,0 +1,215 @@
1
+ import type { AllowedOperations } from '@envelop/filter-operation-type';
2
+ import type { GraphQLArmorConfig } from '@escape.tech/graphql-armor-types';
3
+ import type { IExecutableSchemaDefinition } from '@graphql-tools/schema';
4
+ import type { APIGatewayProxyEvent, Context as LambdaContext } from 'aws-lambda';
5
+ import type { GraphQLObjectType, GraphQLInterfaceType, DocumentNode } from 'graphql';
6
+ import type { Plugin } from 'graphql-yoga';
7
+ import type { AuthContextPayload, Decoder } from '@cedarjs/api';
8
+ import type { CorsConfig } from '@cedarjs/api';
9
+ import type { RedwoodRealtimeOptions } from '@cedarjs/realtime';
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';
14
+ export type Resolver = (...args: unknown[]) => unknown;
15
+ export type Services = {
16
+ [funcName: string]: Resolver;
17
+ };
18
+ type ThenArg<T> = T extends PromiseLike<infer U> ? U : T;
19
+ export type ResolverArgs<TRoot> = {
20
+ root: ThenArg<TRoot>;
21
+ };
22
+ export type SdlGlobImports = {
23
+ [key: string]: {
24
+ schema: DocumentNode;
25
+ resolvers: Record<string, unknown>;
26
+ };
27
+ };
28
+ export type ServicesGlobImports = {
29
+ [serviceName: string]: Services;
30
+ };
31
+ export interface MakeServicesInterface {
32
+ services: ServicesGlobImports;
33
+ }
34
+ export type MakeServices = (args: MakeServicesInterface) => ServicesGlobImports;
35
+ export type GraphQLTypeWithFields = GraphQLObjectType | GraphQLInterfaceType;
36
+ export type { useRedwoodDirectiveReturn, DirectivePluginOptions };
37
+ export type GetCurrentUser = (decoded: AuthContextPayload[0], raw: AuthContextPayload[1], req?: AuthContextPayload[2]) => Promise<null | Record<string, unknown>>;
38
+ export type GenerateGraphiQLHeader = () => string;
39
+ export type Context = Record<string, unknown>;
40
+ export type ContextFunction = (...args: any[]) => Context | Promise<Context>;
41
+ export type ArmorConfig = {
42
+ logContext?: boolean;
43
+ logErrors?: boolean;
44
+ } & GraphQLArmorConfig;
45
+ /** This is an interface so you can extend it inside your application when needed */
46
+ export interface RedwoodGraphQLContext {
47
+ event: APIGatewayProxyEvent;
48
+ requestContext: LambdaContext;
49
+ currentUser?: ThenArg<ReturnType<GetCurrentUser>> | AuthContextPayload | null;
50
+ [index: string]: unknown;
51
+ }
52
+ export interface RedwoodOpenTelemetryConfig {
53
+ /**
54
+ * @description Enables the creation of a span for each resolver execution.
55
+ */
56
+ resolvers: boolean;
57
+ /**
58
+ * @description Includes the execution result in the span attributes.
59
+ */
60
+ variables: boolean;
61
+ /**
62
+ * @description Includes the variables in the span attributes.
63
+ */
64
+ result: boolean;
65
+ }
66
+ export interface RedwoodScalarConfig {
67
+ File?: boolean;
68
+ }
69
+ /**
70
+ * GraphQLYogaOptions
71
+ */
72
+ export type GraphQLYogaOptions = {
73
+ /**
74
+ * @description The identifier used in the GraphQL health check response.
75
+ * It verifies readiness when sent as a header in the readiness check request.
76
+ *
77
+ * By default, the identifier is `yoga` as seen in the HTTP response header `x-yoga-id: yoga`
78
+ */
79
+ healthCheckId?: string;
80
+ /**
81
+ * @description Customize GraphQL Logger
82
+ *
83
+ * Collect resolver timings, and exposes trace data for
84
+ * an individual request under extensions as part of the GraphQL response.
85
+ */
86
+ loggerConfig: LoggerConfig;
87
+ /**
88
+ * @description Modify the resolver and global context.
89
+ */
90
+ context?: Context | ContextFunction;
91
+ /**
92
+ * @description An async function that maps the auth token retrieved from the
93
+ * request headers to an object.
94
+ * Is it executed when the `auth-provider` contains one of the supported
95
+ * providers.
96
+ */
97
+ getCurrentUser?: GetCurrentUser;
98
+ /**
99
+ * @description A callback when an unhandled exception occurs. Use this to disconnect your prisma instance.
100
+ */
101
+ onException?: () => void;
102
+ /**
103
+ * @description Services passed from the glob import:
104
+ * import services from 'src/services\/**\/*.{js,ts}'
105
+ */
106
+ services: ServicesGlobImports;
107
+ /**
108
+ * @description SDLs (schema definitions) passed from the glob import:
109
+ * import sdls from 'src/graphql\/**\/*.{js,ts}'
110
+ */
111
+ sdls: SdlGlobImports;
112
+ /**
113
+ * @description Directives passed from the glob import:
114
+ * import directives from 'src/directives/**\/*.{js,ts}'
115
+ */
116
+ directives?: DirectiveGlobImports;
117
+ /**
118
+ * @description A list of options passed to [makeExecutableSchema]
119
+ * (https://www.graphql-tools.com/docs/generate-schema/#makeexecutableschemaoptions).
120
+ */
121
+ schemaOptions?: Partial<IExecutableSchemaDefinition>;
122
+ /**
123
+ * @description CORS configuration
124
+ */
125
+ cors?: CorsConfig;
126
+ /**
127
+ * @description Customize GraphQL Armor plugin configuration
128
+ *
129
+ * @see https://escape-technologies.github.io/graphql-armor/docs/configuration/examples
130
+ */
131
+ armorConfig?: ArmorConfig;
132
+ /**
133
+ * @description Customize the default error message used to mask errors.
134
+ *
135
+ * By default, the masked error message is "Something went wrong"
136
+ *
137
+ * @see https://github.com/dotansimha/envelop/blob/main/packages/core/docs/use-masked-errors.md
138
+ */
139
+ defaultError?: string;
140
+ /**
141
+ * @description Only allows the specified operation types (e.g. subscription, query or mutation).
142
+ *
143
+ * By default, only allow query and mutation (ie, do not allow subscriptions).
144
+ *
145
+ * An array of GraphQL's OperationTypeNode enums:
146
+ * - OperationTypeNode.SUBSCRIPTION
147
+ * - OperationTypeNode.QUERY
148
+ * - OperationTypeNode.MUTATION
149
+ *
150
+ * @see https://github.com/dotansimha/envelop/tree/main/packages/plugins/filter-operation-type
151
+ */
152
+ allowedOperations?: AllowedOperations;
153
+ /**
154
+ * @description Custom Envelop plugins
155
+ */
156
+ extraPlugins?: Plugin[];
157
+ /**
158
+ * @description Auth-provider specific token decoder
159
+ */
160
+ authDecoder?: Decoder | Decoder[];
161
+ /**
162
+ * @description Customize the GraphiQL Endpoint that appears in the location bar of the GraphQL Playground
163
+ *
164
+ * Defaults to '/graphql' as this value must match the name of the `graphql` function on the api-side.
165
+ */
166
+ graphiQLEndpoint?: string;
167
+ /**
168
+ * @description Allow GraphiQL playground.
169
+ * By default, GraphiQL playground is disabled in production. Explicitly set this to true or false to override in all environments.
170
+ */
171
+ allowGraphiQL?: boolean;
172
+ /**
173
+ * @description Allow schema introspection.
174
+ * By default, schema introspection is disabled in production. Explicitly set this to true or false to override in all environments.
175
+ */
176
+ allowIntrospection?: boolean;
177
+ /**
178
+ * @description Function that returns custom headers (as string) for GraphiQL.
179
+ *
180
+ * Headers must set auth-provider, Authorization and (if using dbAuth) the encrypted cookie.
181
+ */
182
+ generateGraphiQLHeader?: GenerateGraphiQLHeader;
183
+ /**
184
+ * @description Configure RedwoodRealtime plugin with subscriptions and live queries
185
+ *
186
+ * Only supported in a server deploy and not allowed with GraphQLHandler config
187
+ */
188
+ realtime?: RedwoodRealtimeOptions;
189
+ /**
190
+ * @description Configure Trusted Documents options
191
+ *
192
+ * @see https://benjie.dev/graphql/trusted-documents
193
+ * @see https://the-guild.dev/graphql/yoga-server/docs/features/persisted-operations
194
+ */
195
+ trustedDocuments?: RedwoodTrustedDocumentOptions;
196
+ /**
197
+ * @description Configure OpenTelemetry plugin behaviour
198
+ */
199
+ openTelemetryOptions?: RedwoodOpenTelemetryConfig;
200
+ /**
201
+ * @description Configure which scalars to include in the schema. This should match your
202
+ * `graphql.includeScalars` configuration in `redwood.toml`.
203
+ *
204
+ * The default is to include. You must set to `false` to exclude.
205
+ */
206
+ includeScalars?: RedwoodScalarConfig;
207
+ };
208
+ /**
209
+ * @description Configure GraphQLHandler with options
210
+ *
211
+ * Note: RedwoodRealtime is not supported
212
+ */
213
+ export type GraphQLHandlerOptions = GraphQLYogaOptions;
214
+ export type GraphiQLOptions = Pick<GraphQLYogaOptions, 'allowGraphiQL' | 'generateGraphiQLHeader'>;
215
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAC1E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAA;AACxE,OAAO,KAAK,EAAE,oBAAoB,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,YAAY,CAAA;AAChF,OAAO,KAAK,EACV,iBAAiB,EACjB,oBAAoB,EACpB,YAAY,EACb,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAE/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AAC1E,OAAO,KAAK,EACV,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,YA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getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var types_exports = {};
16
+ module.exports = __toCommonJS(types_exports);
package/dist/cors.js CHANGED
@@ -1,26 +1,3 @@
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
1
  const mapRwCorsOptionsToYoga = (rwCorsConfig, requestOrigin) => {
25
2
  const yogaCORSOptions = {};
26
3
  if (!rwCorsConfig) {
@@ -64,7 +41,6 @@ const mapRwCorsOptionsToYoga = (rwCorsConfig, requestOrigin) => {
64
41
  }
65
42
  return yogaCORSOptions;
66
43
  };
67
- // Annotate the CommonJS export names for ESM import in node:
68
- 0 && (module.exports = {
44
+ export {
69
45
  mapRwCorsOptionsToYoga
70
- });
46
+ };
@@ -1,4 +1,4 @@
1
- import type { GraphQLYogaOptions } from './types';
1
+ import type { GraphQLYogaOptions } from './types.js';
2
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) => {
3
3
  yoga: ServerAdapter<TServerContext, import("graphql-yoga").YogaServer<TServerContext, TUserContext>>;
4
4
  logger: import("@cedarjs/api/logger").Logger;
@@ -1 +1 @@
1
- {"version":3,"file":"createGraphQLYoga.d.ts","sourceRoot":"","sources":["../src/createGraphQLYoga.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAEjD,eAAO,MAAM,iBAAiB,oVAwB3B,kBAAkB;;;CAmKpB,CAAA"}
1
+ {"version":3,"file":"createGraphQLYoga.d.ts","sourceRoot":"","sources":["../src/createGraphQLYoga.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAEpD,eAAO,MAAM,iBAAiB,oVAwB3B,kBAAkB;;;CAmKpB,CAAA"}
@@ -1,37 +1,24 @@
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 createGraphQLYoga_exports = {};
20
- __export(createGraphQLYoga_exports, {
21
- createGraphQLYoga: () => createGraphQLYoga
22
- });
23
- module.exports = __toCommonJS(createGraphQLYoga_exports);
24
- var import_disable_introspection = require("@envelop/disable-introspection");
25
- var import_filter_operation_type = require("@envelop/filter-operation-type");
26
- var import_graphql = require("graphql");
27
- var import_graphql_yoga = require("graphql-yoga");
28
- var import_cors = require("./cors");
29
- var import_makeDirectives = require("./directives/makeDirectives");
30
- var import_graphiql = require("./graphiql");
31
- var import_introspection = require("./introspection");
32
- var import_makeMergedSchema = require("./makeMergedSchema");
33
- var import_plugins = require("./plugins");
34
- var import_makeSubscriptions = require("./subscriptions/makeSubscriptions");
1
+ import { useDisableIntrospection } from "@envelop/disable-introspection";
2
+ import { useFilterAllowedOperations } from "@envelop/filter-operation-type";
3
+ import { OperationTypeNode } from "graphql";
4
+ import { useReadinessCheck, createYoga } from "graphql-yoga";
5
+ import { mapRwCorsOptionsToYoga } from "./cors.js";
6
+ import { makeDirectivesForPlugin } from "./directives/makeDirectives.js";
7
+ import { configureGraphiQLPlayground } from "./graphiql.js";
8
+ import { configureGraphQLIntrospection } from "./introspection.js";
9
+ import { makeMergedSchema } from "./makeMergedSchema.js";
10
+ import {
11
+ useArmor,
12
+ useRedwoodAuthContext,
13
+ useRedwoodDirective,
14
+ useRedwoodError,
15
+ useRedwoodGlobalContextSetter,
16
+ useRedwoodOpenTelemetry,
17
+ useRedwoodLogger,
18
+ useRedwoodPopulateContext,
19
+ useRedwoodTrustedDocuments
20
+ } from "./plugins/index.js";
21
+ import { makeSubscriptions } from "./subscriptions/makeSubscriptions.js";
35
22
  const createGraphQLYoga = ({
36
23
  healthCheckId = "yoga",
37
24
  loggerConfig,
@@ -62,20 +49,20 @@ const createGraphQLYoga = ({
62
49
  const logger = loggerConfig.logger;
63
50
  const isDevEnv = process.env.NODE_ENV === "development";
64
51
  try {
65
- const projectDirectives = (0, import_makeDirectives.makeDirectivesForPlugin)(directives);
52
+ const projectDirectives = makeDirectivesForPlugin(directives);
66
53
  if (projectDirectives.length > 0) {
67
54
  ;
68
55
  redwoodDirectivePlugins = projectDirectives.map(
69
- (directive) => (0, import_plugins.useRedwoodDirective)(directive)
56
+ (directive) => useRedwoodDirective(directive)
70
57
  );
71
58
  }
72
59
  let projectSubscriptions = [];
73
60
  if (realtime?.subscriptions?.subscriptions) {
74
- projectSubscriptions = (0, import_makeSubscriptions.makeSubscriptions)(
61
+ projectSubscriptions = makeSubscriptions(
75
62
  realtime.subscriptions.subscriptions
76
63
  );
77
64
  }
78
- schema = (0, import_makeMergedSchema.makeMergedSchema)({
65
+ schema = makeMergedSchema({
79
66
  sdls,
80
67
  services,
81
68
  directives: projectDirectives,
@@ -92,41 +79,41 @@ const createGraphQLYoga = ({
92
79
  }
93
80
  try {
94
81
  const plugins = [];
95
- const { disableIntrospection } = (0, import_introspection.configureGraphQLIntrospection)({
82
+ const { disableIntrospection } = configureGraphQLIntrospection({
96
83
  allowIntrospection
97
84
  });
98
85
  if (disableIntrospection) {
99
- plugins.push((0, import_disable_introspection.useDisableIntrospection)());
86
+ plugins.push(useDisableIntrospection());
100
87
  }
101
- plugins.push((0, import_plugins.useRedwoodAuthContext)(getCurrentUser, authDecoder));
102
- plugins.push((0, import_plugins.useRedwoodGlobalContextSetter)());
88
+ plugins.push(useRedwoodAuthContext(getCurrentUser, authDecoder));
89
+ plugins.push(useRedwoodGlobalContextSetter());
103
90
  if (context) {
104
- plugins.push((0, import_plugins.useRedwoodPopulateContext)(context));
91
+ plugins.push(useRedwoodPopulateContext(context));
105
92
  }
106
93
  plugins.push(...redwoodDirectivePlugins);
107
94
  if (openTelemetryOptions !== void 0) {
108
- plugins.push((0, import_plugins.useRedwoodOpenTelemetry)(openTelemetryOptions));
95
+ plugins.push(useRedwoodOpenTelemetry(openTelemetryOptions));
109
96
  }
110
- plugins.push((0, import_plugins.useArmor)(logger, armorConfig));
97
+ plugins.push(useArmor(logger, armorConfig));
111
98
  const defaultAllowedOperations = [
112
- import_graphql.OperationTypeNode.QUERY,
113
- import_graphql.OperationTypeNode.MUTATION
99
+ OperationTypeNode.QUERY,
100
+ OperationTypeNode.MUTATION
114
101
  ];
115
102
  if (realtime?.subscriptions?.subscriptions) {
116
- defaultAllowedOperations.push(import_graphql.OperationTypeNode.SUBSCRIPTION);
103
+ defaultAllowedOperations.push(OperationTypeNode.SUBSCRIPTION);
117
104
  }
118
105
  plugins.push(
119
- (0, import_filter_operation_type.useFilterAllowedOperations)(allowedOperations || defaultAllowedOperations)
106
+ useFilterAllowedOperations(allowedOperations || defaultAllowedOperations)
120
107
  );
121
108
  if (trustedDocuments && !trustedDocuments.disabled) {
122
- plugins.push((0, import_plugins.useRedwoodTrustedDocuments)(trustedDocuments));
109
+ plugins.push(useRedwoodTrustedDocuments(trustedDocuments));
123
110
  }
124
111
  if (extraPlugins && extraPlugins.length > 0) {
125
112
  plugins.push(...extraPlugins);
126
113
  }
127
- plugins.push((0, import_plugins.useRedwoodError)(logger));
114
+ plugins.push(useRedwoodError(logger));
128
115
  plugins.push(
129
- (0, import_graphql_yoga.useReadinessCheck)({
116
+ useReadinessCheck({
130
117
  endpoint: graphiQLEndpoint + "/readiness",
131
118
  check: async ({ request }) => {
132
119
  try {
@@ -142,8 +129,8 @@ const createGraphQLYoga = ({
142
129
  }
143
130
  })
144
131
  );
145
- plugins.push((0, import_plugins.useRedwoodLogger)(loggerConfig));
146
- const yoga = (0, import_graphql_yoga.createYoga)({
132
+ plugins.push(useRedwoodLogger(loggerConfig));
133
+ const yoga = createYoga({
147
134
  id: healthCheckId,
148
135
  landingPage: isDevEnv,
149
136
  schema,
@@ -155,13 +142,13 @@ const createGraphQLYoga = ({
155
142
  logging: logger,
156
143
  healthCheckEndpoint: graphiQLEndpoint + "/health",
157
144
  graphqlEndpoint: graphiQLEndpoint,
158
- graphiql: (0, import_graphiql.configureGraphiQLPlayground)({
145
+ graphiql: configureGraphiQLPlayground({
159
146
  allowGraphiQL,
160
147
  generateGraphiQLHeader
161
148
  }),
162
149
  cors: (request) => {
163
150
  const requestOrigin = request.headers.get("origin");
164
- return (0, import_cors.mapRwCorsOptionsToYoga)(cors, requestOrigin);
151
+ return mapRwCorsOptionsToYoga(cors, requestOrigin);
165
152
  }
166
153
  });
167
154
  return { yoga, logger };
@@ -172,7 +159,6 @@ const createGraphQLYoga = ({
172
159
  throw e;
173
160
  }
174
161
  };
175
- // Annotate the CommonJS export names for ESM import in node:
176
- 0 && (module.exports = {
162
+ export {
177
163
  createGraphQLYoga
178
- });
164
+ };
@@ -1,5 +1,5 @@
1
1
  import { type DocumentNode } from 'graphql';
2
- import type { RedwoodDirective, TransformerDirective, TransformerDirectiveFunc, ValidatorDirective, ValidatorDirectiveFunc } from '../plugins/useRedwoodDirective';
2
+ import type { RedwoodDirective, TransformerDirective, TransformerDirectiveFunc, ValidatorDirective, ValidatorDirectiveFunc } from '../plugins/useRedwoodDirective.js';
3
3
  export type DirectiveGlobImports = Record<string, any>;
4
4
  export declare const makeDirectivesForPlugin: (directiveGlobs: DirectiveGlobImports) => RedwoodDirective[];
5
5
  export declare const getDirectiveName: (schema: DocumentNode) => string | undefined;
@@ -1 +1 @@
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,gCAAgC,CAAA;AAWvC,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAEtD,eAAO,MAAM,uBAAuB,mBAClB,oBAAoB,KACnC,gBAAgB,EAwBlB,CAAA;AAED,eAAO,MAAM,gBAAgB,WAAY,YAAY,uBAMpD,CAAA;AAED,eAAO,MAAM,wBAAwB,WAC3B,YAAY,iBACL,sBAAsB,KACpC,kBAmBF,CAAA;AAED,eAAO,MAAM,0BAA0B,WAC7B,YAAY,iBACL,wBAAwB,KACtC,oBAmBF,CAAA"}
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,mBAClB,oBAAoB,KACnC,gBAAgB,EAwBlB,CAAA;AAED,eAAO,MAAM,gBAAgB,WAAY,YAAY,uBAMpD,CAAA;AAED,eAAO,MAAM,wBAAwB,WAC3B,YAAY,iBACL,sBAAsB,KACpC,kBAmBF,CAAA;AAED,eAAO,MAAM,0BAA0B,WAC7B,YAAY,iBACL,wBAAwB,KACtC,oBAmBF,CAAA"}
@@ -1,36 +1,10 @@
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");
1
+ import { Kind } from "graphql";
2
+ import { DirectiveType } from "../plugins/useRedwoodDirective.js";
29
3
  const makeDirectivesForPlugin = (directiveGlobs) => {
30
4
  return Object.entries(directiveGlobs).flatMap(
31
- ([importedGlobName, exports2]) => {
5
+ ([importedGlobName, exports]) => {
32
6
  const [directiveNameFromFile] = importedGlobName.split("_").slice(-2);
33
- const directive = exports2[directiveNameFromFile] || exports2.default;
7
+ const directive = exports[directiveNameFromFile] || exports.default;
34
8
  if (!directive.type) {
35
9
  throw new Error(
36
10
  "Please use `createValidatorDirective` or `createTransformerDirective` functions to define your directive"
@@ -42,7 +16,7 @@ const makeDirectivesForPlugin = (directiveGlobs) => {
42
16
  };
43
17
  const getDirectiveName = (schema) => {
44
18
  const definition = schema.definitions.find(
45
- (definition2) => definition2.kind === import_graphql.Kind.DIRECTIVE_DEFINITION
19
+ (definition2) => definition2.kind === Kind.DIRECTIVE_DEFINITION
46
20
  );
47
21
  return definition?.name?.value;
48
22
  };
@@ -60,7 +34,7 @@ const createValidatorDirective = (schema, directiveFunc) => {
60
34
  name: directiveName,
61
35
  schema,
62
36
  onResolvedValue: directiveFunc,
63
- type: import_useRedwoodDirective.DirectiveType.VALIDATOR
37
+ type: DirectiveType.VALIDATOR
64
38
  };
65
39
  };
66
40
  const createTransformerDirective = (schema, directiveFunc) => {
@@ -77,13 +51,12 @@ const createTransformerDirective = (schema, directiveFunc) => {
77
51
  name: directiveName,
78
52
  schema,
79
53
  onResolvedValue: directiveFunc,
80
- type: import_useRedwoodDirective.DirectiveType.TRANSFORMER
54
+ type: DirectiveType.TRANSFORMER
81
55
  };
82
56
  };
83
- // Annotate the CommonJS export names for ESM import in node:
84
- 0 && (module.exports = {
57
+ export {
85
58
  createTransformerDirective,
86
59
  createValidatorDirective,
87
60
  getDirectiveName,
88
61
  makeDirectivesForPlugin
89
- });
62
+ };
package/dist/errors.js CHANGED
@@ -1,35 +1,5 @@
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 errors_exports = {};
20
- __export(errors_exports, {
21
- AuthenticationError: () => AuthenticationError,
22
- ForbiddenError: () => ForbiddenError,
23
- PersistedQueryNotFoundError: () => PersistedQueryNotFoundError,
24
- PersistedQueryNotSupportedError: () => PersistedQueryNotSupportedError,
25
- RedwoodGraphQLError: () => RedwoodGraphQLError,
26
- SyntaxError: () => SyntaxError,
27
- UserInputError: () => UserInputError,
28
- ValidationError: () => ValidationError
29
- });
30
- module.exports = __toCommonJS(errors_exports);
31
- var import_graphql = require("graphql");
32
- class RedwoodGraphQLError extends import_graphql.GraphQLError {
1
+ import { GraphQLError } from "graphql";
2
+ class RedwoodGraphQLError extends GraphQLError {
33
3
  constructor(message, extensions, originalError) {
34
4
  super(message, {
35
5
  extensions: {
@@ -38,7 +8,7 @@ class RedwoodGraphQLError extends import_graphql.GraphQLError {
38
8
  },
39
9
  originalError
40
10
  });
41
- Object.setPrototypeOf(this, import_graphql.GraphQLError.prototype);
11
+ Object.setPrototypeOf(this, GraphQLError.prototype);
42
12
  }
43
13
  }
44
14
  class SyntaxError extends RedwoodGraphQLError {
@@ -85,8 +55,7 @@ class UserInputError extends RedwoodGraphQLError {
85
55
  Object.setPrototypeOf(this, UserInputError.prototype);
86
56
  }
87
57
  }
88
- // Annotate the CommonJS export names for ESM import in node:
89
- 0 && (module.exports = {
58
+ export {
90
59
  AuthenticationError,
91
60
  ForbiddenError,
92
61
  PersistedQueryNotFoundError,
@@ -95,4 +64,4 @@ class UserInputError extends RedwoodGraphQLError {
95
64
  SyntaxError,
96
65
  UserInputError,
97
66
  ValidationError
98
- });
67
+ };
@@ -1,5 +1,5 @@
1
1
  import type { APIGatewayProxyEvent, Context as LambdaContext } from 'aws-lambda';
2
- import type { GraphQLHandlerOptions } from '../types';
2
+ import type { GraphQLHandlerOptions } from '../types.js';
3
3
  /**
4
4
  * Creates an Enveloped GraphQL Server, configured with default Redwood plugins
5
5
  *
@@ -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;AAMnB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAErD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,0TAsB9B,qBAAqB,aA+Gb,oBAAoB,WAClB,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;AAMnB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAExD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,0TAsB9B,qBAAqB,aA+Gb,oBAAoB,WAClB,aAAa,KACrB,OAAO,CAAC,GAAG,CAcf,CAAA"}