From 6bd39a02dce032298f581df307034df010114b81 Mon Sep 17 00:00:00 2001 From: robjmorrissey Date: Tue, 26 Sep 2023 13:55:45 +0100 Subject: [PATCH 1/4] docs(changeset): Implement possible webhook events --- .changeset/soft-elephants-push.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/soft-elephants-push.md diff --git a/.changeset/soft-elephants-push.md b/.changeset/soft-elephants-push.md new file mode 100644 index 00000000..1c175200 --- /dev/null +++ b/.changeset/soft-elephants-push.md @@ -0,0 +1,5 @@ +--- +'@onehop/js': minor +--- + +Implement possible webhook events From c6861825ab995a9212891ccf8dd1db836be8eb23 Mon Sep 17 00:00:00 2001 From: robjmorrissey Date: Tue, 26 Sep 2023 13:55:55 +0100 Subject: [PATCH 2/4] init webhooks --- src/utils/zod/index.ts | 1 + src/utils/zod/webhooks.ts | 178 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 179 insertions(+) create mode 100644 src/utils/zod/webhooks.ts diff --git a/src/utils/zod/index.ts b/src/utils/zod/index.ts index a7c8885b..9f5b8f5b 100644 --- a/src/utils/zod/index.ts +++ b/src/utils/zod/index.ts @@ -1,3 +1,4 @@ export * from './ids.ts'; export * from './presets.ts'; export * from './ignite.ts'; +export * from './webhooks.ts'; diff --git a/src/utils/zod/webhooks.ts b/src/utils/zod/webhooks.ts new file mode 100644 index 00000000..f8592fcc --- /dev/null +++ b/src/utils/zod/webhooks.ts @@ -0,0 +1,178 @@ +export const POSSIBLE_EVENTS: Record< + string, + { + id: string; + name: string; + }[] +> = { + Channels: [ + { + id: 'channel.client.connected', + name: 'Client Connected', + }, + { + id: 'channel.client.disconnected', + name: 'Client Disconnected', + }, + { + id: 'channel.created', + name: 'Created', + }, + { + id: 'channel.deleted', + name: 'Deleted', + }, + { + id: 'channel.updated', + name: 'Updated', + }, + ], + Ignite: [ + { + id: 'ignite.deployment.created', + name: 'Deployment Created', + }, + { + id: 'ignite.deployment.updated', + name: 'Deployment Updated', + }, + { + id: 'ignite.deployment.deleted', + name: 'Deployment Deleted', + }, + { + id: 'ignite.deployment.build.started', + name: 'Build Started', + }, + { + id: 'ignite.deployment.build.completed', + name: 'Build Completed', + }, + { + id: 'ignite.deployment.build.created', + name: 'Build Created', + }, + { + id: 'ignite.deployment.build.updated', + name: 'Build Updated', + }, + { + id: 'ignite.deployment.build.failed', + name: 'Build Failed', + }, + { + id: 'ignite.deployment.build.cancelled', + name: 'Build Cancelled', + }, + { + id: 'ignite.deployment.deploy.validating', + name: 'Deploy Validating', + }, + { + id: 'ignite.deployment.rollout.created', + name: 'Rollout Created', + }, + { + id: 'ignite.deployment.rollout.updated', + name: 'Rollout Updated', + }, + { + id: 'ignite.deployment.container.created', + name: 'Container Created', + }, + { + id: 'ignite.deployment.container.updated', + name: 'Container Updated', + }, + { + id: 'ignite.deployment.container.metrics_update', + name: 'Container Metrics Update', + }, + { + id: 'ignite.deployment.container.deleted', + name: 'Container Deleted', + }, + { + id: 'ignite.deployment.healthcheck.created', + name: 'Healthcheck Created', + }, + { + id: 'ignite.deployment.healthcheck.updated', + name: 'Healthcheck Updated', + }, + { + id: 'ignite.deployment.healthcheck.deleted', + name: 'Healthcheck Deleted', + }, + { + id: 'ignite.deployment.healthcheck.events.failed', + name: 'Healthcheck Events Failed', + }, + { + id: 'ignite.deployment.healthcheck.events.succeeded', + name: 'Healthcheck Events Succeeded', + }, + { + id: 'ignite.deployment.gateway.created', + name: 'Gateway Created', + }, + { + id: 'ignite.deployment.gateway.updated', + name: 'Gateway Updated', + }, + { + id: 'ignite.deployment.gateway.deleted', + name: 'Gateway Deleted', + }, + ], + Project: [ + { + id: 'project.member.created', + name: 'Member Created', + }, + { + id: 'project.member.updated', + name: 'Member Updated', + }, + { + id: 'project.member.deleted', + name: 'Member Deleted', + }, + { + id: 'project.members.add', + name: 'Member Added', + }, + { + id: 'project.members.remove', + name: 'Member Removed', + }, + { + id: 'project.updated', + name: 'Updated', + }, + { + id: 'project.tokens.create', + name: 'Token Created', + }, + { + id: 'project.tokens.delete', + name: 'Token Deleted', + }, + { + id: 'project.secrets.create', + name: 'Secret Created', + }, + { + id: 'project.secrets.update', + name: 'Secret Updated', + }, + { + id: 'project.secrets.delete', + name: 'Secret Deleted', + }, + { + id: 'project.finance.transaction', + name: 'Finance Transaction', + }, + ], +}; From 896547115b2e36ed12e892c92c63215285e23f2d Mon Sep 17 00:00:00 2001 From: robjmorrissey Date: Tue, 26 Sep 2023 13:56:30 +0100 Subject: [PATCH 3/4] move to util --- src/util/index.ts | 1 + src/{utils/zod => util}/webhooks.ts | 0 2 files changed, 1 insertion(+) rename src/{utils/zod => util}/webhooks.ts (100%) diff --git a/src/util/index.ts b/src/util/index.ts index 7988ae1e..521a9563 100644 --- a/src/util/index.ts +++ b/src/util/index.ts @@ -1,3 +1,4 @@ export * from './constants.ts'; export * from './size.ts'; export * from './types.ts'; +export * from './webhooks.ts'; diff --git a/src/utils/zod/webhooks.ts b/src/util/webhooks.ts similarity index 100% rename from src/utils/zod/webhooks.ts rename to src/util/webhooks.ts From 4e70edbd7a34979a49d20c76ed838fee0e9067a7 Mon Sep 17 00:00:00 2001 From: robjmorrissey Date: Tue, 26 Sep 2023 13:57:07 +0100 Subject: [PATCH 4/4] rm from index --- src/utils/zod/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/utils/zod/index.ts b/src/utils/zod/index.ts index 9f5b8f5b..a7c8885b 100644 --- a/src/utils/zod/index.ts +++ b/src/utils/zod/index.ts @@ -1,4 +1,3 @@ export * from './ids.ts'; export * from './presets.ts'; export * from './ignite.ts'; -export * from './webhooks.ts';