@graphql-hive/apollo 0.43.0-alpha-20251126135136-138723ce57a927f98364ecea7e70598dfc73f5df → 0.43.0-alpha-20251126162447-5d6fb5e4265837f4fb3e275a93864c43d0699622
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 +11 -26
- package/cjs/version.js +1 -1
- package/esm/index.js +12 -27
- package/esm/version.js +1 -1
- package/package.json +2 -2
- package/typings/index.d.cts +3 -36
- package/typings/index.d.ts +3 -36
- package/typings/version.d.cts +1 -1
- package/typings/version.d.ts +1 -1
package/cjs/index.js
CHANGED
|
@@ -4,60 +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(
|
|
17
|
-
var _a,
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
const endpoint = args.endpoint.endsWith('/supergraph')
|
|
21
|
-
? args.endpoint
|
|
22
|
-
: (0, core_1.joinUrl)(args.endpoint, 'supergraph');
|
|
23
|
-
const artifactsFetcher = (0, core_1.createCDNArtifactFetcher)({
|
|
24
|
-
endpoint,
|
|
25
|
-
accessKey: args.key,
|
|
26
|
-
client: {
|
|
27
|
-
name: (_c = args.name) !== null && _c !== void 0 ? _c : '@graphql-hive/apollo',
|
|
28
|
-
version: (_d = args.version) !== null && _d !== void 0 ? _d : version_js_1.version,
|
|
29
|
-
},
|
|
30
|
-
logger,
|
|
31
|
-
fetch: args.fetchImplementation,
|
|
32
|
-
circuitBreaker: args.circuitBreaker,
|
|
33
|
-
});
|
|
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);
|
|
34
20
|
let timer = null;
|
|
35
21
|
return {
|
|
36
22
|
async initialize(hooks) {
|
|
37
|
-
const initialResult = await
|
|
23
|
+
const initialResult = await fetchSupergraph();
|
|
38
24
|
function poll() {
|
|
39
25
|
timer = setTimeout(async () => {
|
|
40
26
|
var _a;
|
|
41
27
|
try {
|
|
42
|
-
const result = await
|
|
43
|
-
if (result.
|
|
44
|
-
(_a = hooks.update) === null || _a === void 0 ? void 0 : _a.call(hooks, result.
|
|
28
|
+
const result = await fetchSupergraph();
|
|
29
|
+
if (result.supergraphSdl) {
|
|
30
|
+
(_a = hooks.update) === null || _a === void 0 ? void 0 : _a.call(hooks, result.supergraphSdl);
|
|
45
31
|
}
|
|
46
32
|
}
|
|
47
33
|
catch (error) {
|
|
48
|
-
|
|
34
|
+
console.error(`Failed to update supergraph: ${error instanceof Error ? error.message : error}`);
|
|
49
35
|
}
|
|
50
36
|
poll();
|
|
51
37
|
}, pollIntervalInMs);
|
|
52
38
|
}
|
|
53
39
|
poll();
|
|
54
40
|
return {
|
|
55
|
-
supergraphSdl: initialResult.
|
|
41
|
+
supergraphSdl: initialResult.supergraphSdl,
|
|
56
42
|
cleanup: async () => {
|
|
57
43
|
if (timer) {
|
|
58
44
|
clearTimeout(timer);
|
|
59
45
|
}
|
|
60
|
-
artifactsFetcher.dispose();
|
|
61
46
|
},
|
|
62
47
|
};
|
|
63
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-
|
|
4
|
+
exports.version = '0.43.0-alpha-20251126162447-5d6fb5e4265837f4fb3e275a93864c43d0699622';
|
package/esm/index.js
CHANGED
|
@@ -1,53 +1,38 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
1
2
|
import { GraphQLError } from 'graphql';
|
|
2
|
-
import { autoDisposeSymbol,
|
|
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(
|
|
7
|
-
var _a,
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const endpoint = args.endpoint.endsWith('/supergraph')
|
|
11
|
-
? args.endpoint
|
|
12
|
-
: joinUrl(args.endpoint, 'supergraph');
|
|
13
|
-
const artifactsFetcher = createCDNArtifactFetcher({
|
|
14
|
-
endpoint,
|
|
15
|
-
accessKey: args.key,
|
|
16
|
-
client: {
|
|
17
|
-
name: (_c = args.name) !== null && _c !== void 0 ? _c : '@graphql-hive/apollo',
|
|
18
|
-
version: (_d = args.version) !== null && _d !== void 0 ? _d : version,
|
|
19
|
-
},
|
|
20
|
-
logger,
|
|
21
|
-
fetch: args.fetchImplementation,
|
|
22
|
-
circuitBreaker: args.circuitBreaker,
|
|
23
|
-
});
|
|
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);
|
|
24
10
|
let timer = null;
|
|
25
11
|
return {
|
|
26
12
|
async initialize(hooks) {
|
|
27
|
-
const initialResult = await
|
|
13
|
+
const initialResult = await fetchSupergraph();
|
|
28
14
|
function poll() {
|
|
29
15
|
timer = setTimeout(async () => {
|
|
30
16
|
var _a;
|
|
31
17
|
try {
|
|
32
|
-
const result = await
|
|
33
|
-
if (result.
|
|
34
|
-
(_a = hooks.update) === null || _a === void 0 ? void 0 : _a.call(hooks, result.
|
|
18
|
+
const result = await fetchSupergraph();
|
|
19
|
+
if (result.supergraphSdl) {
|
|
20
|
+
(_a = hooks.update) === null || _a === void 0 ? void 0 : _a.call(hooks, result.supergraphSdl);
|
|
35
21
|
}
|
|
36
22
|
}
|
|
37
23
|
catch (error) {
|
|
38
|
-
|
|
24
|
+
console.error(`Failed to update supergraph: ${error instanceof Error ? error.message : error}`);
|
|
39
25
|
}
|
|
40
26
|
poll();
|
|
41
27
|
}, pollIntervalInMs);
|
|
42
28
|
}
|
|
43
29
|
poll();
|
|
44
30
|
return {
|
|
45
|
-
supergraphSdl: initialResult.
|
|
31
|
+
supergraphSdl: initialResult.supergraphSdl,
|
|
46
32
|
cleanup: async () => {
|
|
47
33
|
if (timer) {
|
|
48
34
|
clearTimeout(timer);
|
|
49
35
|
}
|
|
50
|
-
artifactsFetcher.dispose();
|
|
51
36
|
},
|
|
52
37
|
};
|
|
53
38
|
},
|
package/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '0.43.0-alpha-
|
|
1
|
+
export const version = '0.43.0-alpha-20251126162447-5d6fb5e4265837f4fb3e275a93864c43d0699622';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-hive/apollo",
|
|
3
|
-
"version": "0.43.0-alpha-
|
|
3
|
+
"version": "0.43.0-alpha-20251126162447-5d6fb5e4265837f4fb3e275a93864c43d0699622",
|
|
4
4
|
"description": "GraphQL Hive + Apollo Server",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"peerDependencies": {
|
|
@@ -8,7 +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/core": "0.16.0-alpha-
|
|
11
|
+
"@graphql-hive/core": "0.16.0-alpha-20251126162447-5d6fb5e4265837f4fb3e275a93864c43d0699622"
|
|
12
12
|
},
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
package/typings/index.d.cts
CHANGED
|
@@ -1,43 +1,10 @@
|
|
|
1
1
|
import type { ApolloServerPlugin } from '@apollo/server';
|
|
2
|
-
import { HiveClient, HivePluginOptions,
|
|
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;
|
|
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
|
-
|
|
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<{
|
package/typings/index.d.ts
CHANGED
|
@@ -1,43 +1,10 @@
|
|
|
1
1
|
import type { ApolloServerPlugin } from '@apollo/server';
|
|
2
|
-
import { HiveClient, HivePluginOptions,
|
|
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;
|
|
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
|
-
|
|
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<{
|
package/typings/version.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "0.43.0-alpha-
|
|
1
|
+
export declare const version = "0.43.0-alpha-20251126162447-5d6fb5e4265837f4fb3e275a93864c43d0699622";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/typings/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "0.43.0-alpha-
|
|
1
|
+
export declare const version = "0.43.0-alpha-20251126162447-5d6fb5e4265837f4fb3e275a93864c43d0699622";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|