@graphql-hive/apollo 0.46.0-alpha-20260105114825-21a288f5ce8422d00716d16112b4066f405342dc → 0.46.0-alpha-20260105123501-c38fb0042e619b832de412eb0f8c6ef34a9c23d6

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
@@ -70,58 +70,12 @@ function addRequestWithHeaders(context, http) {
70
70
  }
71
71
  return context;
72
72
  }
73
- function getLoggerFromContext(ctx) {
74
- if (ctx === null || ctx === void 0 ? void 0 : ctx.logger) {
75
- return new logger_1.Logger({
76
- level: 'debug',
77
- writers: [
78
- {
79
- write(level, attrs, msg) {
80
- const payload = attrs ? Object.assign({ msg }, attrs) : msg;
81
- switch (level) {
82
- case 'trace':
83
- case 'debug':
84
- ctx.logger.debug(payload);
85
- break;
86
- case 'info':
87
- ctx.logger.info(payload);
88
- break;
89
- case 'warn':
90
- ctx.logger.warn(payload);
91
- break;
92
- case 'error':
93
- ctx.logger.error(payload);
94
- break;
95
- }
96
- },
97
- },
98
- ],
99
- });
100
- }
101
- return undefined;
102
- }
103
- function getPersistedDocumentsCacheFromContext(ctx) {
104
- if (ctx === null || ctx === void 0 ? void 0 : ctx.cache) {
105
- return {
106
- async get(key) {
107
- const value = await ctx.cache.get(key);
108
- return value != null ? value : null;
109
- },
110
- set(key, value, options) {
111
- return ctx.cache.set(key, value, options);
112
- },
113
- };
114
- }
115
- return undefined;
116
- }
117
- function createHive(clientOrOptions, ctx) {
118
- const persistedDocumentsCache = getPersistedDocumentsCacheFromContext(ctx);
119
- return (0, core_1.createHive)(Object.assign(Object.assign({ logger: getLoggerFromContext(ctx) }, clientOrOptions), { agent: Object.assign({ name: 'hive-client-apollo', version: version_js_1.version }, clientOrOptions.agent), experimental__persistedDocuments: clientOrOptions.experimental__persistedDocuments
120
- ? Object.assign(Object.assign({}, clientOrOptions.experimental__persistedDocuments), { layer2Cache: persistedDocumentsCache || clientOrOptions.experimental__persistedDocuments.layer2Cache
121
- ? Object.assign({ cache: persistedDocumentsCache }, (clientOrOptions.experimental__persistedDocuments.layer2Cache || {})) : undefined }) : undefined }));
73
+ function createHive(clientOrOptions) {
74
+ return (0, core_1.createHive)(Object.assign(Object.assign({}, clientOrOptions), { agent: Object.assign({ name: 'hive-client-yoga', version: version_js_1.version }, clientOrOptions.agent) }));
122
75
  }
123
76
  function useHive(clientOrOptions) {
124
- let hive;
77
+ const hive = (0, core_1.isHiveClient)(clientOrOptions) ? clientOrOptions : createHive(clientOrOptions);
78
+ void hive.info();
125
79
  return {
126
80
  requestDidStart(context) {
127
81
  var _a;
@@ -329,8 +283,6 @@ function useHive(clientOrOptions) {
329
283
  })();
330
284
  },
331
285
  serverWillStart(ctx) {
332
- hive = (0, core_1.isHiveClient)(clientOrOptions) ? clientOrOptions : createHive(clientOrOptions, ctx);
333
- void hive.info();
334
286
  // `engine` does not exist in v3
335
287
  const isLegacyV0 = 'engine' in ctx;
336
288
  hive.reportSchema({ schema: ctx.schema });
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.46.0-alpha-20260105114825-21a288f5ce8422d00716d16112b4066f405342dc';
4
+ exports.version = '0.46.0-alpha-20260105123501-c38fb0042e619b832de412eb0f8c6ef34a9c23d6';
package/esm/index.js CHANGED
@@ -60,58 +60,12 @@ function addRequestWithHeaders(context, http) {
60
60
  }
61
61
  return context;
62
62
  }
63
- function getLoggerFromContext(ctx) {
64
- if (ctx === null || ctx === void 0 ? void 0 : ctx.logger) {
65
- return new Logger({
66
- level: 'debug',
67
- writers: [
68
- {
69
- write(level, attrs, msg) {
70
- const payload = attrs ? Object.assign({ msg }, attrs) : msg;
71
- switch (level) {
72
- case 'trace':
73
- case 'debug':
74
- ctx.logger.debug(payload);
75
- break;
76
- case 'info':
77
- ctx.logger.info(payload);
78
- break;
79
- case 'warn':
80
- ctx.logger.warn(payload);
81
- break;
82
- case 'error':
83
- ctx.logger.error(payload);
84
- break;
85
- }
86
- },
87
- },
88
- ],
89
- });
90
- }
91
- return undefined;
92
- }
93
- function getPersistedDocumentsCacheFromContext(ctx) {
94
- if (ctx === null || ctx === void 0 ? void 0 : ctx.cache) {
95
- return {
96
- async get(key) {
97
- const value = await ctx.cache.get(key);
98
- return value != null ? value : null;
99
- },
100
- set(key, value, options) {
101
- return ctx.cache.set(key, value, options);
102
- },
103
- };
104
- }
105
- return undefined;
106
- }
107
- export function createHive(clientOrOptions, ctx) {
108
- const persistedDocumentsCache = getPersistedDocumentsCacheFromContext(ctx);
109
- return createHiveClient(Object.assign(Object.assign({ logger: getLoggerFromContext(ctx) }, clientOrOptions), { agent: Object.assign({ name: 'hive-client-apollo', version }, clientOrOptions.agent), experimental__persistedDocuments: clientOrOptions.experimental__persistedDocuments
110
- ? Object.assign(Object.assign({}, clientOrOptions.experimental__persistedDocuments), { layer2Cache: persistedDocumentsCache || clientOrOptions.experimental__persistedDocuments.layer2Cache
111
- ? Object.assign({ cache: persistedDocumentsCache }, (clientOrOptions.experimental__persistedDocuments.layer2Cache || {})) : undefined }) : undefined }));
63
+ export function createHive(clientOrOptions) {
64
+ return createHiveClient(Object.assign(Object.assign({}, clientOrOptions), { agent: Object.assign({ name: 'hive-client-yoga', version }, clientOrOptions.agent) }));
112
65
  }
113
66
  export function useHive(clientOrOptions) {
114
- let hive;
67
+ const hive = isHiveClient(clientOrOptions) ? clientOrOptions : createHive(clientOrOptions);
68
+ void hive.info();
115
69
  return {
116
70
  requestDidStart(context) {
117
71
  var _a;
@@ -319,8 +273,6 @@ export function useHive(clientOrOptions) {
319
273
  })();
320
274
  },
321
275
  serverWillStart(ctx) {
322
- hive = isHiveClient(clientOrOptions) ? clientOrOptions : createHive(clientOrOptions, ctx);
323
- void hive.info();
324
276
  // `engine` does not exist in v3
325
277
  const isLegacyV0 = 'engine' in ctx;
326
278
  hive.reportSchema({ schema: ctx.schema });
package/esm/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '0.46.0-alpha-20260105114825-21a288f5ce8422d00716d16112b4066f405342dc';
1
+ export const version = '0.46.0-alpha-20260105123501-c38fb0042e619b832de412eb0f8c6ef34a9c23d6';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-hive/apollo",
3
- "version": "0.46.0-alpha-20260105114825-21a288f5ce8422d00716d16112b4066f405342dc",
3
+ "version": "0.46.0-alpha-20260105123501-c38fb0042e619b832de412eb0f8c6ef34a9c23d6",
4
4
  "description": "GraphQL Hive + Apollo Server",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "dependencies": {
11
11
  "@graphql-hive/logger": "^1.0.9",
12
- "@graphql-hive/core": "0.19.0-alpha-20260105114825-21a288f5ce8422d00716d16112b4066f405342dc"
12
+ "@graphql-hive/core": "0.19.0-alpha-20260105123501-c38fb0042e619b832de412eb0f8c6ef34a9c23d6"
13
13
  },
14
14
  "repository": {
15
15
  "type": "git",
@@ -1,4 +1,4 @@
1
- import type { ApolloServerPlugin, GraphQLServerContext } from '@apollo/server';
1
+ import type { ApolloServerPlugin } from '@apollo/server';
2
2
  import { HiveClient, HivePluginOptions, type CircuitBreakerConfiguration } from '@graphql-hive/core';
3
3
  import { Logger } from '@graphql-hive/logger';
4
4
  export { atLeastOnceSampler, createSchemaFetcher, createServicesFetcher, createSupergraphSDLFetcher, } from '@graphql-hive/core';
@@ -45,6 +45,6 @@ export declare function createSupergraphManager(args: CreateSupergraphManagerArg
45
45
  cleanup?: () => Promise<void>;
46
46
  }>;
47
47
  };
48
- export declare function createHive(clientOrOptions: HivePluginOptions, ctx?: GraphQLServerContext): HiveClient;
48
+ export declare function createHive(clientOrOptions: HivePluginOptions): HiveClient;
49
49
  export declare function useHive(clientOrOptions: HiveClient | HivePluginOptions): ApolloServerPlugin;
50
50
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- import type { ApolloServerPlugin, GraphQLServerContext } from '@apollo/server';
1
+ import type { ApolloServerPlugin } from '@apollo/server';
2
2
  import { HiveClient, HivePluginOptions, type CircuitBreakerConfiguration } from '@graphql-hive/core';
3
3
  import { Logger } from '@graphql-hive/logger';
4
4
  export { atLeastOnceSampler, createSchemaFetcher, createServicesFetcher, createSupergraphSDLFetcher, } from '@graphql-hive/core';
@@ -45,6 +45,6 @@ export declare function createSupergraphManager(args: CreateSupergraphManagerArg
45
45
  cleanup?: () => Promise<void>;
46
46
  }>;
47
47
  };
48
- export declare function createHive(clientOrOptions: HivePluginOptions, ctx?: GraphQLServerContext): HiveClient;
48
+ export declare function createHive(clientOrOptions: HivePluginOptions): HiveClient;
49
49
  export declare function useHive(clientOrOptions: HiveClient | HivePluginOptions): ApolloServerPlugin;
50
50
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- export declare const version = "0.46.0-alpha-20260105114825-21a288f5ce8422d00716d16112b4066f405342dc";
1
+ export declare const version = "0.46.0-alpha-20260105123501-c38fb0042e619b832de412eb0f8c6ef34a9c23d6";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,2 +1,2 @@
1
- export declare const version = "0.46.0-alpha-20260105114825-21a288f5ce8422d00716d16112b4066f405342dc";
1
+ export declare const version = "0.46.0-alpha-20260105123501-c38fb0042e619b832de412eb0f8c6ef34a9c23d6";
2
2
  //# sourceMappingURL=version.d.ts.map