@corsair-dev/abyssale 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,196 @@
1
+ export declare const BannerWebhooks: {
2
+ created: {
3
+ match: import("corsair/core").CorsairWebhookMatcher;
4
+ handler: import("corsair/core").CorsairWebhookHandler<import("..").AbyssaleContext, {
5
+ [x: string]: unknown;
6
+ id: string;
7
+ event_type: "NEW_BANNER";
8
+ version?: number | undefined;
9
+ sharing_id?: string | undefined;
10
+ file?: {
11
+ [x: string]: unknown;
12
+ type?: string | undefined;
13
+ url?: string | undefined;
14
+ cdn_url?: string | undefined;
15
+ fallback_image_url?: string | undefined;
16
+ filename?: string | undefined;
17
+ } | undefined;
18
+ format?: {
19
+ [x: string]: unknown;
20
+ id?: string | undefined;
21
+ width?: number | undefined;
22
+ height?: number | undefined;
23
+ unit?: string | undefined;
24
+ } | undefined;
25
+ template?: {
26
+ [x: string]: unknown;
27
+ id?: string | undefined;
28
+ name?: string | undefined;
29
+ created_at?: number | undefined;
30
+ updated_at?: number | undefined;
31
+ } | undefined;
32
+ }, {
33
+ [x: string]: unknown;
34
+ id: string;
35
+ event_type: "NEW_BANNER";
36
+ version?: number | undefined;
37
+ sharing_id?: string | undefined;
38
+ file?: {
39
+ [x: string]: unknown;
40
+ type?: string | undefined;
41
+ url?: string | undefined;
42
+ cdn_url?: string | undefined;
43
+ fallback_image_url?: string | undefined;
44
+ filename?: string | undefined;
45
+ } | undefined;
46
+ format?: {
47
+ [x: string]: unknown;
48
+ id?: string | undefined;
49
+ width?: number | undefined;
50
+ height?: number | undefined;
51
+ unit?: string | undefined;
52
+ } | undefined;
53
+ template?: {
54
+ [x: string]: unknown;
55
+ id?: string | undefined;
56
+ name?: string | undefined;
57
+ created_at?: number | undefined;
58
+ updated_at?: number | undefined;
59
+ } | undefined;
60
+ }>;
61
+ };
62
+ batchCompleted: {
63
+ match: import("corsair/core").CorsairWebhookMatcher;
64
+ handler: import("corsair/core").CorsairWebhookHandler<import("..").AbyssaleContext, {
65
+ [x: string]: unknown;
66
+ event_type: "NEW_BANNER_BATCH";
67
+ generation_request_id: string;
68
+ banners: {
69
+ [x: string]: unknown;
70
+ id: string;
71
+ version?: number | undefined;
72
+ sharing_id?: string | undefined;
73
+ file?: {
74
+ [x: string]: unknown;
75
+ type?: string | undefined;
76
+ url?: string | undefined;
77
+ cdn_url?: string | undefined;
78
+ fallback_image_url?: string | undefined;
79
+ filename?: string | undefined;
80
+ } | undefined;
81
+ format?: {
82
+ [x: string]: unknown;
83
+ id?: string | undefined;
84
+ width?: number | undefined;
85
+ height?: number | undefined;
86
+ unit?: string | undefined;
87
+ } | undefined;
88
+ template?: {
89
+ [x: string]: unknown;
90
+ id?: string | undefined;
91
+ name?: string | undefined;
92
+ created_at?: number | undefined;
93
+ updated_at?: number | undefined;
94
+ } | undefined;
95
+ project?: {
96
+ [x: string]: unknown;
97
+ id?: string | undefined;
98
+ name?: string | undefined;
99
+ } | undefined;
100
+ }[];
101
+ errors: {
102
+ [x: string]: unknown;
103
+ template_format_name: string;
104
+ reason: string;
105
+ }[];
106
+ }, {
107
+ [x: string]: unknown;
108
+ event_type: "NEW_BANNER_BATCH";
109
+ generation_request_id: string;
110
+ banners: {
111
+ [x: string]: unknown;
112
+ id: string;
113
+ version?: number | undefined;
114
+ sharing_id?: string | undefined;
115
+ file?: {
116
+ [x: string]: unknown;
117
+ type?: string | undefined;
118
+ url?: string | undefined;
119
+ cdn_url?: string | undefined;
120
+ fallback_image_url?: string | undefined;
121
+ filename?: string | undefined;
122
+ } | undefined;
123
+ format?: {
124
+ [x: string]: unknown;
125
+ id?: string | undefined;
126
+ width?: number | undefined;
127
+ height?: number | undefined;
128
+ unit?: string | undefined;
129
+ } | undefined;
130
+ template?: {
131
+ [x: string]: unknown;
132
+ id?: string | undefined;
133
+ name?: string | undefined;
134
+ created_at?: number | undefined;
135
+ updated_at?: number | undefined;
136
+ } | undefined;
137
+ project?: {
138
+ [x: string]: unknown;
139
+ id?: string | undefined;
140
+ name?: string | undefined;
141
+ } | undefined;
142
+ }[];
143
+ errors: {
144
+ [x: string]: unknown;
145
+ template_format_name: string;
146
+ reason: string;
147
+ }[];
148
+ }>;
149
+ };
150
+ };
151
+ export declare const DesignWebhooks: {
152
+ statusChanged: {
153
+ match: import("corsair/core").CorsairWebhookMatcher;
154
+ handler: import("corsair/core").CorsairWebhookHandler<import("..").AbyssaleContext, {
155
+ [x: string]: unknown;
156
+ event_type: "TEMPLATE_STATUS";
157
+ id: string;
158
+ status: string;
159
+ name?: string | undefined;
160
+ created_at?: number | undefined;
161
+ updated_at?: number | undefined;
162
+ status_updated_at?: number | undefined;
163
+ }, {
164
+ [x: string]: unknown;
165
+ event_type: "TEMPLATE_STATUS";
166
+ id: string;
167
+ status: string;
168
+ name?: string | undefined;
169
+ created_at?: number | undefined;
170
+ updated_at?: number | undefined;
171
+ status_updated_at?: number | undefined;
172
+ }>;
173
+ };
174
+ };
175
+ export declare const ExportWebhooks: {
176
+ completed: {
177
+ match: import("corsair/core").CorsairWebhookMatcher;
178
+ handler: import("corsair/core").CorsairWebhookHandler<import("..").AbyssaleContext, {
179
+ [x: string]: unknown;
180
+ event_type: "NEW_EXPORT";
181
+ export_id: string;
182
+ archive_url: string;
183
+ requested_at?: number | undefined;
184
+ generated_at?: number | undefined;
185
+ }, {
186
+ [x: string]: unknown;
187
+ event_type: "NEW_EXPORT";
188
+ export_id: string;
189
+ archive_url: string;
190
+ requested_at?: number | undefined;
191
+ generated_at?: number | undefined;
192
+ }>;
193
+ };
194
+ };
195
+ export * from './types';
196
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../webhooks/index.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAG1B,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;CAE1B,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;CAE1B,CAAC;AAEF,cAAc,SAAS,CAAC"}
@@ -0,0 +1,131 @@
1
+ import type { CorsairWebhookMatcher, RawWebhookRequest, WebhookRequest } from 'corsair/core';
2
+ import { z } from 'zod';
3
+ /**
4
+ * Abyssale webhook payloads all carry a top-level `event_type`; dispatch on it
5
+ * and ignore unknown values rather than failing, so a new provider event never
6
+ * breaks the receiver.
7
+ */
8
+ declare const AbyssaleWebhookPayloadSchema: z.ZodObject<{
9
+ event_type: z.ZodString;
10
+ }, z.core.$loose>;
11
+ export type AbyssaleWebhookPayload = z.infer<typeof AbyssaleWebhookPayloadSchema>;
12
+ /** `NEW_BANNER` — a single visual was generated or saved (never for sync API renders). */
13
+ export declare const NewBannerEventSchema: z.ZodObject<{
14
+ id: z.ZodUUID;
15
+ version: z.ZodOptional<z.ZodNumber>;
16
+ sharing_id: z.ZodOptional<z.ZodUUID>;
17
+ file: z.ZodOptional<z.ZodObject<{
18
+ type: z.ZodOptional<z.ZodString>;
19
+ url: z.ZodOptional<z.ZodString>;
20
+ cdn_url: z.ZodOptional<z.ZodString>;
21
+ fallback_image_url: z.ZodOptional<z.ZodString>;
22
+ filename: z.ZodOptional<z.ZodString>;
23
+ }, z.core.$loose>>;
24
+ format: z.ZodOptional<z.ZodObject<{
25
+ id: z.ZodOptional<z.ZodString>;
26
+ width: z.ZodOptional<z.ZodNumber>;
27
+ height: z.ZodOptional<z.ZodNumber>;
28
+ unit: z.ZodOptional<z.ZodString>;
29
+ }, z.core.$loose>>;
30
+ template: z.ZodOptional<z.ZodObject<{
31
+ id: z.ZodOptional<z.ZodString>;
32
+ name: z.ZodOptional<z.ZodString>;
33
+ created_at: z.ZodOptional<z.ZodNumber>;
34
+ updated_at: z.ZodOptional<z.ZodNumber>;
35
+ }, z.core.$loose>>;
36
+ event_type: z.ZodLiteral<"NEW_BANNER">;
37
+ }, z.core.$loose>;
38
+ export type NewBannerEvent = z.infer<typeof NewBannerEventSchema>;
39
+ /** `NEW_BANNER_BATCH` — an asynchronous batch generation request completed. */
40
+ export declare const NewBannerBatchEventSchema: z.ZodObject<{
41
+ event_type: z.ZodLiteral<"NEW_BANNER_BATCH">;
42
+ generation_request_id: z.ZodUUID;
43
+ banners: z.ZodArray<z.ZodObject<{
44
+ id: z.ZodString;
45
+ version: z.ZodOptional<z.ZodNumber>;
46
+ sharing_id: z.ZodOptional<z.ZodString>;
47
+ file: z.ZodOptional<z.ZodObject<{
48
+ type: z.ZodOptional<z.ZodString>;
49
+ url: z.ZodOptional<z.ZodString>;
50
+ cdn_url: z.ZodOptional<z.ZodString>;
51
+ fallback_image_url: z.ZodOptional<z.ZodString>;
52
+ filename: z.ZodOptional<z.ZodString>;
53
+ }, z.core.$loose>>;
54
+ format: z.ZodOptional<z.ZodObject<{
55
+ id: z.ZodOptional<z.ZodString>;
56
+ width: z.ZodOptional<z.ZodNumber>;
57
+ height: z.ZodOptional<z.ZodNumber>;
58
+ unit: z.ZodOptional<z.ZodString>;
59
+ }, z.core.$loose>>;
60
+ template: z.ZodOptional<z.ZodObject<{
61
+ id: z.ZodOptional<z.ZodString>;
62
+ name: z.ZodOptional<z.ZodString>;
63
+ created_at: z.ZodOptional<z.ZodNumber>;
64
+ updated_at: z.ZodOptional<z.ZodNumber>;
65
+ }, z.core.$loose>>;
66
+ project: z.ZodOptional<z.ZodObject<{
67
+ id: z.ZodOptional<z.ZodString>;
68
+ name: z.ZodOptional<z.ZodString>;
69
+ }, z.core.$loose>>;
70
+ }, z.core.$loose>>;
71
+ errors: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
72
+ template_format_name: z.ZodString;
73
+ reason: z.ZodString;
74
+ }, z.core.$loose>>>>;
75
+ }, z.core.$loose>;
76
+ export type NewBannerBatchEvent = z.infer<typeof NewBannerBatchEventSchema>;
77
+ /** `NEW_EXPORT` — a workspace-wide export (ZIP) finished processing. */
78
+ export declare const NewExportEventSchema: z.ZodObject<{
79
+ event_type: z.ZodLiteral<"NEW_EXPORT">;
80
+ export_id: z.ZodUUID;
81
+ archive_url: z.ZodURL;
82
+ requested_at: z.ZodOptional<z.ZodNumber>;
83
+ generated_at: z.ZodOptional<z.ZodNumber>;
84
+ }, z.core.$loose>;
85
+ export type NewExportEvent = z.infer<typeof NewExportEventSchema>;
86
+ /**
87
+ * `TEMPLATE_STATUS` — a design moved through its review workflow. The status
88
+ * stays an open string: Abyssale may introduce workflow states beyond the six
89
+ * documented values, and rejecting those deliveries would drop real updates.
90
+ */
91
+ export declare const TemplateStatusEventSchema: z.ZodObject<{
92
+ event_type: z.ZodLiteral<"TEMPLATE_STATUS">;
93
+ id: z.ZodUUID;
94
+ name: z.ZodOptional<z.ZodString>;
95
+ status: z.ZodString;
96
+ created_at: z.ZodOptional<z.ZodNumber>;
97
+ updated_at: z.ZodOptional<z.ZodNumber>;
98
+ status_updated_at: z.ZodOptional<z.ZodNumber>;
99
+ }, z.core.$loose>;
100
+ export type TemplateStatusEvent = z.infer<typeof TemplateStatusEventSchema>;
101
+ export type AbyssaleWebhookOutputs = {
102
+ newBanner: NewBannerEvent;
103
+ newBannerBatch: NewBannerBatchEvent;
104
+ newExport: NewExportEvent;
105
+ templateStatus: TemplateStatusEvent;
106
+ };
107
+ /** Event types this plugin handles; anything else is ignored by the matcher. */
108
+ export declare const HANDLED_EVENT_TYPES: readonly ["NEW_BANNER", "NEW_BANNER_BATCH", "NEW_EXPORT", "TEMPLATE_STATUS"];
109
+ export declare function parseBody(body: unknown): Record<string, unknown> | null;
110
+ export declare function createAbyssaleMatch(eventType: string): CorsairWebhookMatcher;
111
+ /** Plugin-level matcher: an Abyssale event payload with a handled `event_type`. */
112
+ export declare function matchAbyssalePluginWebhook(request: RawWebhookRequest): boolean;
113
+ export declare function verifyAbyssaleWebhookSignature(request: WebhookRequest<unknown>, secret?: string): {
114
+ valid: boolean;
115
+ error?: string;
116
+ };
117
+ /**
118
+ * Shared webhook guard: verifies the delivery signature, then validates the
119
+ * payload against the event schema. Keeps the 401/400 semantics identical
120
+ * across every handler.
121
+ */
122
+ export declare function verifyAndParseEvent<S extends z.ZodType>(request: WebhookRequest<unknown>, secret: string | undefined, schema: S, eventName: string): {
123
+ ok: true;
124
+ event: z.output<S>;
125
+ } | {
126
+ ok: false;
127
+ statusCode: number;
128
+ error: string;
129
+ };
130
+ export {};
131
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../webhooks/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,EACd,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB;;;;GAIG;AACH,QAAA,MAAM,4BAA4B;;iBAIzB,CAAC;AAEV,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,4BAA4B,CACnC,CAAC;AAWF,0FAA0F;AAC1F,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;iBAG/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,+EAA+E;AAC/E,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAepC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,wEAAwE;AACxE,eAAO,MAAM,oBAAoB;;;;;;iBAM/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,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AK,EAAE,MAAM,CAAA;CAAE,CAoBlD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=webhooks.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.test.d.ts","sourceRoot":"","sources":["../webhooks.test.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corsair-dev/abyssale",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Abyssale plugin for Corsair",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -24,18 +24,24 @@
24
24
  "tsup": "^8.0.1",
25
25
  "typescript": "^5.9.3",
26
26
  "zod": "^4.1.13",
27
- "corsair": "0.1.119"
27
+ "corsair": "0.1.129"
28
28
  },
29
29
  "keywords": [
30
30
  "corsair",
31
31
  "abyssale",
32
32
  "plugin"
33
33
  ],
34
- "author": "",
34
+ "author": "Corsair (https://corsair.dev)",
35
35
  "license": "Apache-2.0",
36
36
  "files": [
37
37
  "dist"
38
38
  ],
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/corsairdev/corsair.git",
42
+ "directory": "packages/abyssale"
43
+ },
44
+ "homepage": "https://docs.corsair.dev/plugins/abyssale",
39
45
  "scripts": {
40
46
  "build": "rm -rf dist && tsc --build --force && tsup",
41
47
  "typecheck": "tsc --noEmit",