wgc 0.20.2 → 0.22.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 +13 -0
- package/dist/commands/federated-graph/commands/delete.js.map +1 -1
- package/dist/commands/federated-graph/commands/list.js +1 -1
- package/dist/commands/federated-graph/commands/list.js.map +1 -1
- 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 +9 -8
- package/dist/commands/subgraph/commands/create.js.map +1 -1
- package/dist/commands/subgraph/commands/delete.js +19 -5
- package/dist/commands/subgraph/commands/delete.js.map +1 -1
- package/dist/commands/subgraph/commands/publish.js +18 -4
- package/dist/commands/subgraph/commands/publish.js.map +1 -1
- package/dist/commands/subgraph/commands/update.js +10 -3
- package/dist/commands/subgraph/commands/update.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/src/commands/federated-graph/commands/delete.ts +1 -1
- package/src/commands/federated-graph/commands/list.ts +1 -1
- 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 +16 -10
- package/src/commands/subgraph/commands/delete.ts +22 -2
- package/src/commands/subgraph/commands/publish.ts +41 -6
- package/src/commands/subgraph/commands/update.ts +19 -4
- package/test/check-schema.test.ts +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,19 @@ 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.22.0](https://github.com/wundergraph/cosmo/compare/wgc@0.21.0...wgc@0.22.0) (2023-10-23)
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* allow to upsert a subgraph on publish ([#196](https://github.com/wundergraph/cosmo/issues/196)) ([27a1630](https://github.com/wundergraph/cosmo/commit/27a1630574e817412a6d5fb2b304da645a31d481)) (@StarpTech)
|
|
12
|
+
|
|
13
|
+
# [0.21.0](https://github.com/wundergraph/cosmo/compare/wgc@0.20.2...wgc@0.21.0) (2023-10-20)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* add support for subscriptions ([#185](https://github.com/wundergraph/cosmo/issues/185)) ([5a78aa0](https://github.com/wundergraph/cosmo/commit/5a78aa01f60ac4184ac69b0bd72aa1ce467bff93)) (@fiam)
|
|
18
|
+
* 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)
|
|
19
|
+
|
|
7
20
|
## [0.20.2](https://github.com/wundergraph/cosmo/compare/wgc@0.20.1...wgc@0.20.2) (2023-10-16)
|
|
8
21
|
|
|
9
22
|
### Bug Fixes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../src/commands/federated-graph/commands/delete.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,QAAQ,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../src/commands/federated-graph/commands/delete.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,QAAQ,MAAM,UAAU,CAAC;A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BAC1B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,MAAA,IAAI,CAAC,QAAQ,0CAAE,OAAO,CAAC,CAAC,CAAC,CAAC;aACtD;YACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACjB;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,oBAAoB,CAAC;AAC9B,CAAC,CAAC"}
|
|
@@ -60,7 +60,7 @@ export default (opts) => {
|
|
|
60
60
|
for (const graph of resp.graphs) {
|
|
61
61
|
graphsTable.push([
|
|
62
62
|
graph.name,
|
|
63
|
-
graph.labelMatchers.join(','),
|
|
63
|
+
graph.labelMatchers.map((l) => `(${l})`).join(','),
|
|
64
64
|
graph.routingURL,
|
|
65
65
|
graph.isComposable ? logSymbols.success : logSymbols.error,
|
|
66
66
|
graph.lastUpdatedAt,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/commands/federated-graph/commands/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAC;AAClF,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAUrC,eAAe,CAAC,IAAwB,EAAE,EAAE;IAC1C,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACpC,OAAO,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;IAC/C,OAAO,CAAC,MAA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,CAAC,CAAC;aAChC;YACD,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC;YAC7C,SAAS,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;YAC/B,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QAEH,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE;YAC/B,WAAW,CAAC,IAAI,CAAC;gBACf,KAAK,CAAC,IAAI;gBACV,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;gBAClD,KAAK,CAAC,UAAU;gBAChB,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK;gBAC1D,KAAK,CAAC,aAAa;aACpB,CAAC,CAAC;SACJ;QACD,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"}
|
|
@@ -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,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;
|
|
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,EA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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,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AAC,QAAQ,0CAAE,OAAO,EAAE;oBAC1B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,MAAA,IAAI,CAAC,QAAQ,0CAAE,OAAO,CAAC,CAAC,CAAC,CAAC;iBACtD;gBACD,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC;gBAClE,MAAM;aACP;YACD,OAAO,CAAC,CAAC;gBACP,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;gBACxD,IAAI,MAAA,IAAI,CAAC,QAAQ,0CAAE,OAAO,EAAE;oBAC1B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,MAAA,IAAI,CAAC,QAAQ,0CAAE,OAAO,CAAC,CAAC,CAAC,CAAC;iBACtD;gBACD,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC;aACnE;SACF;QAED,IAAI,CAAC,OAAO,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,19 +10,20 @@ 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({
|
|
16
18
|
name,
|
|
17
|
-
labels: options.label.map((label) =>
|
|
18
|
-
const { key, value } = splitLabel(label);
|
|
19
|
-
return {
|
|
20
|
-
key,
|
|
21
|
-
value,
|
|
22
|
-
};
|
|
23
|
-
}),
|
|
19
|
+
labels: options.label.map((label) => splitLabel(label)),
|
|
24
20
|
routingUrl: options.routingUrl,
|
|
25
21
|
headers: options.header,
|
|
22
|
+
// If the argument is provided but the URL is not, clear it
|
|
23
|
+
subscriptionUrl: options.subscriptionUrl === true ? '' : options.subscriptionUrl,
|
|
24
|
+
subscriptionProtocol: options.subscriptionProtocol
|
|
25
|
+
? parseGraphQLSubscriptionProtocol(options.subscriptionProtocol)
|
|
26
|
+
: undefined,
|
|
26
27
|
}, {
|
|
27
28
|
headers: baseHeaders,
|
|
28
29
|
});
|
|
@@ -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,MA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eAAe;YAChF,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;gBAChD,CAAC,CAAC,gCAAgC,CAAC,OAAO,CAAC,oBAAoB,CAAC;gBAChE,CAAC,CAAC,SAAS;SACd,EACD;YACE,OAAO,EAAE,WAAW;SACrB,CACF,CAAC;QAEF,IAAI,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,IAAI,MAAK,cAAc,CAAC,EAAE,EAAE;YAC7C,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,0BAA0B,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC;SAC/E;aAAM;YACL,OAAO,CAAC,GAAG,CAAC,8BAA8B,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC7D,IAAI,MAAA,IAAI,CAAC,QAAQ,0CAAE,OAAO,EAAE;gBAC1B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,MAAA,IAAI,CAAC,QAAQ,0CAAE,OAAO,CAAC,CAAC,CAAC,CAAC;aACtD;YACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACjB;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { Command } from 'commander';
|
|
|
2
2
|
import pc from 'picocolors';
|
|
3
3
|
import { EnumStatusCode } from '@wundergraph/cosmo-connect/dist/common/common_pb';
|
|
4
4
|
import inquirer from 'inquirer';
|
|
5
|
+
import Table from 'cli-table3';
|
|
5
6
|
import { baseHeaders } from '../../../core/config.js';
|
|
6
7
|
export default (opts) => {
|
|
7
8
|
const deleteSubgraph = new Command('delete');
|
|
@@ -9,7 +10,7 @@ export default (opts) => {
|
|
|
9
10
|
deleteSubgraph.argument('<name>', 'The name of the subgraph to delete.');
|
|
10
11
|
deleteSubgraph.option('-f --force', 'Option to force delete');
|
|
11
12
|
deleteSubgraph.action(async (name, options) => {
|
|
12
|
-
var _a, _b, _c;
|
|
13
|
+
var _a, _b, _c, _d;
|
|
13
14
|
if (!options.force) {
|
|
14
15
|
const deletionConfirmed = await inquirer.prompt({
|
|
15
16
|
name: 'confirmDeletion',
|
|
@@ -26,12 +27,25 @@ export default (opts) => {
|
|
|
26
27
|
headers: baseHeaders,
|
|
27
28
|
});
|
|
28
29
|
if (((_a = resp.response) === null || _a === void 0 ? void 0 : _a.code) === EnumStatusCode.OK) {
|
|
29
|
-
console.log(pc.dim(pc.green(`
|
|
30
|
+
console.log(pc.dim(pc.green(`Subgraph '${name}' was deleted.`)));
|
|
31
|
+
}
|
|
32
|
+
else if (((_b = resp.response) === null || _b === void 0 ? void 0 : _b.code) === EnumStatusCode.ERR_SUBGRAPH_COMPOSITION_FAILED) {
|
|
33
|
+
const compositionErrorsTable = new Table({
|
|
34
|
+
head: [pc.bold(pc.white('FEDERATED_GRAPH_NAME')), pc.bold(pc.white('ERROR_MESSAGE'))],
|
|
35
|
+
colWidths: [30, 120],
|
|
36
|
+
wordWrap: true,
|
|
37
|
+
});
|
|
38
|
+
console.log(pc.red(`We found composition errors, while composing the federated graph.\nThe router will continue to work with the latest valid schema.\n${pc.bold('Please check the errors below:')}`));
|
|
39
|
+
for (const compositionError of resp.compositionErrors) {
|
|
40
|
+
compositionErrorsTable.push([compositionError.federatedGraphName, compositionError.message]);
|
|
41
|
+
}
|
|
42
|
+
// Don't exit here with 1 because the change was still applied
|
|
43
|
+
console.log(compositionErrorsTable.toString());
|
|
30
44
|
}
|
|
31
45
|
else {
|
|
32
|
-
console.log(`Failed to delete subgraph ${pc.bold(name)}.`);
|
|
33
|
-
if ((
|
|
34
|
-
console.log(pc.red(pc.bold((
|
|
46
|
+
console.log(pc.red(`Failed to delete subgraph ${pc.bold(name)}.`));
|
|
47
|
+
if ((_c = resp.response) === null || _c === void 0 ? void 0 : _c.details) {
|
|
48
|
+
console.log(pc.red(pc.bold((_d = resp.response) === null || _d === void 0 ? void 0 : _d.details)));
|
|
35
49
|
}
|
|
36
50
|
process.exit(1);
|
|
37
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../src/commands/subgraph/commands/delete.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,QAAQ,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../src/commands/subgraph/commands/delete.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,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,MAAM,YAAY,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,eAAe,CAAC,IAAwB,EAAE,EAAE;IAC1C,MAAM,cAAc,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7C,cAAc,CAAC,WAAW,CAAC,0CAA0C,CAAC,CAAC;IACvE,cAAc,CAAC,QAAQ,CAAC,QAAQ,EAAE,qCAAqC,CAAC,CAAC;IACzE,cAAc,CAAC,MAAM,CAAC,YAAY,EAAE,wBAAwB,CAAC,CAAC;IAC9D,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;;QAC5C,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;YAClB,MAAM,iBAAiB,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;gBAC9C,IAAI,EAAE,iBAAiB;gBACvB,IAAI,EAAE,SAAS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C9D,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,QAAQ,EAAE,CAAC,CAAC;SAChD;aAAM;YACL,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,6BAA6B,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YACnE,IAAI,MAAA,IAAI,CAAC,QAAQ,0CAAE,OAAO,EAAE;gBAC1B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,MAAA,IAAI,CAAC,QAAQ,0CAAE,OAAO,CAAC,CAAC,CAAC,CAAC;aACtD;YACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACjB;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,cAAc,CAAC;AACxB,CAAC,CAAC"}
|
|
@@ -5,12 +5,18 @@ import { Command } from 'commander';
|
|
|
5
5
|
import { resolve } from 'pathe';
|
|
6
6
|
import pc from 'picocolors';
|
|
7
7
|
import { EnumStatusCode } from '@wundergraph/cosmo-connect/dist/common/common_pb';
|
|
8
|
+
import { parseGraphQLSubscriptionProtocol, splitLabel } from '@wundergraph/cosmo-shared';
|
|
8
9
|
import { baseHeaders } from '../../../core/config.js';
|
|
9
10
|
export default (opts) => {
|
|
10
11
|
const schemaPush = new Command('publish');
|
|
11
|
-
schemaPush.description(
|
|
12
|
+
schemaPush.description("Publishes a subgraph on the control plane. If the subgraph doesn't exists, it will be created.\nIf the publication leads to composition errors, the errors will be visible in the Studio.\nThe router will continue to work with the latest valid schema.\nConsider using the 'wgc subgraph check' command to check for composition errors before publishing.");
|
|
12
13
|
schemaPush.argument('<name>', 'The name of the subgraph to push the schema to. It is usually in the format of <org>.<service.name> and is used to uniquely identify your subgraph.');
|
|
13
14
|
schemaPush.requiredOption('--schema <path-to-schema>', 'The schema file to upload to the subgraph.');
|
|
15
|
+
schemaPush.option('-r, --routing-url <url>', 'The routing url of your subgraph. This is the url that the subgraph will be accessible at (Only required to create the subgraph).');
|
|
16
|
+
schemaPush.option('--label [labels...]', 'The labels to apply to the subgraph. The labels are passed in the format <key>=<value> <key>=<value>. Required to create the subgraph.', []);
|
|
17
|
+
schemaPush.option('--header [headers...]', 'The headers to apply when the subgraph is introspected. This is used for authentication and authorization.', []);
|
|
18
|
+
schemaPush.option('--subscription-url [url]', 'The url used for subscriptions. If empty, it defaults to same url used for routing.');
|
|
19
|
+
schemaPush.option('--subscription-protocol <protocol>', 'The protocol to use when subscribing to the subgraph. The supported protocols are ws, sse, and sse-post.');
|
|
14
20
|
schemaPush.action(async (name, options) => {
|
|
15
21
|
var _a, _b, _c, _d;
|
|
16
22
|
const schemaFile = resolve(process.cwd(), options.schema);
|
|
@@ -20,7 +26,16 @@ export default (opts) => {
|
|
|
20
26
|
}
|
|
21
27
|
const resp = await opts.client.platform.publishFederatedSubgraph({
|
|
22
28
|
name,
|
|
29
|
+
// Publish schema only
|
|
23
30
|
schema: await readFile(schemaFile),
|
|
31
|
+
// Optional when subgraph does not exist yet
|
|
32
|
+
routingUrl: options.routingUrl,
|
|
33
|
+
headers: options.header,
|
|
34
|
+
subscriptionUrl: options.subscriptionUrl,
|
|
35
|
+
subscriptionProtocol: options.subscriptionProtocol
|
|
36
|
+
? parseGraphQLSubscriptionProtocol(options.subscriptionProtocol)
|
|
37
|
+
: undefined,
|
|
38
|
+
labels: options.label.map((label) => splitLabel(label)),
|
|
24
39
|
}, {
|
|
25
40
|
headers: baseHeaders,
|
|
26
41
|
});
|
|
@@ -28,13 +43,12 @@ export default (opts) => {
|
|
|
28
43
|
console.log(pc.dim(pc.green(`Subgraph '${name}' was updated successfully.`)));
|
|
29
44
|
}
|
|
30
45
|
else if (((_b = resp.response) === null || _b === void 0 ? void 0 : _b.code) === EnumStatusCode.ERR_SUBGRAPH_COMPOSITION_FAILED) {
|
|
31
|
-
console.log(pc.dim(pc.green(`Subgraph '${name}' was updated successfully.`)));
|
|
32
46
|
const compositionErrorsTable = new Table({
|
|
33
47
|
head: [pc.bold(pc.white('FEDERATED_GRAPH_NAME')), pc.bold(pc.white('ERROR_MESSAGE'))],
|
|
34
48
|
colWidths: [30, 120],
|
|
35
49
|
wordWrap: true,
|
|
36
50
|
});
|
|
37
|
-
console.log(pc.
|
|
51
|
+
console.log(pc.red(`We found composition errors, while composing the federated graph.\nThe router will continue to work with the latest valid schema.\n${pc.bold('Please check the errors below:')}`));
|
|
38
52
|
for (const compositionError of resp.compositionErrors) {
|
|
39
53
|
compositionErrorsTable.push([compositionError.federatedGraphName, compositionError.message]);
|
|
40
54
|
}
|
|
@@ -42,7 +56,7 @@ export default (opts) => {
|
|
|
42
56
|
console.log(compositionErrorsTable.toString());
|
|
43
57
|
}
|
|
44
58
|
else {
|
|
45
|
-
console.log(`Failed to update subgraph
|
|
59
|
+
console.log(pc.red(`Failed to update subgraph ${pc.bold(name)}.`));
|
|
46
60
|
if ((_c = resp.response) === null || _c === void 0 ? void 0 : _c.details) {
|
|
47
61
|
console.log(pc.red(pc.bold((_d = resp.response) === null || _d === void 0 ? void 0 : _d.details)));
|
|
48
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../../../../src/commands/subgraph/commands/publish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAC;
|
|
1
|
+
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../../../../src/commands/subgraph/commands/publish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAA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I,CAAC,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC;gBACrF,SAAS,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC;gBACpB,QAAQ,EAAE,IAAI;aACf,CAAC,CAAC;YAEH,OAAO,CAAC,GAAG,CACT,EAAE,CAAC,GAAG,CACJ,sIAAsI,EAAE,CAAC,IAAI,CAC3I,gCAAgC,CACjC,EAAE,CACJ,CACF,CAAC;YACF,KAAK,MAAM,gBAAgB,IAAI,IAAI,CAAC,iBAAiB,EAAE;gBACrD,sBAAsB,CAAC,IAAI,CAAC,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;aAC9F;YACD,8DAA8D;YAC9D,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,QAAQ,EAAE,CAAC,CAAC;SAChD;aAAM;YACL,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,6BAA6B,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YACnE,IAAI,MAAA,IAAI,CAAC,QAAQ,0CAAE,OAAO,EAAE;gBAC1B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,MAAA,IAAI,CAAC,QAAQ,0CAAE,OAAO,CAAC,CAAC,CAAC,CAAC;aACtD;YACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;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,
|
|
@@ -37,7 +44,7 @@ export default (opts) => {
|
|
|
37
44
|
colWidths: [30, 120],
|
|
38
45
|
wordWrap: true,
|
|
39
46
|
});
|
|
40
|
-
console.log(pc.
|
|
47
|
+
console.log(pc.red(`We found composition errors, while composing the federated graph.\nThe router will continue to work with the latest valid schema.\n${pc.bold('Please check the errors below:')}`));
|
|
41
48
|
for (const compositionError of resp.compositionErrors) {
|
|
42
49
|
compositionErrorsTable.push([compositionError.federatedGraphName, compositionError.message]);
|
|
43
50
|
}
|
|
@@ -45,7 +52,7 @@ export default (opts) => {
|
|
|
45
52
|
console.log(compositionErrorsTable.toString());
|
|
46
53
|
}
|
|
47
54
|
else {
|
|
48
|
-
console.log(`Failed to update subgraph ${pc.bold(name)}.`);
|
|
55
|
+
console.log(pc.red(`Failed to update subgraph ${pc.bold(name)}.`));
|
|
49
56
|
if ((_f = resp.response) === null || _f === void 0 ? void 0 : _f.details) {
|
|
50
57
|
console.log(pc.red(pc.bold((_g = resp.response) === null || _g === void 0 ? void 0 : _g.details)));
|
|
51
58
|
}
|
|
@@ -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,CAA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