@graphql-mesh/runtime 1.0.0-alpha-3fc47d119.0 → 1.0.0-alpha-20230420181317-a95037648

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.
package/package.json CHANGED
@@ -1,21 +1,24 @@
1
1
  {
2
2
  "name": "@graphql-mesh/runtime",
3
- "version": "1.0.0-alpha-3fc47d119.0",
3
+ "version": "1.0.0-alpha-20230420181317-a95037648",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
- "@graphql-mesh/types": "0.79.0-alpha-3fc47d119.0",
7
- "@graphql-mesh/utils": "1.0.0-alpha-3fc47d119.0",
8
- "graphql": "*"
6
+ "@graphql-mesh/cross-helpers": "^0.3.4",
7
+ "@graphql-mesh/types": "1.0.0-alpha-20230420181317-a95037648",
8
+ "@graphql-mesh/utils": "1.0.0-alpha-20230420181317-a95037648",
9
+ "@graphql-tools/utils": "^9.2.1",
10
+ "graphql": "*",
11
+ "tslib": "^2.4.0"
9
12
  },
10
13
  "dependencies": {
11
- "@envelop/core": "2.4.0",
12
- "@envelop/extended-validation": "1.7.0",
13
- "@graphql-mesh/string-interpolation": "0.3.0",
14
- "@graphql-tools/batch-delegate": "8.3.0",
15
- "@graphql-tools/delegate": "8.8.0",
16
- "@graphql-tools/utils": "8.8.0",
17
- "@graphql-tools/wrap": "8.5.0",
18
- "tslib": "^2.4.0"
14
+ "@envelop/core": "3.0.6",
15
+ "@envelop/extended-validation": "2.0.6",
16
+ "@graphql-mesh/string-interpolation": "0.4.4",
17
+ "@graphql-tools/batch-delegate": "8.4.25",
18
+ "@graphql-tools/batch-execute": "8.5.19",
19
+ "@graphql-tools/delegate": "9.0.32",
20
+ "@graphql-tools/wrap": "9.4.2",
21
+ "@whatwg-node/fetch": "^0.8.3"
19
22
  },
20
23
  "repository": {
21
24
  "type": "git",
@@ -23,21 +26,28 @@
23
26
  "directory": "packages/runtime"
24
27
  },
25
28
  "license": "MIT",
26
- "main": "index.js",
27
- "module": "index.mjs",
28
- "typings": "index.d.ts",
29
+ "main": "cjs/index.js",
30
+ "module": "esm/index.js",
31
+ "typings": "typings/index.d.ts",
29
32
  "typescript": {
30
- "definition": "index.d.ts"
33
+ "definition": "typings/index.d.ts"
31
34
  },
35
+ "type": "module",
32
36
  "exports": {
33
37
  ".": {
34
- "require": "./index.js",
35
- "import": "./index.mjs"
36
- },
37
- "./*": {
38
- "require": "./*.js",
39
- "import": "./*.mjs"
38
+ "require": {
39
+ "types": "./typings/index.d.cts",
40
+ "default": "./cjs/index.js"
41
+ },
42
+ "import": {
43
+ "types": "./typings/index.d.ts",
44
+ "default": "./esm/index.js"
45
+ },
46
+ "default": {
47
+ "types": "./typings/index.d.ts",
48
+ "default": "./esm/index.js"
49
+ }
40
50
  },
41
51
  "./package.json": "./package.json"
42
52
  }
43
- }
53
+ }
@@ -0,0 +1,2 @@
1
+ export declare const MESH_CONTEXT_SYMBOL: unique symbol;
2
+ export declare const MESH_API_CONTEXT_SYMBOL: unique symbol;
@@ -0,0 +1,22 @@
1
+ import { DocumentNode, GraphQLSchema } from 'graphql';
2
+ import { envelop, Plugin } from '@envelop/core';
3
+ import { KeyValueCache, Logger, MeshFetch, MeshPlugin, MeshPubSub, RawSourceOutput } from '@graphql-mesh/types';
4
+ import { ExecuteMeshFn, GetMeshOptions, MeshExecutor, SubscribeMeshFn } from './types.cjs';
5
+ type SdkRequester = (document: DocumentNode, variables?: any, operationContext?: any) => any;
6
+ export interface MeshInstance {
7
+ execute: ExecuteMeshFn;
8
+ subscribe: SubscribeMeshFn;
9
+ schema: GraphQLSchema;
10
+ createExecutor(globalContext: any): MeshExecutor;
11
+ rawSources: RawSourceOutput[];
12
+ destroy(): void;
13
+ pubsub: MeshPubSub;
14
+ cache: KeyValueCache;
15
+ logger: Logger;
16
+ plugins: Plugin[];
17
+ getEnveloped: ReturnType<typeof envelop>;
18
+ sdkRequesterFactory(globalContext: any): SdkRequester;
19
+ }
20
+ export declare function wrapFetchWithPlugins(plugins: MeshPlugin<any>[]): MeshFetch;
21
+ export declare function getMesh(options: GetMeshOptions): Promise<MeshInstance>;
22
+ export {};
@@ -0,0 +1,22 @@
1
+ import { DocumentNode, GraphQLSchema } from 'graphql';
2
+ import { envelop, Plugin } from '@envelop/core';
3
+ import { KeyValueCache, Logger, MeshFetch, MeshPlugin, MeshPubSub, RawSourceOutput } from '@graphql-mesh/types';
4
+ import { ExecuteMeshFn, GetMeshOptions, MeshExecutor, SubscribeMeshFn } from './types.js';
5
+ type SdkRequester = (document: DocumentNode, variables?: any, operationContext?: any) => any;
6
+ export interface MeshInstance {
7
+ execute: ExecuteMeshFn;
8
+ subscribe: SubscribeMeshFn;
9
+ schema: GraphQLSchema;
10
+ createExecutor(globalContext: any): MeshExecutor;
11
+ rawSources: RawSourceOutput[];
12
+ destroy(): void;
13
+ pubsub: MeshPubSub;
14
+ cache: KeyValueCache;
15
+ logger: Logger;
16
+ plugins: Plugin[];
17
+ getEnveloped: ReturnType<typeof envelop>;
18
+ sdkRequesterFactory(globalContext: any): SdkRequester;
19
+ }
20
+ export declare function wrapFetchWithPlugins(plugins: MeshPlugin<any>[]): MeshFetch;
21
+ export declare function getMesh(options: GetMeshOptions): Promise<MeshInstance>;
22
+ export {};
@@ -0,0 +1,3 @@
1
+ import { GraphQLSchema } from 'graphql';
2
+ import { Logger, OnDelegateHook, RawSourceOutput } from '@graphql-mesh/types';
3
+ export declare function getInContextSDK(unifiedSchema: GraphQLSchema, rawSources: RawSourceOutput[], logger: Logger, onDelegateHooks: OnDelegateHook<any>[]): Promise<Record<string, any>>;
@@ -0,0 +1,3 @@
1
+ import { GraphQLSchema } from 'graphql';
2
+ import { Logger, OnDelegateHook, RawSourceOutput } from '@graphql-mesh/types';
3
+ export declare function getInContextSDK(unifiedSchema: GraphQLSchema, rawSources: RawSourceOutput[], logger: Logger, onDelegateHooks: OnDelegateHook<any>[]): Promise<Record<string, any>>;
@@ -0,0 +1,3 @@
1
+ export * from './get-mesh.cjs';
2
+ export * from './types.cjs';
3
+ export * from './useSubschema.cjs';
@@ -0,0 +1,3 @@
1
+ export * from './get-mesh.js';
2
+ export * from './types.js';
3
+ export * from './useSubschema.js';
@@ -0,0 +1,42 @@
1
+ import { DocumentNode, ExecutionResult } from 'graphql';
2
+ import { envelop } from '@envelop/core';
3
+ import { GraphQLOperation, KeyValueCache, Logger, MeshFetch, MeshHandler, MeshMerger, MeshPubSub, MeshTransform, YamlConfig } from '@graphql-mesh/types';
4
+ import { IResolvers, Source } from '@graphql-tools/utils';
5
+ import { MESH_CONTEXT_SYMBOL } from './constants.cjs';
6
+ import { MeshInstance } from './get-mesh.cjs';
7
+ export type GetMeshOptions = {
8
+ sources: MeshResolvedSource[];
9
+ transforms?: MeshTransform[];
10
+ additionalTypeDefs?: DocumentNode[];
11
+ additionalResolvers?: IResolvers | IResolvers[];
12
+ cache: KeyValueCache;
13
+ pubsub?: MeshPubSub;
14
+ merger: MeshMerger;
15
+ logger?: Logger;
16
+ additionalEnvelopPlugins?: Parameters<typeof envelop>[0]['plugins'];
17
+ documents?: Source[];
18
+ fetchFn?: MeshFetch;
19
+ };
20
+ export type MeshResolvedSource = {
21
+ name: string;
22
+ handler: MeshHandler;
23
+ transforms?: MeshTransform[];
24
+ };
25
+ export type ExecuteMeshFn<TData = any, TVariables = any, TContext = any, TRootValue = any> = (document: GraphQLOperation<TData, TVariables>, variables: TVariables, context?: TContext, rootValue?: TRootValue, operationName?: string) => Promise<ExecutionResult<TData>>;
26
+ export type SubscribeMeshFn<TVariables = any, TContext = any, TRootValue = any, TData = any> = (document: GraphQLOperation<TData, TVariables>, variables?: TVariables, context?: TContext, rootValue?: TRootValue, operationName?: string) => Promise<ExecutionResult<TData> | AsyncIterable<ExecutionResult<TData>>>;
27
+ export type MeshContext = {
28
+ [MESH_CONTEXT_SYMBOL]: true;
29
+ } & {
30
+ pubsub: MeshPubSub;
31
+ cache: KeyValueCache;
32
+ logger: Logger;
33
+ };
34
+ export interface ServeMeshOptions {
35
+ baseDir: string;
36
+ getBuiltMesh: () => Promise<MeshInstance>;
37
+ logger: Logger;
38
+ rawServeConfig: YamlConfig.Config['serve'];
39
+ argsPort?: number;
40
+ playgroundTitle?: string;
41
+ }
42
+ export type MeshExecutor = <TData, TVariables, TContext, TRootValue>(documentOrSDL: GraphQLOperation<TData, TVariables>, variables?: TVariables, context?: TContext, rootValue?: TRootValue, operationName?: string) => Promise<TData | AsyncIterable<TData>>;
@@ -0,0 +1,42 @@
1
+ import { DocumentNode, ExecutionResult } from 'graphql';
2
+ import { envelop } from '@envelop/core';
3
+ import { GraphQLOperation, KeyValueCache, Logger, MeshFetch, MeshHandler, MeshMerger, MeshPubSub, MeshTransform, YamlConfig } from '@graphql-mesh/types';
4
+ import { IResolvers, Source } from '@graphql-tools/utils';
5
+ import { MESH_CONTEXT_SYMBOL } from './constants.js';
6
+ import { MeshInstance } from './get-mesh.js';
7
+ export type GetMeshOptions = {
8
+ sources: MeshResolvedSource[];
9
+ transforms?: MeshTransform[];
10
+ additionalTypeDefs?: DocumentNode[];
11
+ additionalResolvers?: IResolvers | IResolvers[];
12
+ cache: KeyValueCache;
13
+ pubsub?: MeshPubSub;
14
+ merger: MeshMerger;
15
+ logger?: Logger;
16
+ additionalEnvelopPlugins?: Parameters<typeof envelop>[0]['plugins'];
17
+ documents?: Source[];
18
+ fetchFn?: MeshFetch;
19
+ };
20
+ export type MeshResolvedSource = {
21
+ name: string;
22
+ handler: MeshHandler;
23
+ transforms?: MeshTransform[];
24
+ };
25
+ export type ExecuteMeshFn<TData = any, TVariables = any, TContext = any, TRootValue = any> = (document: GraphQLOperation<TData, TVariables>, variables: TVariables, context?: TContext, rootValue?: TRootValue, operationName?: string) => Promise<ExecutionResult<TData>>;
26
+ export type SubscribeMeshFn<TVariables = any, TContext = any, TRootValue = any, TData = any> = (document: GraphQLOperation<TData, TVariables>, variables?: TVariables, context?: TContext, rootValue?: TRootValue, operationName?: string) => Promise<ExecutionResult<TData> | AsyncIterable<ExecutionResult<TData>>>;
27
+ export type MeshContext = {
28
+ [MESH_CONTEXT_SYMBOL]: true;
29
+ } & {
30
+ pubsub: MeshPubSub;
31
+ cache: KeyValueCache;
32
+ logger: Logger;
33
+ };
34
+ export interface ServeMeshOptions {
35
+ baseDir: string;
36
+ getBuiltMesh: () => Promise<MeshInstance>;
37
+ logger: Logger;
38
+ rawServeConfig: YamlConfig.Config['serve'];
39
+ argsPort?: number;
40
+ playgroundTitle?: string;
41
+ }
42
+ export type MeshExecutor = <TData, TVariables, TContext, TRootValue>(documentOrSDL: GraphQLOperation<TData, TVariables>, variables?: TVariables, context?: TContext, rootValue?: TRootValue, operationName?: string) => Promise<TData | AsyncIterable<TData>>;
@@ -0,0 +1,3 @@
1
+ import { Plugin } from '@envelop/core';
2
+ import { Subschema } from '@graphql-tools/delegate';
3
+ export declare function useSubschema(subschema: Subschema): Plugin;
@@ -0,0 +1,3 @@
1
+ import { Plugin } from '@envelop/core';
2
+ import { Subschema } from '@graphql-tools/delegate';
3
+ export declare function useSubschema(subschema: Subschema): Plugin;
package/get-mesh.d.ts DELETED
@@ -1,18 +0,0 @@
1
- import { GraphQLSchema, DocumentNode } from 'graphql';
2
- import { ExecuteMeshFn, GetMeshOptions, SubscribeMeshFn } from './types';
3
- import { MeshPubSub, KeyValueCache, RawSourceOutput, Logger } from '@graphql-mesh/types';
4
- import { envelop, PluginOrDisabledPlugin } from '@envelop/core';
5
- export interface MeshInstance {
6
- execute: ExecuteMeshFn;
7
- subscribe: SubscribeMeshFn;
8
- schema: GraphQLSchema;
9
- rawSources: RawSourceOutput[];
10
- destroy(): void;
11
- pubsub: MeshPubSub;
12
- cache: KeyValueCache;
13
- logger: Logger;
14
- plugins: PluginOrDisabledPlugin[];
15
- getEnveloped: ReturnType<typeof envelop>;
16
- sdkRequesterFactory: (globalContext: any) => (document: DocumentNode, variables?: any, operationContext?: any) => any;
17
- }
18
- export declare function getMesh(options: GetMeshOptions): Promise<MeshInstance>;
@@ -1,3 +0,0 @@
1
- import { Logger, RawSourceOutput } from '@graphql-mesh/types';
2
- import { GraphQLSchema } from 'graphql';
3
- export declare function getInContextSDK(unifiedSchema: GraphQLSchema, rawSources: RawSourceOutput[], logger: Logger): Promise<Record<string, any>>;
package/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from './get-mesh';
2
- export * from './types';
3
- export * from './useSubschema';