@timeback/webhooks 0.2.0 → 0.2.1-beta.20260331190459

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.
@@ -1,170 +1,2 @@
1
- /**
2
- * Webhook Types
3
- *
4
- * Type definitions for the Webhooks API.
5
- */
6
-
7
- // ═══════════════════════════════════════════════════════════════════════════════
8
- // ENUMS
9
- // ═══════════════════════════════════════════════════════════════════════════════
10
-
11
- /** Supported data types for webhook filter values */
12
- type FilterType = 'string' | 'number' | 'boolean'
13
-
14
- /** Supported filter comparison operations */
15
- type FilterOperation =
16
- | 'eq'
17
- | 'neq'
18
- | 'gt'
19
- | 'gte'
20
- | 'lt'
21
- | 'lte'
22
- | 'contains'
23
- | 'notContains'
24
- | 'in'
25
- | 'notIn'
26
- | 'startsWith'
27
- | 'endsWith'
28
- | 'regexp'
29
-
30
- // ═══════════════════════════════════════════════════════════════════════════════
31
- // ENTITIES
32
- // ═══════════════════════════════════════════════════════════════════════════════
33
-
34
- /** A registered webhook */
35
- interface Webhook {
36
- /** Unique webhook identifier (UUID) */
37
- id: string
38
- /** Associated sensor identifier, null if not scoped to a sensor */
39
- sensor: string | null
40
- /** Human-readable webhook name */
41
- name: string
42
- /** Optional webhook description */
43
- description: string | null
44
- /** Destination URL that receives event payloads */
45
- targetUrl: string
46
- /** Shared secret used to sign webhook payloads */
47
- secret: string
48
- /** Whether the webhook is currently active */
49
- active: boolean
50
- /** ISO 8601 creation timestamp */
51
- created_at: string | null
52
- /** ISO 8601 last update timestamp */
53
- updated_at: string | null
54
- /** ISO 8601 soft-delete timestamp, null if not deleted */
55
- deleted_at: string | null
56
- }
57
-
58
- /** A filter attached to a webhook that controls which events trigger delivery */
59
- interface WebhookFilter {
60
- /** Unique filter identifier (UUID) */
61
- id: string
62
- /** UUID of the parent webhook */
63
- webhookId: string
64
- /** Event field to filter on (e.g., 'type', 'action') */
65
- filterKey: string
66
- /** Value to compare against */
67
- filterValue: string
68
- /** Data type of the filter value */
69
- filterType: FilterType
70
- /** Comparison operator */
71
- filterOperator: FilterOperation
72
- /** Whether the filter is currently active */
73
- active: boolean
74
- /** ISO 8601 creation timestamp */
75
- created_at: string | null
76
- /** ISO 8601 last update timestamp */
77
- updated_at: string | null
78
- /** ISO 8601 soft-delete timestamp, null if not deleted */
79
- deleted_at: string | null
80
- }
81
-
82
- // ═══════════════════════════════════════════════════════════════════════════════
83
- // API RESPONSES
84
- // ═══════════════════════════════════════════════════════════════════════════════
85
-
86
- /** Response for GET /webhooks/ */
87
- interface WebhookListResponse {
88
- webhooks: Webhook[]
89
- }
90
-
91
- /** Response for POST/GET/PUT /webhooks/:id and activate/deactivate */
92
- interface WebhookResponse {
93
- webhook: Webhook
94
- }
95
-
96
- /** Response for DELETE /webhooks/:id */
97
- interface WebhookDeleteResponse {
98
- message: string
99
- }
100
-
101
- /** Response for GET /webhook-filters/ and GET /webhook-filters/webhook/:webhookId */
102
- interface WebhookFilterListResponse {
103
- filters: WebhookFilter[]
104
- }
105
-
106
- /** Response for POST/GET/PUT /webhook-filters/:id */
107
- interface WebhookFilterResponse {
108
- filter: WebhookFilter
109
- }
110
-
111
- /** Response for DELETE /webhook-filters/:id */
112
- interface WebhookFilterDeleteResponse {
113
- message: string
114
- }
115
-
116
- type input<T> = T extends {
117
- _zod: {
118
- input: any;
119
- };
120
- } ? T["_zod"]["input"] : unknown;
121
-
122
- /**
123
- * Webhook Schemas
124
- *
125
- * Zod schemas for webhook and webhook filter inputs.
126
- */
127
-
128
-
129
-
130
- // ═══════════════════════════════════════════════════════════════════════════════
131
- // WEBHOOK INPUTS
132
- // ═══════════════════════════════════════════════════════════════════════════════
133
-
134
- declare const WebhookCreateInput = z
135
- .object({
136
- name: NonEmptyString,
137
- targetUrl: z.url('targetUrl must be a valid URL'),
138
- secret: NonEmptyString,
139
- active: z.boolean(),
140
- sensor: z.string().nullable().optional(),
141
- description: z.string().nullable().optional(),
142
- })
143
- .strict()
144
-
145
- // ═══════════════════════════════════════════════════════════════════════════════
146
- // TYPE EXPORTS (REQUEST INPUTS)
147
- // ═══════════════════════════════════════════════════════════════════════════════
148
-
149
- type WebhookCreateInput = input<typeof WebhookCreateInput>
150
-
151
- declare const WebhookUpdateInput = WebhookCreateInput
152
- type WebhookUpdateInput = input<typeof WebhookUpdateInput>
153
-
154
- declare const WebhookFilterCreateInput = z
155
- .object({
156
- webhookId: NonEmptyString,
157
- filterKey: NonEmptyString,
158
- filterValue: NonEmptyString,
159
- filterType: WebhookFilterType,
160
- filterOperator: WebhookFilterOperation,
161
- active: z.boolean(),
162
- })
163
- .strict()
164
- type WebhookFilterCreateInput = input<typeof WebhookFilterCreateInput>
165
-
166
- declare const WebhookFilterUpdateInput = WebhookFilterCreateInput
167
- type WebhookFilterUpdateInput = input<typeof WebhookFilterUpdateInput>
168
-
169
- export { WebhookCreateInput, WebhookFilterCreateInput, WebhookFilterUpdateInput, WebhookUpdateInput };
170
- export type { FilterOperation, FilterType, Webhook, WebhookDeleteResponse, WebhookFilter, WebhookFilterDeleteResponse, WebhookFilterListResponse, WebhookFilterResponse, WebhookListResponse, WebhookResponse };
1
+ export * from '@timeback/types/protocols/webhooks';
2
+ export { WebhookCreateInput, WebhookFilterCreateInput, WebhookFilterUpdateInput, WebhookUpdateInput } from '@timeback/types/zod';
@@ -0,0 +1 @@
1
+ import"./chunk-6jf1natv.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timeback/webhooks",
3
- "version": "0.2.0",
3
+ "version": "0.2.1-beta.20260331190459",
4
4
  "description": "Webhook management client SDK for Timeback",
5
5
  "type": "module",
6
6
  "exports": {
@@ -31,13 +31,13 @@
31
31
  "test:e2e": "vitest run --config vitest.e2e.config.ts"
32
32
  },
33
33
  "dependencies": {
34
+ "@timeback/types": "0.1.0",
34
35
  "zod": "^4.2.1"
35
36
  },
36
37
  "devDependencies": {
37
38
  "@timeback/internal-client-infra": "0.0.0",
38
39
  "@timeback/internal-test": "0.0.0",
39
40
  "@timeback/internal-utils": "0.0.0",
40
- "@timeback/types": "0.0.0",
41
41
  "@types/bun": "latest",
42
42
  "esbuild": "^0.27.3"
43
43
  },
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACN,QAAQ,IAAI,aAAa,EACzB,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,eAAe,GACf,MAAM,iCAAiC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAMH,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAEhD,YAAY,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AACtD,YAAY,EAAE,oBAAoB,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC9F,YAAY,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AAMtE,YAAY,EACX,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,wBAAwB,GACxB,MAAM,qBAAqB,CAAA;AAE5B,YAAY,EACX,OAAO,EACP,aAAa,EACb,UAAU,EACV,eAAe,GACf,MAAM,oCAAoC,CAAA;AAM3C,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"public-types.d.ts","sourceRoot":"","sources":["../src/public-types.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAA;AAElD,YAAY,EACX,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,wBAAwB,GACxB,MAAM,qBAAqB,CAAA"}