@graphql-hive/apollo 0.43.0-alpha-20251126142740-d265dc6d6d73bf62ec597dbe41409f466b9d9874 → 0.43.0-alpha-20251126165654-90ae40ea54454cfd1a275154a0e9f8bbcb338694

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,59 +4,45 @@ exports.createSupergraphSDLFetcher = exports.createServicesFetcher = exports.cre
4
4
  exports.createSupergraphManager = createSupergraphManager;
5
5
  exports.createHive = createHive;
6
6
  exports.useHive = useHive;
7
+ const tslib_1 = require("tslib");
7
8
  const graphql_1 = require("graphql");
8
9
  const core_1 = require("@graphql-hive/core");
9
- const logger_1 = require("@graphql-hive/logger");
10
10
  const version_js_1 = require("./version.js");
11
11
  var core_2 = require("@graphql-hive/core");
12
12
  Object.defineProperty(exports, "atLeastOnceSampler", { enumerable: true, get: function () { return core_2.atLeastOnceSampler; } });
13
13
  Object.defineProperty(exports, "createSchemaFetcher", { enumerable: true, get: function () { return core_2.createSchemaFetcher; } });
14
14
  Object.defineProperty(exports, "createServicesFetcher", { enumerable: true, get: function () { return core_2.createServicesFetcher; } });
15
15
  Object.defineProperty(exports, "createSupergraphSDLFetcher", { enumerable: true, get: function () { return core_2.createSupergraphSDLFetcher; } });
16
- function createSupergraphManager(args) {
17
- var _a, _b, _c, _d;
18
- const logger = (_a = args.logger) !== null && _a !== void 0 ? _a : new logger_1.Logger({ level: false });
19
- const pollIntervalInMs = (_b = args.pollIntervalInMs) !== null && _b !== void 0 ? _b : 30000;
20
- let endpoints = Array.isArray(args.endpoint) ? args.endpoint : [args.endpoint];
21
- const endpoint = endpoints.map(endpoint => endpoint.endsWith('/supergraph') ? endpoint : (0, core_1.joinUrl)(endpoint, 'supergraph'));
22
- const artifactsFetcher = (0, core_1.createCDNArtifactFetcher)({
23
- endpoint: endpoint,
24
- accessKey: args.key,
25
- client: {
26
- name: (_c = args.name) !== null && _c !== void 0 ? _c : '@graphql-hive/apollo',
27
- version: (_d = args.version) !== null && _d !== void 0 ? _d : version_js_1.version,
28
- },
29
- logger,
30
- fetch: args.fetchImplementation,
31
- circuitBreaker: args.circuitBreaker,
32
- });
16
+ function createSupergraphManager(_a) {
17
+ var { pollIntervalInMs } = _a, superGraphFetcherOptions = tslib_1.__rest(_a, ["pollIntervalInMs"]);
18
+ pollIntervalInMs = pollIntervalInMs !== null && pollIntervalInMs !== void 0 ? pollIntervalInMs : 30000;
19
+ const fetchSupergraph = (0, core_1.createSupergraphSDLFetcher)(superGraphFetcherOptions);
33
20
  let timer = null;
34
21
  return {
35
22
  async initialize(hooks) {
36
- const initialResult = await artifactsFetcher.fetch();
23
+ const initialResult = await fetchSupergraph();
37
24
  function poll() {
38
25
  timer = setTimeout(async () => {
39
26
  var _a;
40
27
  try {
41
- const result = await artifactsFetcher.fetch();
42
- if (result.contents) {
43
- (_a = hooks.update) === null || _a === void 0 ? void 0 : _a.call(hooks, result.contents);
28
+ const result = await fetchSupergraph();
29
+ if (result.supergraphSdl) {
30
+ (_a = hooks.update) === null || _a === void 0 ? void 0 : _a.call(hooks, result.supergraphSdl);
44
31
  }
45
32
  }
46
33
  catch (error) {
47
- logger.error({ error }, `Failed to update supergraph.`);
34
+ console.error(`Failed to update supergraph: ${error instanceof Error ? error.message : error}`);
48
35
  }
49
36
  poll();
50
37
  }, pollIntervalInMs);
51
38
  }
52
39
  poll();
53
40
  return {
54
- supergraphSdl: initialResult.contents,
41
+ supergraphSdl: initialResult.supergraphSdl,
55
42
  cleanup: async () => {
56
43
  if (timer) {
57
44
  clearTimeout(timer);
58
45
  }
59
- artifactsFetcher.dispose();
60
46
  },
61
47
  };
62
48
  },
package/cjs/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
- exports.version = '0.43.0-alpha-20251126142740-d265dc6d6d73bf62ec597dbe41409f466b9d9874';
4
+ exports.version = '0.43.0-alpha-20251126165654-90ae40ea54454cfd1a275154a0e9f8bbcb338694';
package/esm/index.js CHANGED
@@ -1,52 +1,38 @@
1
+ import { __rest } from "tslib";
1
2
  import { GraphQLError } from 'graphql';
2
- import { autoDisposeSymbol, createCDNArtifactFetcher, createHive as createHiveClient, isHiveClient, joinUrl, } from '@graphql-hive/core';
3
- import { Logger } from '@graphql-hive/logger';
3
+ import { autoDisposeSymbol, createHive as createHiveClient, createSupergraphSDLFetcher, isHiveClient, } from '@graphql-hive/core';
4
4
  import { version } from './version.js';
5
5
  export { atLeastOnceSampler, createSchemaFetcher, createServicesFetcher, createSupergraphSDLFetcher, } from '@graphql-hive/core';
6
- export function createSupergraphManager(args) {
7
- var _a, _b, _c, _d;
8
- const logger = (_a = args.logger) !== null && _a !== void 0 ? _a : new Logger({ level: false });
9
- const pollIntervalInMs = (_b = args.pollIntervalInMs) !== null && _b !== void 0 ? _b : 30000;
10
- let endpoints = Array.isArray(args.endpoint) ? args.endpoint : [args.endpoint];
11
- const endpoint = endpoints.map(endpoint => endpoint.endsWith('/supergraph') ? endpoint : joinUrl(endpoint, 'supergraph'));
12
- const artifactsFetcher = createCDNArtifactFetcher({
13
- endpoint: endpoint,
14
- accessKey: args.key,
15
- client: {
16
- name: (_c = args.name) !== null && _c !== void 0 ? _c : '@graphql-hive/apollo',
17
- version: (_d = args.version) !== null && _d !== void 0 ? _d : version,
18
- },
19
- logger,
20
- fetch: args.fetchImplementation,
21
- circuitBreaker: args.circuitBreaker,
22
- });
6
+ export function createSupergraphManager(_a) {
7
+ var { pollIntervalInMs } = _a, superGraphFetcherOptions = __rest(_a, ["pollIntervalInMs"]);
8
+ pollIntervalInMs = pollIntervalInMs !== null && pollIntervalInMs !== void 0 ? pollIntervalInMs : 30000;
9
+ const fetchSupergraph = createSupergraphSDLFetcher(superGraphFetcherOptions);
23
10
  let timer = null;
24
11
  return {
25
12
  async initialize(hooks) {
26
- const initialResult = await artifactsFetcher.fetch();
13
+ const initialResult = await fetchSupergraph();
27
14
  function poll() {
28
15
  timer = setTimeout(async () => {
29
16
  var _a;
30
17
  try {
31
- const result = await artifactsFetcher.fetch();
32
- if (result.contents) {
33
- (_a = hooks.update) === null || _a === void 0 ? void 0 : _a.call(hooks, result.contents);
18
+ const result = await fetchSupergraph();
19
+ if (result.supergraphSdl) {
20
+ (_a = hooks.update) === null || _a === void 0 ? void 0 : _a.call(hooks, result.supergraphSdl);
34
21
  }
35
22
  }
36
23
  catch (error) {
37
- logger.error({ error }, `Failed to update supergraph.`);
24
+ console.error(`Failed to update supergraph: ${error instanceof Error ? error.message : error}`);
38
25
  }
39
26
  poll();
40
27
  }, pollIntervalInMs);
41
28
  }
42
29
  poll();
43
30
  return {
44
- supergraphSdl: initialResult.contents,
31
+ supergraphSdl: initialResult.supergraphSdl,
45
32
  cleanup: async () => {
46
33
  if (timer) {
47
34
  clearTimeout(timer);
48
35
  }
49
- artifactsFetcher.dispose();
50
36
  },
51
37
  };
52
38
  },
package/esm/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '0.43.0-alpha-20251126142740-d265dc6d6d73bf62ec597dbe41409f466b9d9874';
1
+ export const version = '0.43.0-alpha-20251126165654-90ae40ea54454cfd1a275154a0e9f8bbcb338694';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-hive/apollo",
3
- "version": "0.43.0-alpha-20251126142740-d265dc6d6d73bf62ec597dbe41409f466b9d9874",
3
+ "version": "0.43.0-alpha-20251126165654-90ae40ea54454cfd1a275154a0e9f8bbcb338694",
4
4
  "description": "GraphQL Hive + Apollo Server",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
@@ -8,8 +8,7 @@
8
8
  "graphql": "^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
9
9
  },
10
10
  "dependencies": {
11
- "@graphql-hive/logger": "^1.0.9",
12
- "@graphql-hive/core": "0.16.0-alpha-20251126142740-d265dc6d6d73bf62ec597dbe41409f466b9d9874"
11
+ "@graphql-hive/core": "0.16.0-alpha-20251126165654-90ae40ea54454cfd1a275154a0e9f8bbcb338694"
13
12
  },
14
13
  "repository": {
15
14
  "type": "git",
@@ -1,43 +1,10 @@
1
1
  import type { ApolloServerPlugin } from '@apollo/server';
2
- import { HiveClient, HivePluginOptions, type CircuitBreakerConfiguration } from '@graphql-hive/core';
3
- import { Logger } from '@graphql-hive/logger';
2
+ import { HiveClient, HivePluginOptions, SupergraphSDLFetcherOptions } from '@graphql-hive/core';
4
3
  export { atLeastOnceSampler, createSchemaFetcher, createServicesFetcher, createSupergraphSDLFetcher, } from '@graphql-hive/core';
5
- /** @deprecated Use {CreateSupergraphManagerArgs} instead */
6
4
  export type { SupergraphSDLFetcherOptions } from '@graphql-hive/core';
7
- /**
8
- * Configuration for {createSupergraphManager}.
9
- */
10
- export type CreateSupergraphManagerArgs = {
11
- /**
12
- * The artifact endpoint to poll.
13
- * E.g. `https://cdn.graphql-hive.com/<uuid>/supergraph`
14
- */
15
- endpoint: string | [string, string];
16
- /**
17
- * The CDN access key for fetching artifact.
18
- */
19
- key: string;
20
- logger?: Logger;
21
- /**
22
- * The supergraph poll interval in milliseconds
23
- * Default: 30_000
24
- */
5
+ export declare function createSupergraphManager({ pollIntervalInMs, ...superGraphFetcherOptions }: {
25
6
  pollIntervalInMs?: number;
26
- /** Circuit breaker configuration override. */
27
- circuitBreaker?: CircuitBreakerConfiguration;
28
- fetchImplementation?: typeof fetch;
29
- /**
30
- * Client name override
31
- * Default: `@graphql-hive/apollo`
32
- */
33
- name?: string;
34
- /**
35
- * Client version override
36
- * Default: currents package version
37
- */
38
- version?: string;
39
- };
40
- export declare function createSupergraphManager(args: CreateSupergraphManagerArgs): {
7
+ } & SupergraphSDLFetcherOptions): {
41
8
  initialize(hooks: {
42
9
  update(supergraphSdl: string): void;
43
10
  }): Promise<{
@@ -1,43 +1,10 @@
1
1
  import type { ApolloServerPlugin } from '@apollo/server';
2
- import { HiveClient, HivePluginOptions, type CircuitBreakerConfiguration } from '@graphql-hive/core';
3
- import { Logger } from '@graphql-hive/logger';
2
+ import { HiveClient, HivePluginOptions, SupergraphSDLFetcherOptions } from '@graphql-hive/core';
4
3
  export { atLeastOnceSampler, createSchemaFetcher, createServicesFetcher, createSupergraphSDLFetcher, } from '@graphql-hive/core';
5
- /** @deprecated Use {CreateSupergraphManagerArgs} instead */
6
4
  export type { SupergraphSDLFetcherOptions } from '@graphql-hive/core';
7
- /**
8
- * Configuration for {createSupergraphManager}.
9
- */
10
- export type CreateSupergraphManagerArgs = {
11
- /**
12
- * The artifact endpoint to poll.
13
- * E.g. `https://cdn.graphql-hive.com/<uuid>/supergraph`
14
- */
15
- endpoint: string | [string, string];
16
- /**
17
- * The CDN access key for fetching artifact.
18
- */
19
- key: string;
20
- logger?: Logger;
21
- /**
22
- * The supergraph poll interval in milliseconds
23
- * Default: 30_000
24
- */
5
+ export declare function createSupergraphManager({ pollIntervalInMs, ...superGraphFetcherOptions }: {
25
6
  pollIntervalInMs?: number;
26
- /** Circuit breaker configuration override. */
27
- circuitBreaker?: CircuitBreakerConfiguration;
28
- fetchImplementation?: typeof fetch;
29
- /**
30
- * Client name override
31
- * Default: `@graphql-hive/apollo`
32
- */
33
- name?: string;
34
- /**
35
- * Client version override
36
- * Default: currents package version
37
- */
38
- version?: string;
39
- };
40
- export declare function createSupergraphManager(args: CreateSupergraphManagerArgs): {
7
+ } & SupergraphSDLFetcherOptions): {
41
8
  initialize(hooks: {
42
9
  update(supergraphSdl: string): void;
43
10
  }): Promise<{
@@ -1,2 +1,2 @@
1
- export declare const version = "0.43.0-alpha-20251126142740-d265dc6d6d73bf62ec597dbe41409f466b9d9874";
1
+ export declare const version = "0.43.0-alpha-20251126165654-90ae40ea54454cfd1a275154a0e9f8bbcb338694";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,2 +1,2 @@
1
- export declare const version = "0.43.0-alpha-20251126142740-d265dc6d6d73bf62ec597dbe41409f466b9d9874";
1
+ export declare const version = "0.43.0-alpha-20251126165654-90ae40ea54454cfd1a275154a0e9f8bbcb338694";
2
2
  //# sourceMappingURL=version.d.ts.map