@kontent-ai/webhook-helper
Version:
This utility helps with webhook notifications from Kontent.ai
792 lines (791 loc) • 24.8 kB
TypeScript
import { z } from "zod";
export declare const webhookDeliverySlotSchema: z.ZodEnum<{
published: "published";
preview: "preview";
}>;
export declare const assetEventsSchema: z.ZodEnum<{
created: "created";
deleted: "deleted";
metadata_changed: "metadata_changed";
}>;
export declare const contentItemPreviewEventsSchema: z.ZodEnum<{
created: "created";
deleted: "deleted";
metadata_changed: "metadata_changed";
workflow_step_changed: "workflow_step_changed";
}>;
export declare const contentItemPublishedEventsSchema: z.ZodEnum<{
published: "published";
metadata_changed: "metadata_changed";
unpublished: "unpublished";
}>;
export declare const contentTypeEventsSchema: z.ZodEnum<{
created: "created";
deleted: "deleted";
changed: "changed";
}>;
export declare const languageEventsSchema: z.ZodEnum<{
created: "created";
deleted: "deleted";
changed: "changed";
}>;
export declare const taxonomyEventsSchema: z.ZodEnum<{
created: "created";
deleted: "deleted";
metadata_changed: "metadata_changed";
term_created: "term_created";
term_changed: "term_changed";
term_deleted: "term_deleted";
terms_moved: "terms_moved";
}>;
export declare const webhookObjectDataSchema: z.ZodObject<{
id: z.ZodString;
name: z.ZodString;
codename: z.ZodString;
last_modified: z.ZodString;
}, z.core.$strip>;
export declare const webhookItemObjectDataSchema: z.ZodObject<{
id: z.ZodString;
name: z.ZodString;
codename: z.ZodString;
last_modified: z.ZodString;
collection: z.ZodString;
workflow: z.ZodString;
workflow_step: z.ZodString;
language: z.ZodString;
type: z.ZodString;
}, z.core.$strip>;
export declare const assetMessageSchema: z.ZodObject<{
environment_id: z.ZodString;
delivery_slot: z.ZodEnum<{
published: "published";
preview: "preview";
}>;
object_type: z.ZodLiteral<"asset">;
action: z.ZodEnum<{
created: "created";
deleted: "deleted";
metadata_changed: "metadata_changed";
}>;
}, z.core.$strip>;
export declare const contentItemPreviewMessageSchema: z.ZodObject<{
environment_id: z.ZodString;
object_type: z.ZodLiteral<"content_item">;
delivery_slot: z.ZodLiteral<"preview">;
action: z.ZodEnum<{
created: "created";
deleted: "deleted";
metadata_changed: "metadata_changed";
}>;
}, z.core.$strip>;
export declare const contentItemWorkflowChangedPreviewMessageSchema: z.ZodObject<{
environment_id: z.ZodString;
object_type: z.ZodLiteral<"content_item">;
delivery_slot: z.ZodLiteral<"preview">;
action: z.ZodLiteral<"workflow_step_changed">;
action_context: z.ZodObject<{
previous_workflow: z.ZodString;
previous_workflow_step: z.ZodString;
}, z.core.$strip>;
}, z.core.$strip>;
export declare const contentItemPublishedMessageSchema: z.ZodObject<{
environment_id: z.ZodString;
object_type: z.ZodLiteral<"content_item">;
action: z.ZodEnum<{
published: "published";
metadata_changed: "metadata_changed";
unpublished: "unpublished";
}>;
delivery_slot: z.ZodLiteral<"published">;
}, z.core.$strip>;
export declare const contentTypeMessageSchema: z.ZodObject<{
environment_id: z.ZodString;
delivery_slot: z.ZodEnum<{
published: "published";
preview: "preview";
}>;
object_type: z.ZodLiteral<"content_type">;
action: z.ZodEnum<{
created: "created";
deleted: "deleted";
changed: "changed";
}>;
}, z.core.$strip>;
export declare const languageMessageSchema: z.ZodObject<{
environment_id: z.ZodString;
delivery_slot: z.ZodEnum<{
published: "published";
preview: "preview";
}>;
object_type: z.ZodLiteral<"language">;
action: z.ZodEnum<{
created: "created";
deleted: "deleted";
changed: "changed";
}>;
}, z.core.$strip>;
export declare const taxonomyMessageSchema: z.ZodObject<{
environment_id: z.ZodString;
delivery_slot: z.ZodEnum<{
published: "published";
preview: "preview";
}>;
object_type: z.ZodLiteral<"taxonomy">;
action: z.ZodEnum<{
created: "created";
deleted: "deleted";
metadata_changed: "metadata_changed";
term_created: "term_created";
term_changed: "term_changed";
term_deleted: "term_deleted";
terms_moved: "terms_moved";
}>;
}, z.core.$strip>;
export declare const webhookMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
environment_id: z.ZodString;
object_type: z.ZodLiteral<"content_item">;
delivery_slot: z.ZodLiteral<"preview">;
action: z.ZodEnum<{
created: "created";
deleted: "deleted";
metadata_changed: "metadata_changed";
}>;
}, z.core.$strip>, z.ZodObject<{
environment_id: z.ZodString;
object_type: z.ZodLiteral<"content_item">;
delivery_slot: z.ZodLiteral<"preview">;
action: z.ZodLiteral<"workflow_step_changed">;
action_context: z.ZodObject<{
previous_workflow: z.ZodString;
previous_workflow_step: z.ZodString;
}, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
environment_id: z.ZodString;
object_type: z.ZodLiteral<"content_item">;
action: z.ZodEnum<{
published: "published";
metadata_changed: "metadata_changed";
unpublished: "unpublished";
}>;
delivery_slot: z.ZodLiteral<"published">;
}, z.core.$strip>, z.ZodObject<{
environment_id: z.ZodString;
delivery_slot: z.ZodEnum<{
published: "published";
preview: "preview";
}>;
object_type: z.ZodLiteral<"asset">;
action: z.ZodEnum<{
created: "created";
deleted: "deleted";
metadata_changed: "metadata_changed";
}>;
}, z.core.$strip>, z.ZodObject<{
environment_id: z.ZodString;
delivery_slot: z.ZodEnum<{
published: "published";
preview: "preview";
}>;
object_type: z.ZodLiteral<"content_type">;
action: z.ZodEnum<{
created: "created";
deleted: "deleted";
changed: "changed";
}>;
}, z.core.$strip>, z.ZodObject<{
environment_id: z.ZodString;
delivery_slot: z.ZodEnum<{
published: "published";
preview: "preview";
}>;
object_type: z.ZodLiteral<"language">;
action: z.ZodEnum<{
created: "created";
deleted: "deleted";
changed: "changed";
}>;
}, z.core.$strip>, z.ZodObject<{
environment_id: z.ZodString;
delivery_slot: z.ZodEnum<{
published: "published";
preview: "preview";
}>;
object_type: z.ZodLiteral<"taxonomy">;
action: z.ZodEnum<{
created: "created";
deleted: "deleted";
metadata_changed: "metadata_changed";
term_created: "term_created";
term_changed: "term_changed";
term_deleted: "term_deleted";
terms_moved: "terms_moved";
}>;
}, z.core.$strip>], "object_type">;
declare const assetNotificationSchema: z.ZodPipe<z.ZodObject<{
data: z.ZodObject<{
system: z.ZodObject<{
id: z.ZodString;
name: z.ZodString;
codename: z.ZodString;
last_modified: z.ZodString;
}, z.core.$strip>;
}, z.core.$strip>;
message: z.ZodObject<{
environment_id: z.ZodString;
delivery_slot: z.ZodEnum<{
published: "published";
preview: "preview";
}>;
object_type: z.ZodLiteral<"asset">;
action: z.ZodEnum<{
created: "created";
deleted: "deleted";
metadata_changed: "metadata_changed";
}>;
}, z.core.$strip>;
}, z.core.$strip>, z.ZodTransform<{
object_type: "asset";
data: {
system: {
id: string;
name: string;
codename: string;
last_modified: string;
};
};
message: {
environment_id: string;
delivery_slot: "published" | "preview";
object_type: "asset";
action: "created" | "deleted" | "metadata_changed";
};
}, {
data: {
system: {
id: string;
name: string;
codename: string;
last_modified: string;
};
};
message: {
environment_id: string;
delivery_slot: "published" | "preview";
object_type: "asset";
action: "created" | "deleted" | "metadata_changed";
};
}>>;
declare const contentItemNotificationSchema: z.ZodPipe<z.ZodObject<{
data: z.ZodObject<{
system: z.ZodObject<{
id: z.ZodString;
name: z.ZodString;
codename: z.ZodString;
last_modified: z.ZodString;
collection: z.ZodString;
workflow: z.ZodString;
workflow_step: z.ZodString;
language: z.ZodString;
type: z.ZodString;
}, z.core.$strip>;
}, z.core.$strip>;
message: z.ZodUnion<readonly [z.ZodObject<{
environment_id: z.ZodString;
object_type: z.ZodLiteral<"content_item">;
delivery_slot: z.ZodLiteral<"preview">;
action: z.ZodEnum<{
created: "created";
deleted: "deleted";
metadata_changed: "metadata_changed";
}>;
}, z.core.$strip>, z.ZodObject<{
environment_id: z.ZodString;
object_type: z.ZodLiteral<"content_item">;
action: z.ZodEnum<{
published: "published";
metadata_changed: "metadata_changed";
unpublished: "unpublished";
}>;
delivery_slot: z.ZodLiteral<"published">;
}, z.core.$strip>, z.ZodObject<{
environment_id: z.ZodString;
object_type: z.ZodLiteral<"content_item">;
delivery_slot: z.ZodLiteral<"preview">;
action: z.ZodLiteral<"workflow_step_changed">;
action_context: z.ZodObject<{
previous_workflow: z.ZodString;
previous_workflow_step: z.ZodString;
}, z.core.$strip>;
}, z.core.$strip>]>;
}, z.core.$strip>, z.ZodTransform<{
object_type: "content_item";
data: {
system: {
id: string;
name: string;
codename: string;
last_modified: string;
collection: string;
workflow: string;
workflow_step: string;
language: string;
type: string;
};
};
message: {
environment_id: string;
object_type: "content_item";
delivery_slot: "preview";
action: "created" | "deleted" | "metadata_changed";
} | {
environment_id: string;
object_type: "content_item";
delivery_slot: "preview";
action: "workflow_step_changed";
action_context: {
previous_workflow: string;
previous_workflow_step: string;
};
} | {
environment_id: string;
object_type: "content_item";
action: "published" | "metadata_changed" | "unpublished";
delivery_slot: "published";
};
}, {
data: {
system: {
id: string;
name: string;
codename: string;
last_modified: string;
collection: string;
workflow: string;
workflow_step: string;
language: string;
type: string;
};
};
message: {
environment_id: string;
object_type: "content_item";
delivery_slot: "preview";
action: "created" | "deleted" | "metadata_changed";
} | {
environment_id: string;
object_type: "content_item";
delivery_slot: "preview";
action: "workflow_step_changed";
action_context: {
previous_workflow: string;
previous_workflow_step: string;
};
} | {
environment_id: string;
object_type: "content_item";
action: "published" | "metadata_changed" | "unpublished";
delivery_slot: "published";
};
}>>;
declare const contentTypeNotificationSchema: z.ZodPipe<z.ZodObject<{
data: z.ZodObject<{
system: z.ZodObject<{
id: z.ZodString;
name: z.ZodString;
codename: z.ZodString;
last_modified: z.ZodString;
}, z.core.$strip>;
}, z.core.$strip>;
message: z.ZodObject<{
environment_id: z.ZodString;
delivery_slot: z.ZodEnum<{
published: "published";
preview: "preview";
}>;
object_type: z.ZodLiteral<"content_type">;
action: z.ZodEnum<{
created: "created";
deleted: "deleted";
changed: "changed";
}>;
}, z.core.$strip>;
}, z.core.$strip>, z.ZodTransform<{
object_type: "content_type";
data: {
system: {
id: string;
name: string;
codename: string;
last_modified: string;
};
};
message: {
environment_id: string;
delivery_slot: "published" | "preview";
object_type: "content_type";
action: "created" | "deleted" | "changed";
};
}, {
data: {
system: {
id: string;
name: string;
codename: string;
last_modified: string;
};
};
message: {
environment_id: string;
delivery_slot: "published" | "preview";
object_type: "content_type";
action: "created" | "deleted" | "changed";
};
}>>;
declare const languageNotificationSchema: z.ZodPipe<z.ZodObject<{
data: z.ZodObject<{
system: z.ZodObject<{
id: z.ZodString;
name: z.ZodString;
codename: z.ZodString;
last_modified: z.ZodString;
}, z.core.$strip>;
}, z.core.$strip>;
message: z.ZodObject<{
environment_id: z.ZodString;
delivery_slot: z.ZodEnum<{
published: "published";
preview: "preview";
}>;
object_type: z.ZodLiteral<"language">;
action: z.ZodEnum<{
created: "created";
deleted: "deleted";
changed: "changed";
}>;
}, z.core.$strip>;
}, z.core.$strip>, z.ZodTransform<{
object_type: "language";
data: {
system: {
id: string;
name: string;
codename: string;
last_modified: string;
};
};
message: {
environment_id: string;
delivery_slot: "published" | "preview";
object_type: "language";
action: "created" | "deleted" | "changed";
};
}, {
data: {
system: {
id: string;
name: string;
codename: string;
last_modified: string;
};
};
message: {
environment_id: string;
delivery_slot: "published" | "preview";
object_type: "language";
action: "created" | "deleted" | "changed";
};
}>>;
declare const taxonomyNotificationSchema: z.ZodPipe<z.ZodObject<{
data: z.ZodObject<{
system: z.ZodObject<{
id: z.ZodString;
name: z.ZodString;
codename: z.ZodString;
last_modified: z.ZodString;
}, z.core.$strip>;
}, z.core.$strip>;
message: z.ZodObject<{
environment_id: z.ZodString;
delivery_slot: z.ZodEnum<{
published: "published";
preview: "preview";
}>;
object_type: z.ZodLiteral<"taxonomy">;
action: z.ZodEnum<{
created: "created";
deleted: "deleted";
metadata_changed: "metadata_changed";
term_created: "term_created";
term_changed: "term_changed";
term_deleted: "term_deleted";
terms_moved: "terms_moved";
}>;
}, z.core.$strip>;
}, z.core.$strip>, z.ZodTransform<{
object_type: "taxonomy";
data: {
system: {
id: string;
name: string;
codename: string;
last_modified: string;
};
};
message: {
environment_id: string;
delivery_slot: "published" | "preview";
object_type: "taxonomy";
action: "created" | "deleted" | "metadata_changed" | "term_created" | "term_changed" | "term_deleted" | "terms_moved";
};
}, {
data: {
system: {
id: string;
name: string;
codename: string;
last_modified: string;
};
};
message: {
environment_id: string;
delivery_slot: "published" | "preview";
object_type: "taxonomy";
action: "created" | "deleted" | "metadata_changed" | "term_created" | "term_changed" | "term_deleted" | "terms_moved";
};
}>>;
export type UnknownNotification = {
object_type: "unknown";
original_notification: Record<PropertyKey, unknown>;
};
export declare const webhookNotificationSchema: z.ZodPipe<z.ZodUnknown, z.ZodTransform<{
object_type: "asset";
data: {
system: {
id: string;
name: string;
codename: string;
last_modified: string;
};
};
message: {
environment_id: string;
delivery_slot: "published" | "preview";
object_type: "asset";
action: "created" | "deleted" | "metadata_changed";
};
} | {
object_type: "content_item";
data: {
system: {
id: string;
name: string;
codename: string;
last_modified: string;
collection: string;
workflow: string;
workflow_step: string;
language: string;
type: string;
};
};
message: {
environment_id: string;
object_type: "content_item";
delivery_slot: "preview";
action: "created" | "deleted" | "metadata_changed";
} | {
environment_id: string;
object_type: "content_item";
delivery_slot: "preview";
action: "workflow_step_changed";
action_context: {
previous_workflow: string;
previous_workflow_step: string;
};
} | {
environment_id: string;
object_type: "content_item";
action: "published" | "metadata_changed" | "unpublished";
delivery_slot: "published";
};
} | {
object_type: "content_type";
data: {
system: {
id: string;
name: string;
codename: string;
last_modified: string;
};
};
message: {
environment_id: string;
delivery_slot: "published" | "preview";
object_type: "content_type";
action: "created" | "deleted" | "changed";
};
} | {
object_type: "language";
data: {
system: {
id: string;
name: string;
codename: string;
last_modified: string;
};
};
message: {
environment_id: string;
delivery_slot: "published" | "preview";
object_type: "language";
action: "created" | "deleted" | "changed";
};
} | {
object_type: "taxonomy";
data: {
system: {
id: string;
name: string;
codename: string;
last_modified: string;
};
};
message: {
environment_id: string;
delivery_slot: "published" | "preview";
object_type: "taxonomy";
action: "created" | "deleted" | "metadata_changed" | "term_created" | "term_changed" | "term_deleted" | "terms_moved";
};
} | {
object_type: "unknown";
original_notification: Record<PropertyKey, unknown>;
}, unknown>>;
export declare const webhookResponseSchema: z.ZodObject<{
notifications: z.ZodArray<z.ZodPipe<z.ZodUnknown, z.ZodTransform<{
object_type: "asset";
data: {
system: {
id: string;
name: string;
codename: string;
last_modified: string;
};
};
message: {
environment_id: string;
delivery_slot: "published" | "preview";
object_type: "asset";
action: "created" | "deleted" | "metadata_changed";
};
} | {
object_type: "content_item";
data: {
system: {
id: string;
name: string;
codename: string;
last_modified: string;
collection: string;
workflow: string;
workflow_step: string;
language: string;
type: string;
};
};
message: {
environment_id: string;
object_type: "content_item";
delivery_slot: "preview";
action: "created" | "deleted" | "metadata_changed";
} | {
environment_id: string;
object_type: "content_item";
delivery_slot: "preview";
action: "workflow_step_changed";
action_context: {
previous_workflow: string;
previous_workflow_step: string;
};
} | {
environment_id: string;
object_type: "content_item";
action: "published" | "metadata_changed" | "unpublished";
delivery_slot: "published";
};
} | {
object_type: "content_type";
data: {
system: {
id: string;
name: string;
codename: string;
last_modified: string;
};
};
message: {
environment_id: string;
delivery_slot: "published" | "preview";
object_type: "content_type";
action: "created" | "deleted" | "changed";
};
} | {
object_type: "language";
data: {
system: {
id: string;
name: string;
codename: string;
last_modified: string;
};
};
message: {
environment_id: string;
delivery_slot: "published" | "preview";
object_type: "language";
action: "created" | "deleted" | "changed";
};
} | {
object_type: "taxonomy";
data: {
system: {
id: string;
name: string;
codename: string;
last_modified: string;
};
};
message: {
environment_id: string;
delivery_slot: "published" | "preview";
object_type: "taxonomy";
action: "created" | "deleted" | "metadata_changed" | "term_created" | "term_changed" | "term_deleted" | "terms_moved";
};
} | {
object_type: "unknown";
original_notification: Record<PropertyKey, unknown>;
}, unknown>>>;
}, z.core.$strip>;
export type WebhookDeliverySlot = z.infer<typeof webhookDeliverySlotSchema>;
export type AssetEvents = z.infer<typeof assetEventsSchema>;
export type ContentItemPreviewEvents = z.infer<typeof contentItemPreviewEventsSchema>;
export type ContentItemPublishedEvents = z.infer<typeof contentItemPublishedEventsSchema>;
export type ContentTypeEvents = z.infer<typeof contentTypeEventsSchema>;
export type LanguageEvents = z.infer<typeof languageEventsSchema>;
export type TaxonomyEvents = z.infer<typeof taxonomyEventsSchema>;
export type WebhookObjectData = z.infer<typeof webhookObjectDataSchema>;
export type WebhookItemObjectData = z.infer<typeof webhookItemObjectDataSchema>;
export type AssetMessage = z.infer<typeof assetMessageSchema>;
export type ContentItemPreviewMessage = z.infer<typeof contentItemPreviewMessageSchema>;
export type ContentItemWorkflowChangedPreviewMessage = z.infer<typeof contentItemWorkflowChangedPreviewMessageSchema>;
export type ContentItemPublishedMessage = z.infer<typeof contentItemPublishedMessageSchema>;
export type ContentTypeMessage = z.infer<typeof contentTypeMessageSchema>;
export type LanguageMessage = z.infer<typeof languageMessageSchema>;
export type TaxonomyMessage = z.infer<typeof taxonomyMessageSchema>;
export type AssetNotification = z.infer<typeof assetNotificationSchema>;
export type ContentItemNotification = z.infer<typeof contentItemNotificationSchema>;
export type ContentTypeNotification = z.infer<typeof contentTypeNotificationSchema>;
export type LanguageNotification = z.infer<typeof languageNotificationSchema>;
export type TaxonomyNotification = z.infer<typeof taxonomyNotificationSchema>;
export type WebhookNotification = z.infer<typeof webhookNotificationSchema>;
export type WebhookResponse = z.infer<typeof webhookResponseSchema>;
export {};