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
1 change: 1 addition & 0 deletions controlplane/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"fastify-plugin": "^4.5.1",
"fastify-raw-body": "^4.3.0",
"graphql": "^16.9.0",
"http-proxy-agent": "8.0.0",
"https-proxy-agent": "8.0.0",
"ioredis": "^5.4.1",
"isomorphic-dompurify": "^2.33.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ export function createContract(
disableResolvabilityValidation: req.disableResolvabilityValidation,
},
federatedGraphs: [{ ...contractGraph, contract }],
webhookProxyUrl: opts.webhookProxyUrl,
});

compositionErrors.push(...composition.compositionErrors);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ export function updateContract(
disableResolvabilityValidation: req.disableResolvabilityValidation,
ignoreExternalKeys,
},
webhookProxyUrl: opts.webhookProxyUrl,
});

const compositionErrors: PlainMessage<CompositionError>[] = [];
Expand Down Expand Up @@ -187,6 +188,7 @@ export function updateContract(
},
},
],
webhookProxyUrl: opts.webhookProxyUrl,
});

compositionErrors.push(...composition.compositionErrors);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ export function createFeatureFlag(
ignoreExternalKeys: ignoreExternalKeysFeature?.enabled ?? false,
},
federatedGraphs,
webhookProxyUrl: opts.webhookProxyUrl,
});

compositionErrors.push(...composition.compositionErrors);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export function deleteFeatureFlag(
ignoreExternalKeys: ignoreExternalKeysFeature?.enabled ?? false,
},
federatedGraphs,
webhookProxyUrl: opts.webhookProxyUrl,
});

compositionErrors.push(...composition.compositionErrors);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export function enableFeatureFlag(
ignoreExternalKeys: ignoreExternalKeysFeature?.enabled ?? false,
},
federatedGraphs,
webhookProxyUrl: opts.webhookProxyUrl,
});

compositionErrors.push(...composition.compositionErrors);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ export function updateFeatureFlag(
ignoreExternalKeys: ignoreExternalKeysFeature?.enabled ?? false,
},
federatedGraphs: allFederatedGraphsToCompose,
webhookProxyUrl: opts.webhookProxyUrl,
});

compositionErrors.push(...composition.compositionErrors);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ export function createFederatedGraph(
ignoreExternalKeys: ignoreExternalKeysFeature?.enabled ?? false,
},
federatedGraphs: [federatedGraph],
webhookProxyUrl: opts.webhookProxyUrl,
});

compositionErrors.push(...composition.compositionErrors);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ export function migrateFromApollo(
disableResolvabilityValidation: true,
ignoreExternalKeys: ignoreExternalKeysFeature?.enabled ?? false,
},
webhookProxyUrl: opts.webhookProxyUrl,
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ export function moveFederatedGraph(
jwtSecret: opts.admissionWebhookJWTSecret,
},
opts.chClient!,
undefined,
opts.webhookProxyUrl,
);

const allDeploymentErrors: PlainMessage<DeploymentError>[] = [];
Expand Down Expand Up @@ -164,6 +166,8 @@ export function moveFederatedGraph(
jwtSecret: opts.admissionWebhookJWTSecret,
},
opts.chClient!,
undefined,
opts.webhookProxyUrl,
);

allCompositionErrors.push(...contractErrors);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export function updateFederatedGraph(
targetId: federatedGraph.targetId,
unsetLabelMatchers: req.unsetLabelMatchers,
updatedBy: authContext.userId,
webhookProxyUrl: opts.webhookProxyUrl,
});

if (result?.deploymentErrors) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export function recomposeGraph(
ignoreExternalKeys,
},
federatedGraphs: [graph],
webhookProxyUrl: opts.webhookProxyUrl,
});

sendOrgWebhooks({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export function setGraphRouterCompatibilityVersion(
ignoreExternalKeys: ignoreExternalKeysFeature?.enabled ?? false,
},
federatedGraphs: [federatedGraph],
webhookProxyUrl: opts.webhookProxyUrl,
});

if (composition.compositionErrors.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ export function publishMonograph(
webhookJWTSecret: opts.admissionWebhookJWTSecret,
},
opts.chClient!,
undefined,
opts.webhookProxyUrl,
);

for (const graph of updatedFederatedGraphs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ export function updateMonograph(
admissionWebhookURL: req.admissionWebhookURL,
admissionWebhookSecret: req.admissionWebhookSecret,
chClient: opts.chClient!,
webhookProxyUrl: opts.webhookProxyUrl,
});

await subgraphRepo.update(
Expand All @@ -174,6 +175,8 @@ export function updateMonograph(
webhookJWTSecret: opts.admissionWebhookJWTSecret,
},
opts.chClient!,
undefined,
opts.webhookProxyUrl,
);

await auditLogRepo.addAuditLog({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ export function createProposal(
contractRepo,
graphCompostionRepo,
opts.chClient,
opts.webhookProxyUrl,
);

const {
Expand Down Expand Up @@ -446,6 +447,7 @@ export function createProposal(
opts.billingDefaultPlanId,
opts.webhookProxyUrl,
),
webhookProxyUrl: opts.webhookProxyUrl,
});

if (checkId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ export function updateProposal(
contractRepo,
graphCompostionRepo,
opts.chClient,
opts.webhookProxyUrl,
);

const {
Expand Down Expand Up @@ -515,6 +516,7 @@ export function updateProposal(
opts.billingDefaultPlanId,
opts.webhookProxyUrl,
),
webhookProxyUrl: opts.webhookProxyUrl,
});

if (checkId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ export function checkSubgraphSchema(
ignoreExternalKeys,
},
webhookService,
webhookProxyUrl: opts.webhookProxyUrl,
});

// Extract variables from checkResult
Expand Down Expand Up @@ -471,6 +472,7 @@ export function checkSubgraphSchema(
ignoreExternalKeys,
},
webhookService,
webhookProxyUrl: opts.webhookProxyUrl,
});

await schemaCheckRepo.addLinkedSchemaCheck({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ export function deleteFederatedSubgraph(
ignoreExternalKeys: ignoreExternalKeysFeature?.enabled ?? false,
},
federatedGraphs: affectedFederatedGraphs,
webhookProxyUrl: opts.webhookProxyUrl,
});

// Re-fetch the federated graphs to get the updated composedSchemaVersionId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export function fixSubgraphSchema(
contractRepo,
graphCompositionRepo,
opts.chClient,
opts.webhookProxyUrl,
);

req.namespace = req.namespace || DefaultNamespace;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export function moveSubgraph(
disableResolvabilityValidation: req.disableResolvabilityValidation,
ignoreExternalKeys: ignoreExternalKeysFeature?.enabled ?? false,
},
opts.webhookProxyUrl,
);

await auditLogRepo.addAuditLog({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ export function publishFederatedSubgraph(
disableResolvabilityValidation: req.disableResolvabilityValidation,
ignoreExternalKeys: ignoreExternalKeysFeature?.enabled ?? false,
},
opts.webhookProxyUrl,
);

// if this subgraph is part of a proposal, mark the proposal subgraph as published
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ export function updateSubgraph(
disableResolvabilityValidation: req.disableResolvabilityValidation,
ignoreExternalKeys: ignoreExternalKeysFeature?.enabled ?? false,
},
opts.webhookProxyUrl,
);

await auditLogRepo.addAuditLog({
Expand Down
2 changes: 2 additions & 0 deletions controlplane/src/core/composition/composer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export class Composer {
private contractRepo: ContractRepository,
private graphCompositionRepository: GraphCompositionRepository,
private chClient?: ClickHouseClient,
private proxyUrl?: string,
) {}

composeRouterConfigWithFeatureFlags({
Expand Down Expand Up @@ -266,6 +267,7 @@ export class Composer {
this.logger,
admissionWebhookURL,
admissionWebhookSecret,
this.proxyUrl,
);
const resp = await admissionWebhookController.validateConfig(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ export class FederatedGraphRepository {
readme?: string;
unsetAdmissionWebhookURL?: boolean;
unsetLabelMatchers?: boolean;
webhookProxyUrl?: string;
}): Promise<
| {
compositionErrors: PlainMessage<CompositionError>[];
Expand Down Expand Up @@ -329,6 +330,7 @@ export class FederatedGraphRepository {
actorId: data.updatedBy,
chClient: data.chClient,
compositionOptions: data.compositionOptions,
webhookProxyUrl: data.webhookProxyUrl,
});

return {
Expand Down Expand Up @@ -362,6 +364,7 @@ export class FederatedGraphRepository {
},
chClient: ClickHouseClient,
compositionOptions?: CompositionOptions,
webhookProxyUrl?: string,
): Promise<{
compositionErrors: PlainMessage<CompositionError>[];
deploymentErrors: PlainMessage<DeploymentError>[];
Expand Down Expand Up @@ -422,6 +425,7 @@ export class FederatedGraphRepository {
chClient,
compositionOptions,
federatedGraphs: [movedContractGraph],
webhookProxyUrl,
});

return {
Expand All @@ -441,6 +445,7 @@ export class FederatedGraphRepository {
},
chClient,
compositionOptions,
webhookProxyUrl,
});

return {
Expand Down Expand Up @@ -1503,6 +1508,7 @@ export class FederatedGraphRepository {
chClient,
blobStorage,
federatedGraphs,
webhookProxyUrl,
}: {
actorId: string;
admissionConfig: {
Expand All @@ -1513,6 +1519,7 @@ export class FederatedGraphRepository {
chClient: ClickHouseClient;
federatedGraphs: FederatedGraphDTO[];
compositionOptions?: CompositionOptions;
webhookProxyUrl?: string;
}) => {
return this.db.transaction(async (tx) => {
const subgraphRepo = new SubgraphRepository(this.logger, tx, this.organizationId);
Expand All @@ -1528,6 +1535,7 @@ export class FederatedGraphRepository {
contractRepo,
graphCompositionRepo,
chClient,
webhookProxyUrl,
);

const allDeploymentErrors: PlainMessage<DeploymentError>[] = [];
Expand Down
3 changes: 3 additions & 0 deletions controlplane/src/core/repositories/SchemaCheckRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,7 @@ export class SchemaCheckRepository {
chClient,
skipProposalMatchCheck,
webhookService,
webhookProxyUrl,
}: {
actorId: string;
blobStorage: BlobStorage;
Expand All @@ -735,6 +736,7 @@ export class SchemaCheckRepository {
chClient?: ClickHouseClient;
skipProposalMatchCheck: boolean;
webhookService: OrganizationWebhookService;
webhookProxyUrl?: string;
}) {
const breakingChanges: SchemaChange[] = [];
const nonBreakingChanges: SchemaChange[] = [];
Expand Down Expand Up @@ -1451,6 +1453,7 @@ export class SchemaCheckRepository {
ignoreExternalKeys,
},
webhookService,
webhookProxyUrl,
});

await this.addLinkedSchemaCheck({
Expand Down
7 changes: 7 additions & 0 deletions controlplane/src/core/repositories/SubgraphRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ export class SubgraphRepository {
},
chClient: ClickHouseClient,
compositionOptions?: CompositionOptions,
webhookProxyUrl?: string,
): Promise<{
compositionErrors: PlainMessage<CompositionError>[];
compositionWarnings: PlainMessage<CompositionWarning>[];
Expand Down Expand Up @@ -475,6 +476,7 @@ export class SubgraphRepository {
chClient,
compositionOptions,
federatedGraphs: updatedFederatedGraphs.filter((g) => !g.contract),
webhookProxyUrl,
});

compositionErrors.push(...cErrors);
Expand Down Expand Up @@ -516,6 +518,7 @@ export class SubgraphRepository {
},
chClient: ClickHouseClient,
compositionOptions?: CompositionOptions,
webhookProxyUrl?: string,
): Promise<{
compositionErrors: PlainMessage<CompositionError>[];
updatedFederatedGraphs: FederatedGraphDTO[];
Expand Down Expand Up @@ -568,6 +571,7 @@ export class SubgraphRepository {
actorId: data.updatedBy,
chClient,
compositionOptions,
webhookProxyUrl,
});

// Re-fetch the federated graphs to get the updated composedSchemaVersionId
Expand Down Expand Up @@ -1863,6 +1867,7 @@ export class SubgraphRepository {
newGraphQLSchema,
compositionOptions,
webhookService,
webhookProxyUrl,
}: {
actorId: string;
blobStorage: BlobStorage;
Expand All @@ -1887,6 +1892,7 @@ export class SubgraphRepository {
newGraphQLSchema?: GraphQLSchema;
compositionOptions?: CompositionOptions;
webhookService: OrganizationWebhookService;
webhookProxyUrl?: string;
}): Promise<
PlainMessage<CheckSubgraphSchemaResponse> & {
hasClientTraffic: boolean;
Expand Down Expand Up @@ -2053,6 +2059,7 @@ export class SubgraphRepository {
contractRepo,
graphCompostionRepo,
chClient,
webhookProxyUrl,
);

const checkSubgraphs = new Map<string, CheckSubgraph>();
Expand Down
Loading
Loading