Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions cli/src/commands/contract/commands/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ export default (opts: BaseCommandOptions) => {
);
command.option('--suppress-warnings', 'This flag suppresses any warnings produced by composition.');
command.option('--readme <path-to-readme>', 'The markdown file which describes the contract.');
command.option(
'--disable-resolvability-validation',
'This flag will disable the validation for whether all nodes of the federated graph are resolvable. Do NOT use unless troubleshooting.',
);

command.action(async (name, options) => {
let readmeFile;
if (options.readme) {
Expand Down Expand Up @@ -59,15 +64,16 @@ export default (opts: BaseCommandOptions) => {

const resp = await opts.client.platform.createContract(
{
name,
namespace: options.namespace,
sourceGraphName: options.source,
admissionWebhookSecret: options.admissionWebhookSecret,
admissionWebhookUrl: options.admissionWebhookUrl,
disableResolvabilityValidation: options.disableResolvabilityValidation,
excludeTags: options.exclude,
includeTags: options.include,
routingUrl: options.routingUrl,
admissionWebhookUrl: options.admissionWebhookUrl,
admissionWebhookSecret: options.admissionWebhookSecret,
name,
namespace: options.namespace,
readme: readmeFile ? await readFile(readmeFile, 'utf8') : undefined,
routingUrl: options.routingUrl,
sourceGraphName: options.source,
},
{
headers: getBaseHeaders(),
Expand Down
14 changes: 10 additions & 4 deletions cli/src/commands/contract/commands/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ export default (opts: BaseCommandOptions) => {
'--admission-webhook-secret [string]',
'The admission webhook secret is used to sign requests to the webhook url.',
);
command.option(
'--disable-resolvability-validation',
'This flag will disable the validation for whether all nodes of the federated graph are resolvable. Do NOT use unless troubleshooting.',
);

command.action(async (name, options) => {
if (options.exclude?.length > 0 && options.include?.length > 0) {
program.error(
Expand Down Expand Up @@ -57,14 +62,15 @@ export default (opts: BaseCommandOptions) => {
const spinner = ora('Contract is being updated...').start();
const resp = await opts.client.platform.updateContract(
{
name,
namespace: options.namespace,
admissionWebhookSecret: options.admissionWebhookSecret,
admissionWebhookUrl: options.admissionWebhookUrl,
disableResolvabilityValidation: options.disableResolvabilityValidation,
excludeTags: options.exclude,
includeTags: options.include,
name,
namespace: options.namespace,
readme: readmeFile ? await readFile(readmeFile, 'utf8') : undefined,
routingUrl: options.routingUrl,
admissionWebhookUrl: options.admissionWebhookUrl,
admissionWebhookSecret: options.admissionWebhookSecret,
},
{
headers: getBaseHeaders(),
Expand Down
12 changes: 9 additions & 3 deletions cli/src/commands/feature-flag/commands/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,24 @@ export default (opts: BaseCommandOptions) => {
);
command.option('-j, --json', 'Prints to the console in json format instead of table');
command.option('--suppress-warnings', 'This flag suppresses any warnings produced by composition.');
command.option(
'--disable-resolvability-validation',
'This flag will disable the validation for whether all nodes of the federated graph are resolvable. Do NOT use unless troubleshooting.',
);

command.action(async (name, options) => {
const spinner = ora('The feature flag is being created...');
if (!options.json) {
spinner.start();
}
const resp = await opts.client.platform.createFeatureFlag(
{
name,
namespace: options.namespace,
labels: options.label ? options.label.map((label: string) => splitLabel(label)) : [],
disableResolvabilityValidation: options.disableResolvabilityValidation,
featureSubgraphNames: options.featureSubgraphs,
isEnabled: !!options.enabled,
labels: options.label ? options.label.map((label: string) => splitLabel(label)) : [],
name,
namespace: options.namespace,
},
{
headers: getBaseHeaders(),
Expand Down
8 changes: 6 additions & 2 deletions cli/src/commands/feature-flag/commands/delete.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Command } from 'commander';
import pc from 'picocolors';
import { EnumStatusCode } from '@wundergraph/cosmo-connect/dist/common/common_pb';
import inquirer from 'inquirer';
import Table from 'cli-table3';
import ora from 'ora';
import { BaseCommandOptions } from '../../../core/types/types.js';
import { getBaseHeaders } from '../../../core/config.js';
Expand All @@ -15,6 +13,11 @@ export default (opts: BaseCommandOptions) => {
command.option('-n, --namespace [string]', 'The namespace of the feature flag.');
command.option('-f --force', 'Flag to force the deletion (skip confirmation).');
command.option('--suppress-warnings', 'This flag suppresses any warnings produced by composition.');
command.option(
'--disable-resolvability-validation',
'This flag will disable the validation for whether all nodes of the federated graph are resolvable. Do NOT use unless troubleshooting.',
);

command.action(async (name, options) => {
if (!options.force) {
const deletionConfirmed = await inquirer.prompt({
Expand All @@ -32,6 +35,7 @@ export default (opts: BaseCommandOptions) => {

const resp = await opts.client.platform.deleteFeatureFlag(
{
disableResolvabilityValidation: options.disableResolvabilityValidation,
name,
namespace: options.namespace,
},
Expand Down
9 changes: 6 additions & 3 deletions cli/src/commands/feature-flag/commands/disable.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { EnumStatusCode } from '@wundergraph/cosmo-connect/dist/common/common_pb';
import { Command } from 'commander';
import ora from 'ora';
import pc from 'picocolors';
import Table from 'cli-table3';
import { getBaseHeaders } from '../../../core/config.js';
import { BaseCommandOptions } from '../../../core/types/types.js';
import { handleCompositionResult } from '../../../handle-composition-result.js';
Expand All @@ -13,14 +11,19 @@ export default (opts: BaseCommandOptions) => {
command.argument('<name>', 'The name of the feature flag to disable.');
command.option('-n, --namespace [string]', 'The namespace of the feature flag.');
command.option('--suppress-warnings', 'This flag suppresses any warnings produced by composition.');
command.option(
'--disable-resolvability-validation',
'This flag will disable the validation for whether all nodes of the federated graph are resolvable. Do NOT use unless troubleshooting.',
);

command.action(async (name, options) => {
const spinner = ora(`The feature flag "${name}" is being disabled...`).start();
const resp = await opts.client.platform.enableFeatureFlag(
{
disableResolvabilityValidation: options.disableResolvabilityValidation,
enabled: false,
name,
namespace: options.namespace,
enabled: false,
},
{
headers: getBaseHeaders(),
Expand Down
9 changes: 6 additions & 3 deletions cli/src/commands/feature-flag/commands/enable.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { EnumStatusCode } from '@wundergraph/cosmo-connect/dist/common/common_pb';
import { Command } from 'commander';
import ora from 'ora';
import pc from 'picocolors';
import Table from 'cli-table3';
import { getBaseHeaders } from '../../../core/config.js';
import { BaseCommandOptions } from '../../../core/types/types.js';
import { handleCompositionResult } from '../../../handle-composition-result.js';
Expand All @@ -13,14 +11,19 @@ export default (opts: BaseCommandOptions) => {
command.argument('<name>', 'The name of the feature flag to enable.');
command.option('-n, --namespace [string]', 'The namespace of the feature flag.');
command.option('--suppress-warnings', 'This flag suppresses any warnings produced by composition.');
command.option(
'--disable-resolvability-validation',
'This flag will disable the validation for whether all nodes of the federated graph are resolvable. Do NOT use unless troubleshooting.',
);

command.action(async (name, options) => {
const spinner = ora(`The feature flag "${name}" is being enabled...`).start();
const resp = await opts.client.platform.enableFeatureFlag(
{
disableResolvabilityValidation: options.disableResolvabilityValidation,
enabled: true,
name,
namespace: options.namespace,
enabled: true,
},
{
headers: getBaseHeaders(),
Expand Down
9 changes: 7 additions & 2 deletions cli/src/commands/feature-flag/commands/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ export default (opts: BaseCommandOptions) => {
);
command.option('-j, --json', 'Prints to the console in json format instead of table');
command.option('--suppress-warnings', 'This flag suppresses any warnings produced by composition.');
command.option(
'--disable-resolvability-validation',
'This flag will disable the validation for whether all nodes of the federated graph are resolvable. Do NOT use unless troubleshooting.',
);

command.action(async (name, options) => {
if (options.featureGraphs && options.featureSubgraphs.length === 0) {
Expand All @@ -47,10 +51,11 @@ export default (opts: BaseCommandOptions) => {
}
const resp = await opts.client.platform.updateFeatureFlag(
{
disableResolvabilityValidation: options.disableResolvabilityValidation,
featureSubgraphNames: options.featureSubgraphs,
labels: options.label ? options.label.map((label: string) => splitLabel(label)) : [],
name,
namespace: options.namespace,
labels: options.label ? options.label.map((label: string) => splitLabel(label)) : [],
featureSubgraphNames: options.featureSubgraphs,
unsetLabels: options.unsetLabels,
},
{
Expand Down
19 changes: 11 additions & 8 deletions cli/src/commands/feature-subgraph/commands/publish.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { readFile } from 'node:fs/promises';
import { existsSync } from 'node:fs';
import Table from 'cli-table3';
import { Command, program } from 'commander';
import ora from 'ora';
import { resolve } from 'pathe';
import pc from 'picocolors';
import { EnumStatusCode } from '@wundergraph/cosmo-connect/dist/common/common_pb';
import { parseGraphQLSubscriptionProtocol, parseGraphQLWebsocketSubprotocol } from '@wundergraph/cosmo-shared';
import { BaseCommandOptions, SubgraphCommandJsonOutput } from '../../../core/types/types.js';
import { BaseCommandOptions } from '../../../core/types/types.js';
import { getBaseHeaders } from '../../../core/config.js';
import { validateSubscriptionProtocols } from '../../../utils.js';
import { websocketSubprotocolDescription } from '../../../constants.js';
Expand Down Expand Up @@ -62,6 +60,10 @@ export default (opts: BaseCommandOptions) => {
command.option('-r, --raw', 'Prints to the console in json format instead of table');
command.option('-j, --json', 'Prints to the console in json format instead of table');
command.option('--suppress-warnings', 'This flag suppresses any warnings produced by composition.');
command.option(
'--disable-resolvability-validation',
'This flag will disable the validation for whether all nodes of the federated graph are resolvable. Do NOT use unless troubleshooting.',
);

command.action(async (name, options) => {
const schemaFile = resolve(options.schema);
Expand Down Expand Up @@ -94,22 +96,23 @@ export default (opts: BaseCommandOptions) => {

const resp = await opts.client.platform.publishFederatedSubgraph(
{
baseSubgraphName: options.subgraph,
disableResolvabilityValidation: options.disableResolvabilityValidation,
isFeatureSubgraph: true,
labels: [],
name,
namespace: options.namespace,
// Publish schema only
schema,
// Optional when feature subgraph does not exist yet
routingUrl: options.routingUrl,
subscriptionUrl: options.subscriptionUrl,
schema,
subscriptionProtocol: options.subscriptionProtocol
? parseGraphQLSubscriptionProtocol(options.subscriptionProtocol)
: undefined,
subscriptionUrl: options.subscriptionUrl,
websocketSubprotocol: options.websocketSubprotocol
? parseGraphQLWebsocketSubprotocol(options.websocketSubprotocol)
: undefined,
labels: [],
isFeatureSubgraph: true,
baseSubgraphName: options.subgraph,
},
{
headers: getBaseHeaders(),
Expand Down
6 changes: 6 additions & 0 deletions cli/src/commands/graph/common/version/commands/set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@ export default (opts: CommonGraphCommandOptions) => {
command.requiredOption('-v, --version [number]', `The router compatibility version to set for the ${graphType}.`);
command.option('-n, --namespace [string]', `The namespace of the ${graphType}.`);
command.option('--suppress-warnings', 'This flag suppresses any warnings produced by composition.');
command.option(
'--disable-resolvability-validation',
'This flag will disable the validation for whether all nodes of the federated graph are resolvable. Do NOT use unless troubleshooting.',
);

command.action(async (name, options) => {
const spinner = ora(`Attempting to set router compatibility version ${options.version}...`).start();

const response = await opts.client.platform.setGraphRouterCompatibilityVersion(
{
disableResolvabilityValidation: options.disableResolvabilityValidation,
name,
namespace: options.namespace,
version: options.version,
Expand Down
7 changes: 6 additions & 1 deletion cli/src/commands/graph/federated-graph/commands/check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,18 @@ export default (opts: BaseCommandOptions) => {
'The label matchers to the federated graph with which the check is to be performed',
);
command.option('--suppress-warnings', 'This flag suppresses any warnings produced by composition.');
command.option(
'--disable-resolvability-validation',
'This flag will disable the validation for whether all nodes of the federated graph are resolvable. Do NOT use unless troubleshooting.',
);

command.action(async (name, options) => {
let success = false;
const resp = await opts.client.platform.checkFederatedGraph(
{
name,
disableResolvabilityValidation: options.disableResolvabilityValidation,
labelMatchers: options.labelMatcher,
name,
namespace: options.namespace,
},
{
Expand Down
16 changes: 11 additions & 5 deletions cli/src/commands/graph/federated-graph/commands/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ export default (opts: BaseCommandOptions) => {
);
command.option('--readme <path-to-readme>', 'The markdown file which describes the federated graph.');
command.option('--suppress-warnings', 'This flag suppresses any warnings produced by composition.');
command.option(
'--disable-resolvability-validation',
'This flag will disable the validation for whether all nodes of the federated graph are resolvable. Do NOT use unless troubleshooting.',
);

command.action(async (name, options) => {
let readmeFile;
if (options.readme) {
Expand All @@ -52,13 +57,14 @@ export default (opts: BaseCommandOptions) => {

const resp = await opts.client.platform.createFederatedGraph(
{
name,
routingUrl: options.routingUrl,
admissionWebhookSecret: options.admissionWebhookSecret,
admissionWebhookURL: options.admissionWebhookUrl,
disableResolvabilityValidation: options.disableResolvabilityValidation,
labelMatchers: options.labelMatcher,
readme: readmeFile ? await readFile(readmeFile, 'utf8') : undefined,
name,
namespace: options.namespace,
admissionWebhookURL: options.admissionWebhookUrl,
admissionWebhookSecret: options.admissionWebhookSecret,
readme: readmeFile ? await readFile(readmeFile, 'utf8') : undefined,
routingUrl: options.routingUrl,
},
{
headers: getBaseHeaders(),
Expand Down
14 changes: 10 additions & 4 deletions cli/src/commands/graph/federated-graph/commands/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ export default (opts: BaseCommandOptions) => {
);
command.option('--suppress-warnings', 'This flag suppresses any warnings produced by composition.');
command.option('--readme <path-to-readme>', 'The markdown file which describes the subgraph.');
command.option(
'--disable-resolvability-validation',
'This flag will disable the validation for whether all nodes of the federated graph are resolvable. Do NOT use unless troubleshooting.',
);

command.action(async (name, options) => {
let readmeFile;
if (options.readme) {
Expand All @@ -52,14 +57,15 @@ export default (opts: BaseCommandOptions) => {
const spinner = ora('Federated Graph is being updated...').start();
const resp = await opts.client.platform.updateFederatedGraph(
{
admissionWebhookSecret: options.admissionWebhookSecret,
admissionWebhookURL: options.admissionWebhookUrl,
disableResolvabilityValidation: options.disableResolvabilityValidation,
labelMatchers: options.labelMatcher,
name,
namespace: options.namespace,
readme: readmeFile ? await readFile(readmeFile, 'utf8') : undefined,
routingUrl: options.routingUrl,
labelMatchers: options.labelMatcher,
admissionWebhookURL: options.admissionWebhookUrl,
admissionWebhookSecret: options.admissionWebhookSecret,
unsetLabelMatchers: options.unsetLabelMatchers,
readme: readmeFile ? await readFile(readmeFile, 'utf8') : undefined,
},
{
headers: getBaseHeaders(),
Expand Down
Loading
Loading