wgc 0.7.0 → 0.8.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/commands/auth/commands/whoami.d.ts +4 -0
  3. package/dist/commands/auth/commands/whoami.js +31 -0
  4. package/dist/commands/auth/commands/whoami.js.map +1 -0
  5. package/dist/commands/auth/index.d.ts +4 -0
  6. package/dist/commands/auth/index.js +9 -0
  7. package/dist/commands/auth/index.js.map +1 -0
  8. package/dist/commands/federated-graph/commands/list.d.ts +4 -0
  9. package/dist/commands/federated-graph/commands/list.js +53 -0
  10. package/dist/commands/federated-graph/commands/list.js.map +1 -0
  11. package/dist/commands/federated-graph/index.js +2 -0
  12. package/dist/commands/federated-graph/index.js.map +1 -1
  13. package/dist/commands/index.js +4 -0
  14. package/dist/commands/index.js.map +1 -1
  15. package/dist/commands/subgraph/commands/list.d.ts +4 -0
  16. package/dist/commands/subgraph/commands/list.js +44 -0
  17. package/dist/commands/subgraph/commands/list.js.map +1 -0
  18. package/dist/commands/subgraph/index.js +2 -0
  19. package/dist/commands/subgraph/index.js.map +1 -1
  20. package/dist/core/client/client.d.ts +1 -1
  21. package/dist/core/client/client.js +2 -2
  22. package/dist/core/client/client.js.map +1 -1
  23. package/dist/tsconfig.tsbuildinfo +1 -1
  24. package/package.json +7 -7
  25. package/src/commands/auth/commands/whoami.ts +36 -0
  26. package/src/commands/auth/index.ts +10 -0
  27. package/src/commands/federated-graph/commands/list.ts +57 -0
  28. package/src/commands/federated-graph/index.ts +2 -0
  29. package/src/commands/index.ts +7 -0
  30. package/src/commands/subgraph/commands/list.ts +48 -0
  31. package/src/commands/subgraph/index.ts +2 -0
  32. package/src/core/client/client.ts +2 -2
  33. package/test/check-federated-graph.test.ts +1 -1
  34. package/test/check-schema.test.ts +1 -1
  35. package/test/create-subgraph.test.ts +1 -1
  36. package/test/publish-schema.test.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@ Images can be found [here](https://github.com/orgs/wundergraph/packages?repo_nam
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.8.0](https://github.com/wundergraph/cosmo/compare/wgc@0.7.0...wgc@0.8.0) (2023-09-06)
8
+
9
+ ### Features
10
+
11
+ * add federatedGraph and subgraph list command ([#34](https://github.com/wundergraph/cosmo/issues/34)) ([d235307](https://github.com/wundergraph/cosmo/commit/d2353070bd3fa29ccbd4ccf571964482532fae0a)) (@JivusAyrus)
12
+ * implement whoami cli command ([#33](https://github.com/wundergraph/cosmo/issues/33)) ([c920b25](https://github.com/wundergraph/cosmo/commit/c920b25ff4dc31cf9788b1590e3c89e4a33a3ac0)) (@StarpTech)
13
+ * move to new connectrpc packages ([#32](https://github.com/wundergraph/cosmo/issues/32)) ([4c8423b](https://github.com/wundergraph/cosmo/commit/4c8423bf377b63af6a42a42d7d5fc1ce2db1f09e)) (@StarpTech)
14
+
7
15
  # [0.7.0](https://github.com/wundergraph/cosmo/compare/wgc@0.6.5...wgc@0.7.0) (2023-09-02)
8
16
 
9
17
  ### Features
@@ -0,0 +1,4 @@
1
+ import { Command } from 'commander';
2
+ import { BaseCommandOptions } from '../../../core/types/types.js';
3
+ declare const _default: (opts: BaseCommandOptions) => Command;
4
+ export default _default;
@@ -0,0 +1,31 @@
1
+ import { Command, program } from 'commander';
2
+ import pc from 'picocolors';
3
+ import { EnumStatusCode } from '@wundergraph/cosmo-connect/dist/common_pb';
4
+ import { baseHeaders, config } from '../../../core/config.js';
5
+ export default (opts) => {
6
+ const schemaPush = new Command('whoami');
7
+ schemaPush.description('Displays the users/service identity currently authenticated and in use.');
8
+ schemaPush.action(async (name, options) => {
9
+ var _a, _b;
10
+ const resp = await opts.client.platform.whoAmI({}, {
11
+ headers: baseHeaders,
12
+ });
13
+ switch ((_a = resp.response) === null || _a === void 0 ? void 0 : _a.code) {
14
+ case EnumStatusCode.OK: {
15
+ console.log('Organization:', pc.bold(resp.organizationName));
16
+ console.log('Api Url:', config.baseURL);
17
+ break;
18
+ }
19
+ default: {
20
+ if ((_b = resp.response) === null || _b === void 0 ? void 0 : _b.details) {
21
+ program.error(resp.response.details);
22
+ }
23
+ else {
24
+ program.error('An unknown error occurred');
25
+ }
26
+ }
27
+ }
28
+ });
29
+ return schemaPush;
30
+ };
31
+ //# sourceMappingURL=whoami.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whoami.js","sourceRoot":"","sources":["../../../../src/commands/auth/commands/whoami.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAE3E,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAE9D,eAAe,CAAC,IAAwB,EAAE,EAAE;IAC1C,MAAM,UAAU,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;IACzC,UAAU,CAAC,WAAW,CAAC,yEAAyE,CAAC,CAAC;IAElG,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;;QACxC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAC5C,EAAE,EACF;YACE,OAAO,EAAE,WAAW;SACrB,CACF,CAAC;QAEF,QAAQ,MAAA,IAAI,CAAC,QAAQ,0CAAE,IAAI,EAAE;YAC3B,KAAK,cAAc,CAAC,EAAE,CAAC,CAAC;gBACtB,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;gBAC7D,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;gBACxC,MAAM;aACP;YACD,OAAO,CAAC,CAAC;gBACP,IAAI,MAAA,IAAI,CAAC,QAAQ,0CAAE,OAAO,EAAE;oBAC1B,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;iBACtC;qBAAM;oBACL,OAAO,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;iBAC5C;aACF;SACF;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Command } from 'commander';
2
+ import { BaseCommandOptions } from '../../core/types/types.js';
3
+ declare const _default: (opts: BaseCommandOptions) => Command;
4
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import { Command } from 'commander';
2
+ import Whoami from './commands/whoami.js';
3
+ export default (opts) => {
4
+ const schema = new Command('auth');
5
+ schema.description('Provides commands for authentication.');
6
+ schema.addCommand(Whoami(opts));
7
+ return schema;
8
+ };
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAE1C,eAAe,CAAC,IAAwB,EAAE,EAAE;IAC1C,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACnC,MAAM,CAAC,WAAW,CAAC,uCAAuC,CAAC,CAAC;IAC5D,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAChC,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Command } from 'commander';
2
+ import { BaseCommandOptions } from '../../../core/types/types.js';
3
+ declare const _default: (opts: BaseCommandOptions) => Command;
4
+ export default _default;
@@ -0,0 +1,53 @@
1
+ import { Command } from 'commander';
2
+ import pc from 'picocolors';
3
+ import { EnumStatusCode } from '@wundergraph/cosmo-connect/dist/common_pb';
4
+ import Table from 'cli-table';
5
+ import logSymbols from 'log-symbols';
6
+ import { baseHeaders } from '../../../core/config.js';
7
+ import program from '../../index.js';
8
+ export default (opts) => {
9
+ const listFederatedGraphs = new Command('list');
10
+ listFederatedGraphs.description('Lists federated graphs.');
11
+ listFederatedGraphs.action(async () => {
12
+ var _a;
13
+ const resp = await opts.client.platform.getFederatedGraphs({
14
+ includeMetrics: false,
15
+ // limit 0 fetches all
16
+ limit: 0,
17
+ offset: 0,
18
+ }, {
19
+ headers: baseHeaders,
20
+ });
21
+ const graphsTable = new Table({
22
+ head: [
23
+ pc.bold(pc.white('NAME')),
24
+ pc.bold(pc.white('LABEL_MATCHERS')),
25
+ pc.bold(pc.white('ROUTING_URL')),
26
+ pc.bold(pc.white('IS_COMPOSABLE')),
27
+ ],
28
+ colAligns: ['left', 'left', 'left', 'middle'],
29
+ colWidths: [30, 40, 60, 15],
30
+ });
31
+ if (((_a = resp.response) === null || _a === void 0 ? void 0 : _a.code) === EnumStatusCode.OK) {
32
+ if (resp.graphs.length > 0) {
33
+ for (const graph of resp.graphs) {
34
+ graphsTable.push([
35
+ graph.name,
36
+ graph.labelMatchers.join(','),
37
+ graph.routingURL,
38
+ graph.isComposable ? logSymbols.success : logSymbols.error,
39
+ ]);
40
+ }
41
+ console.log(graphsTable.toString());
42
+ }
43
+ else {
44
+ console.log('No federated graphs found');
45
+ }
46
+ }
47
+ else {
48
+ program.error(pc.red('Could not fetch the federated graphs.'));
49
+ }
50
+ });
51
+ return listFederatedGraphs;
52
+ };
53
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/commands/federated-graph/commands/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,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,EAAE,EAAE;YAC7C,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC1B,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE;oBAC/B,WAAW,CAAC,IAAI,CAAC;wBACf,KAAK,CAAC,IAAI;wBACV,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC;wBAC7B,KAAK,CAAC,UAAU;wBAChB,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK;qBAC3D,CAAC,CAAC;iBACJ;gBACD,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC;aACrC;iBAAM;gBACL,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;aAC1C;SACF;aAAM;YACL,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC,CAAC;SAChE;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,mBAAmB,CAAC;AAC7B,CAAC,CAAC"}
@@ -6,6 +6,7 @@ import UpdateFederatedGraphCommand from './commands/update.js';
6
6
  import CheckFederatedGraphCommand from './commands/check.js';
7
7
  import CreateFederatedGraphToken from './commands/create-token.js';
8
8
  import FetchRouterConfig from './commands/fetch-config.js';
9
+ import ListFederatedGraphs from './commands/list.js';
9
10
  export default (opts) => {
10
11
  const schema = new Command('federated-graph');
11
12
  schema.description('Provides commands for creating and managing a federated graph');
@@ -16,6 +17,7 @@ export default (opts) => {
16
17
  schema.addCommand(CheckFederatedGraphCommand(opts));
17
18
  schema.addCommand(CreateFederatedGraphToken(opts));
18
19
  schema.addCommand(FetchRouterConfig(opts));
20
+ schema.addCommand(ListFederatedGraphs(opts));
19
21
  return schema;
20
22
  };
21
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/federated-graph/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,2BAA2B,MAAM,sBAAsB,CAAC;AAC/D,OAAO,0BAA0B,MAAM,qBAAqB,CAAC;AAC7D,OAAO,2BAA2B,MAAM,sBAAsB,CAAC;AAC/D,OAAO,2BAA2B,MAAM,sBAAsB,CAAC;AAC/D,OAAO,0BAA0B,MAAM,qBAAqB,CAAC;AAC7D,OAAO,yBAAyB,MAAM,4BAA4B,CAAC;AACnE,OAAO,iBAAiB,MAAM,4BAA4B,CAAC;AAE3D,eAAe,CAAC,IAAwB,EAAE,EAAE;IAC1C,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC9C,MAAM,CAAC,WAAW,CAAC,+DAA+D,CAAC,CAAC;IACpF,MAAM,CAAC,UAAU,CAAC,2BAA2B,CAAC,IAAI,CAAC,CAAC,CAAC;IACrD,MAAM,CAAC,UAAU,CAAC,0BAA0B,CAAC,IAAI,CAAC,CAAC,CAAC;IACpD,MAAM,CAAC,UAAU,CAAC,2BAA2B,CAAC,IAAI,CAAC,CAAC,CAAC;IACrD,MAAM,CAAC,UAAU,CAAC,2BAA2B,CAAC,IAAI,CAAC,CAAC,CAAC;IACrD,MAAM,CAAC,UAAU,CAAC,0BAA0B,CAAC,IAAI,CAAC,CAAC,CAAC;IACpD,MAAM,CAAC,UAAU,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC,CAAC;IACnD,MAAM,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3C,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/federated-graph/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,2BAA2B,MAAM,sBAAsB,CAAC;AAC/D,OAAO,0BAA0B,MAAM,qBAAqB,CAAC;AAC7D,OAAO,2BAA2B,MAAM,sBAAsB,CAAC;AAC/D,OAAO,2BAA2B,MAAM,sBAAsB,CAAC;AAC/D,OAAO,0BAA0B,MAAM,qBAAqB,CAAC;AAC7D,OAAO,yBAAyB,MAAM,4BAA4B,CAAC;AACnE,OAAO,iBAAiB,MAAM,4BAA4B,CAAC;AAC3D,OAAO,mBAAmB,MAAM,oBAAoB,CAAC;AAErD,eAAe,CAAC,IAAwB,EAAE,EAAE;IAC1C,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC9C,MAAM,CAAC,WAAW,CAAC,+DAA+D,CAAC,CAAC;IACpF,MAAM,CAAC,UAAU,CAAC,2BAA2B,CAAC,IAAI,CAAC,CAAC,CAAC;IACrD,MAAM,CAAC,UAAU,CAAC,0BAA0B,CAAC,IAAI,CAAC,CAAC,CAAC;IACpD,MAAM,CAAC,UAAU,CAAC,2BAA2B,CAAC,IAAI,CAAC,CAAC,CAAC;IACrD,MAAM,CAAC,UAAU,CAAC,2BAA2B,CAAC,IAAI,CAAC,CAAC,CAAC;IACrD,MAAM,CAAC,UAAU,CAAC,0BAA0B,CAAC,IAAI,CAAC,CAAC,CAAC;IACpD,MAAM,CAAC,UAAU,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC,CAAC;IACnD,MAAM,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3C,MAAM,CAAC,UAAU,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7C,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
@@ -3,6 +3,7 @@ import pc from 'picocolors';
3
3
  import { CreateClient } from '../core/client/client.js';
4
4
  import { config } from '../core/config.js';
5
5
  import SchemaCommands from './subgraph/index.js';
6
+ import AuthCommands from './auth/index.js';
6
7
  import FederatedGraphCommands from './federated-graph/index.js';
7
8
  if (!config.apiKey) {
8
9
  console.log(pc.yellow(`No API key found. Please create an API key and set as environment variable ${pc.bold('COSMO_API_KEY')}.` +
@@ -25,5 +26,8 @@ program.addCommand(FederatedGraphCommands({
25
26
  program.addCommand(SchemaCommands({
26
27
  client,
27
28
  }));
29
+ program.addCommand(AuthCommands({
30
+ client,
31
+ }));
28
32
  export default program;
29
33
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,cAAc,MAAM,qBAAqB,CAAC;AACjD,OAAO,sBAAsB,MAAM,4BAA4B,CAAC;AAEhE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;IAClB,OAAO,CAAC,GAAG,CACT,EAAE,CAAC,MAAM,CACP,8EAA8E,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG;QACvG,IAAI;QACJ,8EAA8E,CACjF,GAAG,IAAI,CACT,CAAC;CACH;AAED,MAAM,MAAM,GAAG,YAAY,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC,OAAO;IACvB,MAAM,EAAE,MAAM,CAAC,MAAM;CACtB,CAAC,CAAC;AAEH,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAC9B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;KACxC,WAAW,CAAC;;;CAGd,CAAC,CAAC;AACH,OAAO,CAAC,UAAU,CAChB,sBAAsB,CAAC;IACrB,MAAM;CACP,CAAC,CACH,CAAC;AACF,OAAO,CAAC,UAAU,CAChB,cAAc,CAAC;IACb,MAAM;CACP,CAAC,CACH,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,cAAc,MAAM,qBAAqB,CAAC;AACjD,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,sBAAsB,MAAM,4BAA4B,CAAC;AAEhE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;IAClB,OAAO,CAAC,GAAG,CACT,EAAE,CAAC,MAAM,CACP,8EAA8E,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG;QACvG,IAAI;QACJ,8EAA8E,CACjF,GAAG,IAAI,CACT,CAAC;CACH;AAED,MAAM,MAAM,GAAG,YAAY,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC,OAAO;IACvB,MAAM,EAAE,MAAM,CAAC,MAAM;CACtB,CAAC,CAAC;AAEH,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAC9B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;KACxC,WAAW,CAAC;;;CAGd,CAAC,CAAC;AAEH,OAAO,CAAC,UAAU,CAChB,sBAAsB,CAAC;IACrB,MAAM;CACP,CAAC,CACH,CAAC;AACF,OAAO,CAAC,UAAU,CAChB,cAAc,CAAC;IACb,MAAM;CACP,CAAC,CACH,CAAC;AACF,OAAO,CAAC,UAAU,CAChB,YAAY,CAAC;IACX,MAAM;CACP,CAAC,CACH,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Command } from 'commander';
2
+ import { BaseCommandOptions } from '../../../core/types/types.js';
3
+ declare const _default: (opts: BaseCommandOptions) => Command;
4
+ export default _default;
@@ -0,0 +1,44 @@
1
+ import { EnumStatusCode } from '@wundergraph/cosmo-connect/dist/common_pb';
2
+ import Table from 'cli-table';
3
+ import { Command } from 'commander';
4
+ import pc from 'picocolors';
5
+ import { baseHeaders } from '../../../core/config.js';
6
+ import program from '../../index.js';
7
+ export default (opts) => {
8
+ const listSubgraphs = new Command('list');
9
+ listSubgraphs.description('Lists subgraphs.');
10
+ listSubgraphs.action(async () => {
11
+ var _a;
12
+ const resp = await opts.client.platform.getSubgraphs({
13
+ // limit 0 fetches all
14
+ limit: 0,
15
+ offset: 0,
16
+ }, {
17
+ headers: baseHeaders,
18
+ });
19
+ const graphsTable = new Table({
20
+ head: [pc.bold(pc.white('NAME')), pc.bold(pc.white('LABELS')), pc.bold(pc.white('ROUTING_URL'))],
21
+ colWidths: [15, 40, 60],
22
+ });
23
+ if (((_a = resp.response) === null || _a === void 0 ? void 0 : _a.code) === EnumStatusCode.OK) {
24
+ if (resp.graphs.length > 0) {
25
+ for (const graph of resp.graphs) {
26
+ graphsTable.push([
27
+ graph.name,
28
+ graph.labels.map(({ key, value }) => `${key}=${value}`).join(', '),
29
+ graph.routingURL,
30
+ ]);
31
+ }
32
+ console.log(graphsTable.toString());
33
+ }
34
+ else {
35
+ console.log('No subgraphs found');
36
+ }
37
+ }
38
+ else {
39
+ program.error(pc.red('Could not fetch the subgraphs.'));
40
+ }
41
+ });
42
+ return listSubgraphs;
43
+ };
44
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/commands/subgraph/commands/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,KAAK,MAAM,WAAW,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAA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I,CAAC,IAAI,CAAC;wBAClE,KAAK,CAAC,UAAU;qBACjB,CAAC,CAAC;iBACJ;gBACD,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC;aACrC;iBAAM;gBACL,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;aACnC;SACF;aAAM;YACL,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC,CAAC;SACzD;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC"}
@@ -5,6 +5,7 @@ import PublishSubgraph from './commands/publish.js';
5
5
  import DeleteSubgraph from './commands/delete.js';
6
6
  import UpdateSubgraph from './commands/update.js';
7
7
  import FixSubGraph from './commands/fix.js';
8
+ import ListSubgraphs from './commands/list.js';
8
9
  export default (opts) => {
9
10
  const schema = new Command('subgraph');
10
11
  schema.description('Provides commands for creating and maintaining subgraphs of a federated graph');
@@ -14,6 +15,7 @@ export default (opts) => {
14
15
  schema.addCommand(DeleteSubgraph(opts));
15
16
  schema.addCommand(UpdateSubgraph(opts));
16
17
  schema.addCommand(FixSubGraph(opts));
18
+ schema.addCommand(ListSubgraphs(opts));
17
19
  return schema;
18
20
  };
19
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/subgraph/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAChD,OAAO,qBAAqB,MAAM,sBAAsB,CAAC;AACzD,OAAO,eAAe,MAAM,uBAAuB,CAAC;AACpD,OAAO,cAAc,MAAM,sBAAsB,CAAC;AAClD,OAAO,cAAc,MAAM,sBAAsB,CAAC;AAClD,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAE5C,eAAe,CAAC,IAAwB,EAAE,EAAE;IAC1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C;IACzC,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;IACvC,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;IACxC,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;IACxC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;IACrC,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;IACvC,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { PromiseClient } from '@bufbuild/connect';
1
+ import { PromiseClient } from '@connectrpc/connect';
2
2
  import { PlatformService } from '@wundergraph/cosmo-connect/dist/platform/v1/platform_connect';
3
3
  import { NodeService } from '@wundergraph/cosmo-connect/dist/node/v1/node_connect';
4
4
  export interface ClientOptions {
@@ -1,5 +1,5 @@
1
- import { compressionBrotli, compressionGzip, createConnectTransport } from '@bufbuild/connect-node';
2
- import { createPromiseClient } from '@bufbuild/connect';
1
+ import { compressionBrotli, compressionGzip, createConnectTransport } from '@connectrpc/connect-node';
2
+ import { createPromiseClient } from '@connectrpc/connect';
3
3
  import { PlatformService } from '@wundergraph/cosmo-connect/dist/platform/v1/platform_connect';
4
4
  import { NodeService } from '@wundergraph/cosmo-connect/dist/node/v1/node_connect';
5
5
  export const CreateClient = (opts) => {
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/core/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACpG,OAAO,EAAE,mBAAmB,EAAiB,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAC;AAC/F,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;AAYnF,MAA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