@graphql-hive/apollo 0.46.0-alpha-20260107215734-a58164975833b8934c9e7183f04cfbb0d5430cc0 → 0.46.0-alpha-20260108091600-5e4c43cb32b12479705ca4f950cb4b1ee6bdfb1c

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,63 +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
- var _a;
119
- const persistedDocumentsCache = getPersistedDocumentsCacheFromContext(ctx);
120
- // Only use context logger if user didn't provide their own
121
- const contextLogger = !clientOrOptions.logger && !((_a = clientOrOptions.agent) === null || _a === void 0 ? void 0 : _a.logger)
122
- ? getLoggerFromContext(ctx)
123
- : undefined;
124
- return (0, core_1.createHive)(Object.assign(Object.assign({ logger: contextLogger }, clientOrOptions), { agent: Object.assign({ name: 'hive-client-apollo', version: version_js_1.version }, clientOrOptions.agent), experimental__persistedDocuments: clientOrOptions.experimental__persistedDocuments
125
- ? Object.assign(Object.assign({}, clientOrOptions.experimental__persistedDocuments), { layer2Cache: persistedDocumentsCache || clientOrOptions.experimental__persistedDocuments.layer2Cache
126
- ? 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) }));
127
75
  }
128
76
  function useHive(clientOrOptions) {
129
- let hive;
77
+ const hive = (0, core_1.isHiveClient)(clientOrOptions) ? clientOrOptions : createHive(clientOrOptions);
78
+ void hive.info();
130
79
  return {
131
80
  requestDidStart(context) {
132
81
  var _a;
@@ -334,15 +283,13 @@ function useHive(clientOrOptions) {
334
283
  })();
335
284
  },
336
285
  serverWillStart(ctx) {
337
- hive = (0, core_1.isHiveClient)(clientOrOptions) ? clientOrOptions : createHive(clientOrOptions, ctx);
338
- void hive.info();
339
286
  // `engine` does not exist in v3
340
287
  const isLegacyV0 = 'engine' in ctx;
341
288
  hive.reportSchema({ schema: ctx.schema });
342
289
  if (isLegacyV0) {
343
290
  return {
344
291
  async serverWillStop() {
345
- if (hive === null || hive === void 0 ? void 0 : hive[core_1.autoDisposeSymbol]) {
292
+ if (hive[core_1.autoDisposeSymbol]) {
346
293
  await hive.dispose();
347
294
  }
348
295
  },
@@ -351,7 +298,7 @@ function useHive(clientOrOptions) {
351
298
  // Works on v3 and v4
352
299
  return Promise.resolve({
353
300
  async serverWillStop() {
354
- if (hive === null || hive === void 0 ? void 0 : hive[core_1.autoDisposeSymbol]) {
301
+ if (hive[core_1.autoDisposeSymbol]) {
355
302
  await hive.dispose();
356
303
  }
357
304
  },
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-20260107215734-a58164975833b8934c9e7183f04cfbb0d5430cc0';
4
+ exports.version = '0.46.0-alpha-20260108091600-5e4c43cb32b12479705ca4f950cb4b1ee6bdfb1c';
package/esm/index.js CHANGED
@@ -60,63 +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
- var _a;
109
- const persistedDocumentsCache = getPersistedDocumentsCacheFromContext(ctx);
110
- // Only use context logger if user didn't provide their own
111
- const contextLogger = !clientOrOptions.logger && !((_a = clientOrOptions.agent) === null || _a === void 0 ? void 0 : _a.logger)
112
- ? getLoggerFromContext(ctx)
113
- : undefined;
114
- return createHiveClient(Object.assign(Object.assign({ logger: contextLogger }, clientOrOptions), { agent: Object.assign({ name: 'hive-client-apollo', version }, clientOrOptions.agent), experimental__persistedDocuments: clientOrOptions.experimental__persistedDocuments
115
- ? Object.assign(Object.assign({}, clientOrOptions.experimental__persistedDocuments), { layer2Cache: persistedDocumentsCache || clientOrOptions.experimental__persistedDocuments.layer2Cache
116
- ? 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) }));
117
65
  }
118
66
  export function useHive(clientOrOptions) {
119
- let hive;
67
+ const hive = isHiveClient(clientOrOptions) ? clientOrOptions : createHive(clientOrOptions);
68
+ void hive.info();
120
69
  return {
121
70
  requestDidStart(context) {
122
71
  var _a;
@@ -324,15 +273,13 @@ export function useHive(clientOrOptions) {
324
273
  })();
325
274
  },
326
275
  serverWillStart(ctx) {
327
- hive = isHiveClient(clientOrOptions) ? clientOrOptions : createHive(clientOrOptions, ctx);
328
- void hive.info();
329
276
  // `engine` does not exist in v3
330
277
  const isLegacyV0 = 'engine' in ctx;
331
278
  hive.reportSchema({ schema: ctx.schema });
332
279
  if (isLegacyV0) {
333
280
  return {
334
281
  async serverWillStop() {
335
- if (hive === null || hive === void 0 ? void 0 : hive[autoDisposeSymbol]) {
282
+ if (hive[autoDisposeSymbol]) {
336
283
  await hive.dispose();
337
284
  }
338
285
  },
@@ -341,7 +288,7 @@ export function useHive(clientOrOptions) {
341
288
  // Works on v3 and v4
342
289
  return Promise.resolve({
343
290
  async serverWillStop() {
344
- if (hive === null || hive === void 0 ? void 0 : hive[autoDisposeSymbol]) {
291
+ if (hive[autoDisposeSymbol]) {
345
292
  await hive.dispose();
346
293
  }
347
294
  },
package/esm/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '0.46.0-alpha-20260107215734-a58164975833b8934c9e7183f04cfbb0d5430cc0';
1
+ export const version = '0.46.0-alpha-20260108091600-5e4c43cb32b12479705ca4f950cb4b1ee6bdfb1c';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-hive/apollo",
3
- "version": "0.46.0-alpha-20260107215734-a58164975833b8934c9e7183f04cfbb0d5430cc0",
3
+ "version": "0.46.0-alpha-20260108091600-5e4c43cb32b12479705ca4f950cb4b1ee6bdfb1c",
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-20260107215734-a58164975833b8934c9e7183f04cfbb0d5430cc0"
12
+ "@graphql-hive/core": "0.19.0-alpha-20260108091600-5e4c43cb32b12479705ca4f950cb4b1ee6bdfb1c"
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-20260107215734-a58164975833b8934c9e7183f04cfbb0d5430cc0";
1
+ export declare const version = "0.46.0-alpha-20260108091600-5e4c43cb32b12479705ca4f950cb4b1ee6bdfb1c";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,2 +1,2 @@
1
- export declare const version = "0.46.0-alpha-20260107215734-a58164975833b8934c9e7183f04cfbb0d5430cc0";
1
+ export declare const version = "0.46.0-alpha-20260108091600-5e4c43cb32b12479705ca4f950cb4b1ee6bdfb1c";
2
2
  //# sourceMappingURL=version.d.ts.map