@timeback/webhooks 0.1.1-beta.20260219190739

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,9 @@
1
+ /**
2
+ * Internal Library Exports
3
+ *
4
+ * @internal
5
+ */
6
+ export { resolveToProvider } from './resolve';
7
+ export { Transport } from './transport';
8
+ export type { ResolvedConfig } from '@timeback/internal-client-infra';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,YAAY,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Provider Resolution
3
+ *
4
+ * Webhooks-specific wrapper around the generic provider resolver.
5
+ *
6
+ * @internal
7
+ */
8
+ import type { ProviderRegistry } from '@timeback/internal-client-infra';
9
+ import type { WebhooksClientConfig, WebhooksResolvedProvider } from '../types';
10
+ /**
11
+ * Resolve Webhooks client config to a TimebackProvider.
12
+ *
13
+ * @param config - Client configuration
14
+ * @param registry - Provider registry for platform/env resolution
15
+ * @returns Resolved provider or transport
16
+ * @throws {Error} If configuration is invalid or incomplete
17
+ *
18
+ * @internal
19
+ */
20
+ export declare function resolveToProvider(config: WebhooksClientConfig, registry?: ProviderRegistry): WebhooksResolvedProvider;
21
+ //# sourceMappingURL=resolve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/lib/resolve.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AACvE,OAAO,KAAK,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAA;AAE9E;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAChC,MAAM,EAAE,oBAAoB,EAC5B,QAAQ,GAAE,gBAA4C,GACpD,wBAAwB,CAE1B"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Transport Layer
3
+ *
4
+ * HTTP transport for Webhooks API communication.
5
+ */
6
+ import { BaseTransport } from '@timeback/internal-client-infra';
7
+ import type { WebhookPaths } from '@timeback/internal-client-infra';
8
+ import type { WebhooksTransportConfig } from '../types';
9
+ /**
10
+ * HTTP transport layer for Webhooks API communication.
11
+ *
12
+ * Extends BaseTransport with webhook-specific path configuration.
13
+ */
14
+ export declare class Transport extends BaseTransport {
15
+ /** API path profiles for Webhook operations */
16
+ readonly paths: WebhookPaths;
17
+ constructor(config: WebhooksTransportConfig);
18
+ }
19
+ //# sourceMappingURL=transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/lib/transport.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAA;AAI/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AACnE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAEvD;;;;GAIG;AACH,qBAAa,SAAU,SAAQ,aAAa;IAC3C,+CAA+C;IAC/C,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAA;IAE5B,YAAY,MAAM,EAAE,uBAAuB,EAG1C;CACD"}
@@ -0,0 +1,170 @@
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: z.string().min(1, 'name must be a non-empty string'),
137
+ targetUrl: z.url('targetUrl must be a valid URL'),
138
+ secret: z.string().min(1, 'secret must be a non-empty string'),
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: z.string().min(1, 'webhookId must be a non-empty string'),
157
+ filterKey: z.string().min(1, 'filterKey must be a non-empty string'),
158
+ filterValue: z.string().min(1, 'filterValue must be a non-empty string'),
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 };
@@ -0,0 +1 @@
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"}
File without changes
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Resources
3
+ */
4
+ export { WebhooksResource } from './webhooks';
5
+ export { WebhookFiltersResource } from './webhook-filters';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA"}
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Webhook Filters Resource
3
+ *
4
+ * Manage webhook filters - create, list, update, and delete.
5
+ */
6
+ import type { WebhookFilterCreateInput, WebhookFilterUpdateInput } from '@timeback/types/zod';
7
+ import type { WebhookFilter, WebhookFilterDeleteResponse, WebhooksTransportLike } from '../types';
8
+ /**
9
+ * Webhook Filters resource.
10
+ *
11
+ * Provides methods to manage filters that control which events
12
+ * trigger webhook delivery.
13
+ */
14
+ export declare class WebhookFiltersResource {
15
+ private readonly transport;
16
+ constructor(transport: WebhooksTransportLike);
17
+ /**
18
+ * List all webhook filters.
19
+ *
20
+ * @returns Array of all webhook filters
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * const filters = await client.webhookFilters.list()
25
+ * ```
26
+ */
27
+ list(): Promise<WebhookFilter[]>;
28
+ /**
29
+ * Get a specific webhook filter by ID.
30
+ *
31
+ * @param id - The webhook filter ID
32
+ * @returns The webhook filter object
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * const filter = await client.webhookFilters.get(filterId)
37
+ * ```
38
+ */
39
+ get(id: string): Promise<WebhookFilter>;
40
+ /**
41
+ * List all filters for a specific webhook.
42
+ *
43
+ * @param webhookId - The parent webhook UUID
44
+ * @returns Array of filters for the specified webhook
45
+ *
46
+ * @example
47
+ * ```typescript
48
+ * const filters = await client.webhookFilters.listByWebhook(webhookId)
49
+ * ```
50
+ */
51
+ listByWebhook(webhookId: string): Promise<WebhookFilter[]>;
52
+ /**
53
+ * Create a new webhook filter.
54
+ *
55
+ * @param input - Filter configuration
56
+ * @returns The created webhook filter
57
+ *
58
+ * @example
59
+ * ```typescript
60
+ * const filter = await client.webhookFilters.create({
61
+ * webhookId: '123e4567-e89b-12d3-a456-426614174000',
62
+ * filterKey: 'type',
63
+ * filterValue: 'ActivityEvent',
64
+ * filterType: 'string',
65
+ * filterOperator: 'eq',
66
+ * active: true,
67
+ * })
68
+ * ```
69
+ */
70
+ create(input: WebhookFilterCreateInput): Promise<WebhookFilter>;
71
+ /**
72
+ * Update an existing webhook filter.
73
+ *
74
+ * @param id - The webhook filter ID
75
+ * @param input - Updated filter configuration
76
+ * @returns The updated webhook filter
77
+ *
78
+ * @example
79
+ * ```typescript
80
+ * const updated = await client.webhookFilters.update(filterId, {
81
+ * webhookId: webhookId,
82
+ * filterKey: 'type',
83
+ * filterValue: 'TimeSpentEvent',
84
+ * filterType: 'string',
85
+ * filterOperator: 'eq',
86
+ * active: true,
87
+ * })
88
+ * ```
89
+ */
90
+ update(id: string, input: WebhookFilterUpdateInput): Promise<WebhookFilter>;
91
+ /**
92
+ * Delete a webhook filter.
93
+ *
94
+ * @param id - The webhook filter ID
95
+ * @returns The delete response with status
96
+ *
97
+ * @example
98
+ * ```typescript
99
+ * await client.webhookFilters.delete(filterId)
100
+ * ```
101
+ */
102
+ delete(id: string): Promise<WebhookFilterDeleteResponse>;
103
+ }
104
+ //# sourceMappingURL=webhook-filters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-filters.d.ts","sourceRoot":"","sources":["../../src/resources/webhook-filters.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,KAAK,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAC7F,OAAO,KAAK,EACX,aAAa,EACb,2BAA2B,EAG3B,qBAAqB,EACrB,MAAM,UAAU,CAAA;AAEjB;;;;;GAKG;AACH,qBAAa,sBAAsB;IACtB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAAtC,YAA6B,SAAS,EAAE,qBAAqB,EAAI;IAEjE;;;;;;;;;OASG;IACG,IAAI,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAQrC;IAED;;;;;;;;;;OAUG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAY5C;IAED;;;;;;;;;;OAUG;IACG,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAW/D;IAED;;;;;;;;;;;;;;;;;OAiBG;IACG,MAAM,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,aAAa,CAAC,CAepE;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,aAAa,CAAC,CAehF;IAED;;;;;;;;;;OAUG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAe7D;CACD"}
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Webhooks Resource
3
+ *
4
+ * Manage webhooks - create, list, update, delete, activate, and deactivate.
5
+ */
6
+ import type { WebhookCreateInput, WebhookUpdateInput } from '@timeback/types/zod';
7
+ import type { Webhook, WebhookDeleteResponse, WebhooksTransportLike } from '../types';
8
+ /**
9
+ * Webhooks resource.
10
+ *
11
+ * Provides methods to manage webhook registrations for receiving
12
+ * event notifications.
13
+ */
14
+ export declare class WebhooksResource {
15
+ private readonly transport;
16
+ constructor(transport: WebhooksTransportLike);
17
+ /**
18
+ * List webhooks, optionally filtered by sensor.
19
+ *
20
+ * @param sensor - Optional sensor ID to filter by
21
+ * @returns Array of registered webhooks
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const webhooks = await client.webhooks.list()
26
+ * const filtered = await client.webhooks.list('https://example.edu/sensors/1')
27
+ * ```
28
+ */
29
+ list(sensor?: string): Promise<Webhook[]>;
30
+ /**
31
+ * Get a specific webhook by ID.
32
+ *
33
+ * @param id - The webhook UUID
34
+ * @returns The webhook object
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * const webhook = await client.webhooks.get('123e4567-e89b-12d3-a456-426614174000')
39
+ * ```
40
+ */
41
+ get(id: string): Promise<Webhook>;
42
+ /**
43
+ * Create a new webhook.
44
+ *
45
+ * @param input - Webhook configuration
46
+ * @returns The created webhook
47
+ *
48
+ * @example
49
+ * ```typescript
50
+ * const webhook = await client.webhooks.create({
51
+ * name: 'My Webhook',
52
+ * targetUrl: 'https://myapp.example.com/caliper-events',
53
+ * secret: 'my-shared-secret',
54
+ * active: true,
55
+ * })
56
+ * ```
57
+ */
58
+ create(input: WebhookCreateInput): Promise<Webhook>;
59
+ /**
60
+ * Update an existing webhook.
61
+ *
62
+ * @param id - The webhook UUID
63
+ * @param input - Updated webhook configuration
64
+ * @returns The updated webhook
65
+ *
66
+ * @example
67
+ * ```typescript
68
+ * const updated = await client.webhooks.update(webhookId, {
69
+ * name: 'Updated Name',
70
+ * targetUrl: 'https://new-url.example.com/events',
71
+ * secret: 'new-secret',
72
+ * active: true,
73
+ * })
74
+ * ```
75
+ */
76
+ update(id: string, input: WebhookUpdateInput): Promise<Webhook>;
77
+ /**
78
+ * Delete a webhook.
79
+ *
80
+ * @param id - The webhook UUID
81
+ * @returns The delete response with status
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * await client.webhooks.delete(webhookId)
86
+ * ```
87
+ */
88
+ delete(id: string): Promise<WebhookDeleteResponse>;
89
+ /**
90
+ * Activate a webhook.
91
+ *
92
+ * @param id - The webhook UUID
93
+ * @returns The activated webhook
94
+ *
95
+ * @example
96
+ * ```typescript
97
+ * const webhook = await client.webhooks.activate(webhookId)
98
+ * console.log(webhook.active) // true
99
+ * ```
100
+ */
101
+ activate(id: string): Promise<Webhook>;
102
+ /**
103
+ * Deactivate a webhook.
104
+ *
105
+ * @param id - The webhook UUID
106
+ * @returns The deactivated webhook
107
+ *
108
+ * @example
109
+ * ```typescript
110
+ * const webhook = await client.webhooks.deactivate(webhookId)
111
+ * console.log(webhook.active) // false
112
+ * ```
113
+ */
114
+ deactivate(id: string): Promise<Webhook>;
115
+ }
116
+ //# sourceMappingURL=webhooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../src/resources/webhooks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACjF,OAAO,KAAK,EACX,OAAO,EACP,qBAAqB,EAGrB,qBAAqB,EACrB,MAAM,UAAU,CAAA;AAEjB;;;;;GAKG;AACH,qBAAa,gBAAgB;IAChB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAAtC,YAA6B,SAAS,EAAE,qBAAqB,EAAI;IAEjE;;;;;;;;;;;OAWG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAc9C;IAED;;;;;;;;;;OAUG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAYtC;IAED;;;;;;;;;;;;;;;OAeG;IACG,MAAM,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,CAYxD;IAED;;;;;;;;;;;;;;;;OAgBG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,CAYpE;IAED;;;;;;;;;;OAUG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAYvD;IAED;;;;;;;;;;;OAWG;IACG,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAY3C;IAED;;;;;;;;;;;OAWG;IACG,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAY7C;CACD"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Client Configuration Types
3
+ *
4
+ * Configuration types for the Webhooks client.
5
+ */
6
+ import type { BaseTransportConfig, ClientConfig, EnvAuth, Environment, ExplicitAuth, Platform, ProviderClientConfig, RequestOptions, ResolvedProvider, TransportOnlyConfig, WebhookPaths } from '@timeback/internal-client-infra';
7
+ import type { WebhooksClient } from '../client';
8
+ /**
9
+ * Re-export vital config types for SDK users.
10
+ */
11
+ export type { Environment, EnvAuth, ExplicitAuth, Platform };
12
+ /**
13
+ * Transport interface for Webhooks client.
14
+ *
15
+ * Extends base transport requirements with webhook-specific paths.
16
+ * Required when using transport mode with WebhooksClient.
17
+ */
18
+ export interface WebhooksTransportLike {
19
+ /** Base URL of the API */
20
+ baseUrl: string;
21
+ /** API path profiles for Webhook operations */
22
+ paths: WebhookPaths;
23
+ /** Make an authenticated request */
24
+ request<T>(path: string, options?: RequestOptions): Promise<T>;
25
+ }
26
+ /**
27
+ * Webhooks client configuration options.
28
+ *
29
+ * Supports four modes:
30
+ * - **Provider mode**: `{ provider: TimebackProvider }` — pre-built provider with token sharing
31
+ * - **Environment mode**: `{ platform?, env, auth }` — Timeback hosted APIs
32
+ * - **Explicit mode**: `{ baseUrl, auth: { authUrl } }` — custom API URLs
33
+ * - **Transport mode**: `{ transport: WebhooksTransportLike }` — custom transport with paths
34
+ */
35
+ export type WebhooksClientConfig = ClientConfig | TransportOnlyConfig<WebhooksTransportLike> | ProviderClientConfig;
36
+ /**
37
+ * Configuration for Webhooks transport.
38
+ */
39
+ export type WebhooksTransportConfig = BaseTransportConfig & {
40
+ /** API path profiles for Webhook operations */
41
+ paths: WebhookPaths;
42
+ };
43
+ /**
44
+ * Resolved provider type for Webhooks client.
45
+ */
46
+ export type WebhooksResolvedProvider = ResolvedProvider<WebhooksTransportLike>;
47
+ /**
48
+ * Instance type of WebhooksClient.
49
+ */
50
+ export type WebhooksClientInstance = InstanceType<typeof WebhooksClient>;
51
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/types/client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACX,mBAAmB,EACnB,YAAY,EACZ,OAAO,EACP,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,YAAY,EACZ,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAE/C;;GAEG;AACH,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAA;AAE5D;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACrC,0BAA0B;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,+CAA+C;IAC/C,KAAK,EAAE,YAAY,CAAA;IACnB,oCAAoC;IACpC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;CAC9D;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,oBAAoB,GAC7B,YAAY,GACZ,mBAAmB,CAAC,qBAAqB,CAAC,GAC1C,oBAAoB,CAAA;AAEvB;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,mBAAmB,GAAG;IAC3D,+CAA+C;IAC/C,KAAK,EAAE,YAAY,CAAA;CACnB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,gBAAgB,CAAC,qBAAqB,CAAC,CAAA;AAE9E;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,YAAY,CAAC,OAAO,cAAc,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ export * from '@timeback/types/protocols/webhooks';
2
+ export * from './client';
3
+ export type { WebhookCreateInput, WebhookUpdateInput, WebhookFilterCreateInput, WebhookFilterUpdateInput, } from '@timeback/types/zod';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAA;AAClD,cAAc,UAAU,CAAA;AAExB,YAAY,EACX,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,wBAAwB,GACxB,MAAM,qBAAqB,CAAA"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Webhooks Types (subpath export)
3
+ *
4
+ * Re-exports all types for the ./types subpath.
5
+ */
6
+ export * from './types/index';
7
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,eAAe,CAAA"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Webhooks Utilities
3
+ *
4
+ * Shared utilities for the Webhooks client.
5
+ */
6
+ /**
7
+ * Scoped logger for Webhooks client.
8
+ */
9
+ export declare const log: import("@timeback/internal-logger").Logger;
10
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,eAAO,MAAM,GAAG,4CAAiC,CAAA"}
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@timeback/webhooks",
3
+ "version": "0.1.1-beta.20260219190739",
4
+ "description": "Webhook management client SDK for Timeback",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.js"
10
+ },
11
+ "./types": {
12
+ "types": "./dist/public-types.d.ts",
13
+ "import": "./dist/public-types.js"
14
+ }
15
+ },
16
+ "main": "dist/index.js",
17
+ "types": "dist/index.d.ts",
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "scripts": {
22
+ "build": "bun build.ts",
23
+ "test": "bun test --no-env-file unit.test.ts",
24
+ "test:e2e": "bun test --no-env-file e2e.test.ts"
25
+ },
26
+ "dependencies": {
27
+ "zod": "^4.2.1"
28
+ },
29
+ "devDependencies": {
30
+ "@timeback/internal-client-infra": "0.0.0",
31
+ "@timeback/internal-constants": "0.0.0",
32
+ "@timeback/internal-logger": "0.0.0",
33
+ "@timeback/internal-test": "0.0.0",
34
+ "@timeback/internal-utils": "0.0.0",
35
+ "@timeback/types": "0.0.0",
36
+ "@types/bun": "latest",
37
+ "esbuild": "^0.27.3"
38
+ },
39
+ "peerDependencies": {
40
+ "typescript": "^5"
41
+ }
42
+ }