@graphql-tools/github-loader 7.3.7-alpha-f5ea1eb4.0 → 7.3.7-alpha-9d6b1e75.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.
package/cjs/index.js CHANGED
@@ -4,7 +4,7 @@ exports.GithubLoader = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const utils_1 = require("@graphql-tools/utils");
6
6
  const graphql_tag_pluck_1 = require("@graphql-tools/graphql-tag-pluck");
7
- const graphql_1 = require("@graphql-tools/graphql");
7
+ const graphql_1 = require("graphql");
8
8
  const sync_fetch_1 = tslib_1.__importDefault(require("@ardatan/sync-fetch"));
9
9
  const fetch_1 = require("@whatwg-node/fetch");
10
10
  // github:owner/name#ref:path/to/file
package/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { parseGraphQLSDL, parseGraphQLJSON } from '@graphql-tools/utils';
2
2
  import { gqlPluckFromCodeStringSync } from '@graphql-tools/graphql-tag-pluck';
3
- import { parse } from '@graphql-tools/graphql';
3
+ import { parse } from 'graphql';
4
4
  import syncFetch from '@ardatan/sync-fetch';
5
5
  import { fetch as asyncFetch } from '@whatwg-node/fetch';
6
6
  // github:owner/name#ref:path/to/file
package/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "@graphql-tools/github-loader",
3
- "version": "7.3.7-alpha-f5ea1eb4.0",
3
+ "version": "7.3.7-alpha-9d6b1e75.0",
4
4
  "description": "A set of utils for faster development of GraphQL tools",
5
5
  "sideEffects": false,
6
+ "peerDependencies": {
7
+ "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
8
+ },
6
9
  "dependencies": {
7
10
  "@ardatan/sync-fetch": "0.0.1",
8
- "@graphql-tools/utils": "8.9.1-alpha-f5ea1eb4.0",
9
- "@graphql-tools/graphql-tag-pluck": "7.3.2-alpha-f5ea1eb4.0",
11
+ "@graphql-tools/utils": "8.9.1-alpha-9d6b1e75.0",
12
+ "@graphql-tools/graphql-tag-pluck": "7.3.2-alpha-9d6b1e75.0",
10
13
  "@whatwg-node/fetch": "^0.2.4",
11
- "@graphql-tools/graphql": "0.1.0-alpha-f5ea1eb4.0",
12
- "sync-fetch": "0.4.1",
13
14
  "tslib": "^2.4.0"
14
15
  },
15
16
  "repository": {
@@ -29,7 +30,7 @@
29
30
  "exports": {
30
31
  ".": {
31
32
  "require": {
32
- "types": "./typings/index.d.ts",
33
+ "types": "./typings/index.d.cts",
33
34
  "default": "./cjs/index.js"
34
35
  },
35
36
  "import": {
@@ -43,7 +44,7 @@
43
44
  },
44
45
  "./*": {
45
46
  "require": {
46
- "types": "./typings/*.d.ts",
47
+ "types": "./typings/*.d.cts",
47
48
  "default": "./cjs/*.js"
48
49
  },
49
50
  "import": {
@@ -0,0 +1,51 @@
1
+ import { Loader, BaseLoaderOptions, Source } from '@graphql-tools/utils';
2
+ import { GraphQLTagPluckOptions } from '@graphql-tools/graphql-tag-pluck';
3
+ import syncFetch from '@ardatan/sync-fetch';
4
+ import { fetch as asyncFetch } from '@whatwg-node/fetch';
5
+ /**
6
+ * Additional options for loading from GitHub
7
+ */
8
+ export interface GithubLoaderOptions extends BaseLoaderOptions {
9
+ /**
10
+ * A GitHub access token
11
+ */
12
+ token: string;
13
+ /**
14
+ * Additional options to pass to `graphql-tag-pluck`
15
+ */
16
+ pluckConfig?: GraphQLTagPluckOptions;
17
+ customFetch?: typeof asyncFetch | typeof syncFetch;
18
+ }
19
+ /**
20
+ * This loader loads a file from GitHub.
21
+ *
22
+ * ```js
23
+ * const typeDefs = await loadTypedefs('github:githubUser/githubRepo#branchName:path/to/file.ts', {
24
+ * loaders: [new GithubLoader()],
25
+ * token: YOUR_GITHUB_TOKEN,
26
+ * })
27
+ * ```
28
+ */
29
+ export declare class GithubLoader implements Loader<GithubLoaderOptions> {
30
+ canLoad(pointer: string): Promise<boolean>;
31
+ canLoadSync(pointer: string): boolean;
32
+ load(pointer: string, options: GithubLoaderOptions): Promise<Source[]>;
33
+ loadSync(pointer: string, options: GithubLoaderOptions): Source[];
34
+ handleResponse({ pointer, path, options, response, status, }: {
35
+ pointer: string;
36
+ path: string;
37
+ options: any;
38
+ response: any;
39
+ status: number;
40
+ }): Source[] | {
41
+ location: string | undefined;
42
+ document: import("graphql").DocumentNode;
43
+ }[];
44
+ prepareRequest({ owner, ref, path, name, options, }: {
45
+ owner: string;
46
+ ref: string;
47
+ path: string;
48
+ name: string;
49
+ options: GithubLoaderOptions;
50
+ }): RequestInit;
51
+ }
@@ -39,7 +39,7 @@ export declare class GithubLoader implements Loader<GithubLoaderOptions> {
39
39
  status: number;
40
40
  }): Source[] | {
41
41
  location: string | undefined;
42
- document: import("@graphql-tools/graphql").DocumentNode;
42
+ document: import("graphql").DocumentNode;
43
43
  }[];
44
44
  prepareRequest({ owner, ref, path, name, options, }: {
45
45
  owner: string;