@teambit/graphql 0.0.549 → 0.0.555

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,3 +1,8 @@
1
1
  import { HttpLink } from '@apollo/client';
2
2
  import type { WebSocketLink } from '@apollo/client/link/ws';
3
+ /**
4
+ * create a link which splits routes data depending on type of operation.
5
+ * @param httpLink http link for apollo graphql
6
+ * @param wsLink web socket link for apollo graphql
7
+ */
3
8
  export declare function createSplitLink(httpLink: HttpLink, wsLink: WebSocketLink): import("@apollo/client").ApolloLink;
@@ -1,5 +1,19 @@
1
1
  export declare class GraphQlError {
2
+ /**
3
+ * http status code of error
4
+ */
2
5
  readonly code: number;
6
+ /**
7
+ * error message of the error
8
+ */
3
9
  readonly message?: string | undefined;
4
- constructor(code: number, message?: string | undefined);
10
+ constructor(
11
+ /**
12
+ * http status code of error
13
+ */
14
+ code: number,
15
+ /**
16
+ * error message of the error
17
+ */
18
+ message?: string | undefined);
5
19
  }
@@ -26,20 +26,66 @@ export declare type GraphQLServerOptions = {
26
26
  onWsConnect?: Function;
27
27
  };
28
28
  export declare class GraphqlMain {
29
+ /**
30
+ * extension config
31
+ */
29
32
  readonly config: GraphQLConfig;
33
+ /**
34
+ * slot for registering graphql modules
35
+ */
30
36
  private moduleSlot;
37
+ /**
38
+ * harmony context.
39
+ */
31
40
  private context;
41
+ /**
42
+ * graphql pubsub. allows to emit events to clients.
43
+ */
32
44
  readonly pubsub: PubSub;
45
+ /**
46
+ * logger extension.
47
+ */
33
48
  readonly logger: Logger;
34
49
  private graphQLServerSlot;
35
- constructor(config: GraphQLConfig, moduleSlot: SchemaSlot, context: Harmony, pubsub: PubSub, logger: Logger, graphQLServerSlot: GraphQLServerSlot);
50
+ constructor(
51
+ /**
52
+ * extension config
53
+ */
54
+ config: GraphQLConfig,
55
+ /**
56
+ * slot for registering graphql modules
57
+ */
58
+ moduleSlot: SchemaSlot,
59
+ /**
60
+ * harmony context.
61
+ */
62
+ context: Harmony,
63
+ /**
64
+ * graphql pubsub. allows to emit events to clients.
65
+ */
66
+ pubsub: PubSub,
67
+ /**
68
+ * logger extension.
69
+ */
70
+ logger: Logger, graphQLServerSlot: GraphQLServerSlot);
36
71
  private modules;
37
72
  createServer(options: GraphQLServerOptions): Promise<Server>;
73
+ /**
74
+ * register a new graphql server.
75
+ */
38
76
  registerServer(server: GraphQLServer): this;
77
+ /**
78
+ * start a graphql server.
79
+ */
39
80
  listen(port?: number, server?: Server, app?: Express): Promise<void>;
81
+ /**
82
+ * register a new graphql module.
83
+ */
40
84
  register(schema: Schema): this;
41
85
  private getPort;
86
+ /** create Subscription server with different port */
42
87
  private createSubscription;
88
+ /** proxy ws Subscription server to avoid conflict with different websocket connections */
43
89
  private proxySubscription;
44
90
  private createRootModule;
45
91
  private buildModules;
@@ -2,9 +2,15 @@ import { ReactNode } from 'react';
2
2
  import { ApolloClient } from '@apollo/client';
3
3
  import type { NormalizedCacheObject } from '@apollo/client';
4
4
  import { GraphqlRenderLifecycle } from './render-lifecycle';
5
+ /**
6
+ * Type of gql client.
7
+ * Used to abstract Apollo client, so consumers could import the type from graphql.ui, and not have to depend on @apollo/client directly
8
+ * */
5
9
  export declare type GraphQLClient<T> = ApolloClient<T>;
6
10
  declare type ClientOptions = {
11
+ /** Preset in-memory cache with state (e.g. continue state from SSR) */
7
12
  state?: NormalizedCacheObject;
13
+ /** endpoint for websocket connections */
8
14
  subscriptionUri?: string;
9
15
  };
10
16
  export declare class GraphqlUI {
@@ -15,6 +21,9 @@ export declare class GraphqlUI {
15
21
  }): ApolloClient<NormalizedCacheObject>;
16
22
  private createCache;
17
23
  private createLink;
24
+ /**
25
+ * get the graphQL provider
26
+ */
18
27
  getProvider: ({ client, children }: {
19
28
  client: GraphQLClient<any>;
20
29
  children: ReactNode;
@@ -16,6 +16,10 @@ export declare class GraphqlRenderLifecycle implements RenderLifecycle<RenderCon
16
16
  port: number;
17
17
  } | undefined;
18
18
  }) => RenderContext | undefined;
19
+ /**
20
+ * Eagerly and recursively execute all gql queries in the app.
21
+ * Data will be available in gqlClient.extract()
22
+ */
19
23
  onBeforeRender: (ctx: RenderContext, app: ReactNode) => Promise<void>;
20
24
  serialize: (ctx?: RenderContext | undefined) => {
21
25
  json: string;
package/dist/schema.d.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  import type { DocumentNode } from 'graphql';
2
+ /**
3
+ * graphql schema for an extension.
4
+ */
2
5
  export declare type Schema = {
3
6
  typeDefs?: string | DocumentNode;
4
7
  resolvers?: {
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/graphql",
3
- "version": "0.0.549",
3
+ "version": "0.0.555",
4
4
  "homepage": "https://bit.dev/teambit/harmony/graphql",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.harmony",
8
8
  "name": "graphql",
9
- "version": "0.0.549"
9
+ "version": "0.0.555"
10
10
  },
11
11
  "dependencies": {
12
12
  "@teambit/harmony": "0.2.11",
@@ -32,12 +32,12 @@
32
32
  "bufferutil": "4.0.3",
33
33
  "@babel/runtime": "7.12.18",
34
34
  "core-js": "^3.0.0",
35
- "@teambit/cli": "0.0.380",
36
- "@teambit/logger": "0.0.465",
37
- "@teambit/toolbox.network.get-port": "0.0.86",
38
- "@teambit/preview": "0.0.549",
39
- "@teambit/ui": "0.0.549",
40
- "@teambit/ui-foundation.ui.is-browser": "0.0.459"
35
+ "@teambit/cli": "0.0.386",
36
+ "@teambit/logger": "0.0.471",
37
+ "@teambit/toolbox.network.get-port": "0.0.90",
38
+ "@teambit/preview": "0.0.555",
39
+ "@teambit/ui": "0.0.555",
40
+ "@teambit/ui-foundation.ui.is-browser": "0.0.463"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/cors": "2.8.10",
@@ -54,7 +54,7 @@
54
54
  "peerDependencies": {
55
55
  "@apollo/client": "^3.0.0",
56
56
  "graphql": "14.7.0",
57
- "@teambit/legacy": "1.0.76",
57
+ "@teambit/legacy": "1.0.172",
58
58
  "react-dom": "^16.8.0 || ^17.0.0",
59
59
  "react": "^16.8.0 || ^17.0.0"
60
60
  },
@@ -84,7 +84,7 @@
84
84
  "react": "-"
85
85
  },
86
86
  "peerDependencies": {
87
- "@teambit/legacy": "1.0.76",
87
+ "@teambit/legacy": "1.0.172",
88
88
  "react-dom": "^16.8.0 || ^17.0.0",
89
89
  "react": "^16.8.0 || ^17.0.0"
90
90
  }
package/tsconfig.json CHANGED
@@ -25,7 +25,6 @@
25
25
  "strict": true,
26
26
  "noImplicitAny": false,
27
27
  "rootDir": ".",
28
- "removeComments": true,
29
28
  "preserveConstEnums": true,
30
29
  "resolveJsonModule": true
31
30
  },