MCPcopy
hub / github.com/directus/directus / ensureDeploymentWebhooks

Function ensureDeploymentWebhooks

api/src/deployment.ts:66–95  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

64 * Called at startup to handle configs created before webhook support was added.
65 */
66export async function ensureDeploymentWebhooks(): Promise<void> {
67 const logger = useLogger();
68 const knex = getDatabase();
69 const schema = await getSchema();
70
71 const service = new DeploymentService({
72 knex,
73 schema,
74 accountability: null,
75 });
76
77 const configs = await service.readByQuery({
78 limit: -1,
79 });
80
81 if (!configs || configs.length === 0) {
82 logger.debug('[webhook] No deployment configs found');
83 return;
84 }
85
86 logger.debug(`[webhook] Syncing webhooks for ${configs.length} config(s)...`);
87
88 for (const config of configs) {
89 try {
90 await service.syncWebhook(config.provider);
91 } catch (err) {
92 logger.error(`[webhook] Failed to sync webhook for ${config.provider}: ${err}`);
93 }
94 }
95}

Callers 1

createAppFunction · 0.85

Calls 5

syncWebhookMethod · 0.95
useLoggerFunction · 0.85
getDatabaseFunction · 0.85
getSchemaFunction · 0.85
readByQueryMethod · 0.65

Tested by

no test coverage detected