wgc 0.20.2 → 0.21.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/CHANGELOG.md +7 -0
- package/dist/commands/router/commands/compose.js +11 -6
- package/dist/commands/router/commands/compose.js.map +1 -1
- package/dist/commands/subgraph/commands/check.js +22 -10
- package/dist/commands/subgraph/commands/check.js.map +1 -1
- package/dist/commands/subgraph/commands/create.js +8 -1
- package/dist/commands/subgraph/commands/create.js.map +1 -1
- package/dist/commands/subgraph/commands/update.js +8 -1
- package/dist/commands/subgraph/commands/update.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/commands/router/commands/compose.ts +6 -0
- package/src/commands/subgraph/commands/check.ts +28 -11
- package/src/commands/subgraph/commands/create.ts +14 -3
- package/src/commands/subgraph/commands/update.ts +14 -1
- package/test/check-schema.test.ts +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,13 @@ Binaries are attached to the github release otherwise all images can be found [h
|
|
|
4
4
|
All notable changes to this project will be documented in this file.
|
|
5
5
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
6
6
|
|
|
7
|
+
# [0.21.0](https://github.com/wundergraph/cosmo/compare/wgc@0.20.2...wgc@0.21.0) (2023-10-20)
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add support for subscriptions ([#185](https://github.com/wundergraph/cosmo/issues/185)) ([5a78aa0](https://github.com/wundergraph/cosmo/commit/5a78aa01f60ac4184ac69b0bd72aa1ce467bff93)) (@fiam)
|
|
12
|
+
* auto ignore schema errors for check command if github is integrated ([#184](https://github.com/wundergraph/cosmo/issues/184)) ([05d1b4a](https://github.com/wundergraph/cosmo/commit/05d1b4a4fcb836013c8db49796c174eba0c96744)) (@thisisnithin)
|
|
13
|
+
|
|
7
14
|
## [0.20.2](https://github.com/wundergraph/cosmo/compare/wgc@0.20.1...wgc@0.20.2) (2023-10-16)
|
|
8
15
|
|
|
9
16
|
### Bug Fixes
|
|
@@ -56,12 +56,17 @@ export default (opts) => {
|
|
|
56
56
|
const routerConfig = buildRouterConfig({
|
|
57
57
|
argumentConfigurations: result.federationResult.argumentConfigurations,
|
|
58
58
|
federatedSDL: printSchema(result.federationResult.federatedGraphSchema),
|
|
59
|
-
subgraphs: config.subgraphs.map((s, index) =>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
subgraphs: config.subgraphs.map((s, index) => {
|
|
60
|
+
var _a, _b, _c, _d;
|
|
61
|
+
return ({
|
|
62
|
+
id: `${index}`,
|
|
63
|
+
name: s.name,
|
|
64
|
+
url: normalizeURL(s.routing_url),
|
|
65
|
+
sdl: sdls[index],
|
|
66
|
+
subscriptionUrl: (_b = (_a = s.subscription) === null || _a === void 0 ? void 0 : _a.url) !== null && _b !== void 0 ? _b : s.routing_url,
|
|
67
|
+
subscriptionProtocol: (_d = (_c = s.subscription) === null || _c === void 0 ? void 0 : _c.protocol) !== null && _d !== void 0 ? _d : 'ws',
|
|
68
|
+
});
|
|
69
|
+
}),
|
|
65
70
|
});
|
|
66
71
|
if (options.out) {
|
|
67
72
|
await writeFile(options.out, routerConfig.toJsonString());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose.js","sourceRoot":"","sources":["../../../../src/commands/router/commands/compose.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,IAAI,MAAM,SAAS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,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC;oBAChB,eAAe,EAAE,MAAA,MAAA,CAAC,CAAC,YAAY,0CAAE,GAAG,mCAAI,CAAC,CAAC,WAAW;oBACrD,oBAAoB,EAAE,MAAA,MAAA,CAAC,CAAC,YAAY,0CAAE,QAAQ,mCAAI,IAAI;iBACvD,CAAC,CAAA;aAAA,CAAC;SACJ,CAAC,CAAC;QAEH,IAAI,OAAO,CAAC,GAAG,EAAE;YACf,MAAM,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,YAAY,CAAC,YAAY,EAAE,CAAC,CAAC;SAC3D;aAAM;YACL,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC,CAAC;SAC1C;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"}
|
|
@@ -2,18 +2,18 @@ import { existsSync } from 'node:fs';
|
|
|
2
2
|
import { readFile } from 'node:fs/promises';
|
|
3
3
|
import { EnumStatusCode } from '@wundergraph/cosmo-connect/dist/common/common_pb';
|
|
4
4
|
import Table from 'cli-table3';
|
|
5
|
-
import { Command } from 'commander';
|
|
5
|
+
import { Command, program } from 'commander';
|
|
6
6
|
import logSymbols from 'log-symbols';
|
|
7
7
|
import { resolve } from 'pathe';
|
|
8
8
|
import pc from 'picocolors';
|
|
9
9
|
import { baseHeaders } from '../../../core/config.js';
|
|
10
10
|
import { useGitHub } from '../../../github.js';
|
|
11
11
|
export default (opts) => {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
const command = new Command('check');
|
|
13
|
+
command.description('Checks for breaking changes and composition errors with all connected federated graphs.');
|
|
14
|
+
command.argument('<name>', 'The name of the subgraph on which the check operation is to be performed.');
|
|
15
|
+
command.requiredOption('--schema <path-to-schema>', 'The path of the new schema file.');
|
|
16
|
+
command.action(async (name, options) => {
|
|
17
17
|
var _a, _b, _c, _d, _e;
|
|
18
18
|
const schemaFile = resolve(process.cwd(), options.schema);
|
|
19
19
|
if (!existsSync(schemaFile)) {
|
|
@@ -31,6 +31,18 @@ export default (opts) => {
|
|
|
31
31
|
repositorySlug,
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
+
let ignoreErrors = false;
|
|
35
|
+
if (gitInfo) {
|
|
36
|
+
const integrationCheckResponse = await opts.client.platform.isGitHubAppInstalled({
|
|
37
|
+
gitInfo,
|
|
38
|
+
}, {
|
|
39
|
+
headers: baseHeaders,
|
|
40
|
+
});
|
|
41
|
+
ignoreErrors = integrationCheckResponse.isInstalled;
|
|
42
|
+
if (ignoreErrors) {
|
|
43
|
+
console.log('GitHub integration detected. The command will succeed and any errors detected will be reflected on commit status instead.');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
34
46
|
const resp = await opts.client.platform.checkSubgraphSchema({
|
|
35
47
|
subgraphName: name,
|
|
36
48
|
schema: await readFile(schemaFile),
|
|
@@ -97,7 +109,7 @@ export default (opts) => {
|
|
|
97
109
|
if ((_b = resp.response) === null || _b === void 0 ? void 0 : _b.details) {
|
|
98
110
|
console.log(pc.red(pc.bold((_c = resp.response) === null || _c === void 0 ? void 0 : _c.details)));
|
|
99
111
|
}
|
|
100
|
-
|
|
112
|
+
program.error(logSymbols.error + pc.red(' Schema check failed.'));
|
|
101
113
|
break;
|
|
102
114
|
}
|
|
103
115
|
default: {
|
|
@@ -105,13 +117,13 @@ export default (opts) => {
|
|
|
105
117
|
if ((_d = resp.response) === null || _d === void 0 ? void 0 : _d.details) {
|
|
106
118
|
console.log(pc.red(pc.bold((_e = resp.response) === null || _e === void 0 ? void 0 : _e.details)));
|
|
107
119
|
}
|
|
108
|
-
|
|
120
|
+
program.error(logSymbols.error + pc.red(' Schema check failed.'));
|
|
109
121
|
}
|
|
110
122
|
}
|
|
111
|
-
if (!success) {
|
|
123
|
+
if (!success && !ignoreErrors) {
|
|
112
124
|
process.exit(1);
|
|
113
125
|
}
|
|
114
126
|
});
|
|
115
|
-
return
|
|
127
|
+
return command;
|
|
116
128
|
};
|
|
117
129
|
//# sourceMappingURL=check.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../../../src/commands/subgraph/commands/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAC;AAElF,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../../../src/commands/subgraph/commands/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAC;AAElF,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,eAAe,CAAC,IAAwB,EAAE,EAAE;IAC1C,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,WAAW,CAAC,yFAAyF,CAAC,CAAC;IAC/G,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,2EAA2E,CAAC,CAAC;IACxG,OAAO,CAAC,cAAc,CAAC,2BAA2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AO,IAAI,CAAC,YAAY,EAAE;YAC7B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACjB;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import pc from 'picocolors';
|
|
3
3
|
import { EnumStatusCode } from '@wundergraph/cosmo-connect/dist/common/common_pb';
|
|
4
|
-
import { splitLabel } from '@wundergraph/cosmo-shared';
|
|
4
|
+
import { splitLabel, parseGraphQLSubscriptionProtocol } from '@wundergraph/cosmo-shared';
|
|
5
5
|
import { baseHeaders } from '../../../core/config.js';
|
|
6
6
|
export default (opts) => {
|
|
7
7
|
const schemaPush = new Command('create');
|
|
@@ -10,6 +10,8 @@ export default (opts) => {
|
|
|
10
10
|
schemaPush.requiredOption('-r, --routing-url <url>', 'The routing url of your subgraph. This is the url that the subgraph will be accessible at.');
|
|
11
11
|
schemaPush.requiredOption('--label [labels...]', 'The labels to apply to the subgraph. The labels are passed in the format <key>=<value> <key>=<value>.');
|
|
12
12
|
schemaPush.option('--header [headers...]', 'The headers to apply when the subgraph is introspected. This is used for authentication and authorization.');
|
|
13
|
+
schemaPush.option('--subscription-url [url]', 'The url used for subscriptions. If empty, it defaults to same url used for routing.');
|
|
14
|
+
schemaPush.option('--subscription-protocol <protocol>', 'The protocol to use when subscribing to the subgraph. The supported protocols are ws, sse, and sse-post.');
|
|
13
15
|
schemaPush.action(async (name, options) => {
|
|
14
16
|
var _a, _b, _c;
|
|
15
17
|
const resp = await opts.client.platform.createFederatedSubgraph({
|
|
@@ -23,6 +25,11 @@ export default (opts) => {
|
|
|
23
25
|
}),
|
|
24
26
|
routingUrl: options.routingUrl,
|
|
25
27
|
headers: options.header,
|
|
28
|
+
// If the argument is provided but the URL is not, clear it
|
|
29
|
+
subscriptionUrl: options.subscriptionUrl === true ? '' : options.subscriptionUrl,
|
|
30
|
+
subscriptionProtocol: options.subscriptionProtocol
|
|
31
|
+
? parseGraphQLSubscriptionProtocol(options.subscriptionProtocol)
|
|
32
|
+
: undefined,
|
|
26
33
|
}, {
|
|
27
34
|
headers: baseHeaders,
|
|
28
35
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../src/commands/subgraph/commands/create.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../src/commands/subgraph/commands/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,gCAAgC,EAAE,MAAM,2BAA2B,CAAC;AAEzF,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,eAAe,CAAC,IAAwB,EAAE,EAAE;IAC1C,MAAM,UAAU,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;IACzC,UAAU,CAAC,WAAW,CAAC,oDAAoD,CAAC,CAAC;IAC7E,UAAU,CAAC,QAAQ,CACjB,QAAQ,EACR,yIAAyI,CAC1I,CAAC;IACF,UAAU,CAAC,cAAc,CACvB,yBAAyB,EACzB,4FAA4F,CAC7F,CAAC;IACF,UAAU,CAAC,cAAc,CACvB,qBAAqB,EACrB,uGAAuG,CACxG,CAAC;IACF,UAAU,CAAC,MAAM,CACf,uBAAuB,EACvB,4GAA4G,CAC7G,CAAC;IACF,UAAU,CAAC,MAAM,CACf,0BAA0B,EAC1B,qFAAqF,CACtF,CAAC;IACF,UAAU,CAAC,MAAM,CACf,oCAAoC,EACpC,0GAA0G,CAC3G,CAAC;IACF,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;;QACxC,MAAM,IAAI,GAAG,MAAM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C;SACjB;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC"}
|
|
@@ -2,7 +2,7 @@ import Table from 'cli-table3';
|
|
|
2
2
|
import { Command } from 'commander';
|
|
3
3
|
import pc from 'picocolors';
|
|
4
4
|
import { EnumStatusCode } from '@wundergraph/cosmo-connect/dist/common/common_pb';
|
|
5
|
-
import { splitLabel } from '@wundergraph/cosmo-shared';
|
|
5
|
+
import { splitLabel, parseGraphQLSubscriptionProtocol } from '@wundergraph/cosmo-shared';
|
|
6
6
|
import { baseHeaders } from '../../../core/config.js';
|
|
7
7
|
export default (opts) => {
|
|
8
8
|
const command = new Command('update');
|
|
@@ -11,6 +11,8 @@ export default (opts) => {
|
|
|
11
11
|
command.option('-r, --routing-url <url>', 'The routing url of your subgraph. This is the url that the subgraph will be accessible at.');
|
|
12
12
|
command.option('--label [labels...]', 'The labels to apply to the subgraph. The labels are passed in the format <key>=<value> <key>=<value>.');
|
|
13
13
|
command.option('--header [headers...]', 'The headers to apply when the subgraph is introspected. This is used for authentication and authorization.');
|
|
14
|
+
command.option('--subscription-url [url]', 'The url used for subscriptions. If empty, it defaults to same url used for routing.');
|
|
15
|
+
command.option('--subscription-protocol <protocol>', 'The protocol to use when subscribing to the subgraph. The supported protocols are ws, sse, and sse-post.');
|
|
14
16
|
command.action(async (name, options) => {
|
|
15
17
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
16
18
|
const resp = await opts.client.platform.updateSubgraph({
|
|
@@ -22,7 +24,12 @@ export default (opts) => {
|
|
|
22
24
|
value,
|
|
23
25
|
};
|
|
24
26
|
})) !== null && _c !== void 0 ? _c : [],
|
|
27
|
+
// If the argument is provided but the URL is not, clear it
|
|
28
|
+
subscriptionUrl: options.subscriptionUrl === true ? '' : options.subscriptionUrl,
|
|
25
29
|
routingUrl: options.routingUrl,
|
|
30
|
+
subscriptionProtocol: options.subscriptionProtocol
|
|
31
|
+
? parseGraphQLSubscriptionProtocol(options.subscriptionProtocol)
|
|
32
|
+
: undefined,
|
|
26
33
|
headers: options.header,
|
|
27
34
|
}, {
|
|
28
35
|
headers: baseHeaders,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../src/commands/subgraph/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../src/commands/subgraph/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,gCAAgC,EAAE,MAAM,2BAA2B,CAAC;AAEzF,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,eAAe,CAAC,IAAwB,EAAE,EAAE;IAC1C,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;IACtC,OAAO,CAAC,WAAW,CAAC,0CAA0C,CAAC,CAAC;IAChE,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,qCAAqC,CAAC,CAAC;IAClE,OAAO,CAAC,MAAM,CACZ,yBAAyB,EACzB,4FAA4F,CAC7F,CAAC;IACF,OAAO,CAAC,MAAM,CACZ,qBAAqB,EACrB,uGAAuG,CACxG,CAAC;IACF,OAAO,CAAC,MAAM,CACZ,uBAAuB,EACvB,4GAA4G,CAC7G,CAAC;IACF,OAAO,CAAC,MA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