@timeback/webhooks 0.2.1-beta.20260331191116 → 0.2.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.
- package/dist/errors.d.ts +144 -1
- package/dist/index.d.ts +1072 -128
- package/dist/index.js +15 -25
- package/dist/public-types.d.ts +2 -170
- package/dist/public-types.js +1 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -37,8 +37,19 @@ class Transport extends BaseTransport {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
// ../../types/
|
|
40
|
+
// ../../types/dist/zod/index.js
|
|
41
41
|
import { z } from "zod/v4";
|
|
42
|
+
import { z as z2 } from "zod/v4";
|
|
43
|
+
import { z as z3 } from "zod/v4";
|
|
44
|
+
import { z as z4 } from "zod/v4";
|
|
45
|
+
import { z as z5 } from "zod/v4";
|
|
46
|
+
import { z as z6 } from "zod/v4";
|
|
47
|
+
import { z as z7 } from "zod/v4";
|
|
48
|
+
import { z as z8 } from "zod/v4";
|
|
49
|
+
import { z as z9 } from "zod/v4";
|
|
50
|
+
import { z as z10 } from "zod/v4";
|
|
51
|
+
import { z as z11 } from "zod/v4";
|
|
52
|
+
import { z as z12 } from "zod/v4";
|
|
42
53
|
var IsoDateTimeRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/;
|
|
43
54
|
var IsoDateTimeString = z.string().min(1).regex(IsoDateTimeRegex, "must be a valid ISO 8601 datetime");
|
|
44
55
|
var IsoDateString = z.string().min(1).regex(/^\d{4}-\d{2}-\d{2}$/, "must be a valid ISO 8601 date (YYYY-MM-DD)");
|
|
@@ -186,8 +197,6 @@ var IMSErrorResponse = z.object({
|
|
|
186
197
|
}))
|
|
187
198
|
}).optional()
|
|
188
199
|
});
|
|
189
|
-
// ../../types/src/zod/caliper.ts
|
|
190
|
-
import { z as z2 } from "zod/v4";
|
|
191
200
|
var CaliperIri = z2.union([z2.url(), z2.string().regex(/^urn:/, "Must be a URL or URN")]);
|
|
192
201
|
var TimebackUser = z2.object({
|
|
193
202
|
id: z2.url(),
|
|
@@ -392,8 +401,6 @@ var QuestionGradedInput = z2.object({
|
|
|
392
401
|
session: CaliperEntity.optional(),
|
|
393
402
|
extensions: z2.record(z2.string(), z2.unknown()).optional()
|
|
394
403
|
}).strict();
|
|
395
|
-
// ../../types/src/zod/webhooks.ts
|
|
396
|
-
import { z as z3 } from "zod/v4";
|
|
397
404
|
var WebhookCreateInput = z3.object({
|
|
398
405
|
name: NonEmptyString,
|
|
399
406
|
targetUrl: z3.url("targetUrl must be a valid URL"),
|
|
@@ -428,8 +435,6 @@ var WebhookFilterCreateInput = z3.object({
|
|
|
428
435
|
active: z3.boolean()
|
|
429
436
|
}).strict();
|
|
430
437
|
var WebhookFilterUpdateInput = WebhookFilterCreateInput;
|
|
431
|
-
// ../../types/src/zod/case.ts
|
|
432
|
-
import { z as z4 } from "zod/v4";
|
|
433
438
|
var UuidString = z4.string().uuid();
|
|
434
439
|
var InputNodeURISchema = z4.object({
|
|
435
440
|
title: NonEmptyString,
|
|
@@ -503,8 +508,6 @@ var CasePackageInput = z4.object({
|
|
|
503
508
|
CFDefinitions: CFDefinitionsSchema.optional(),
|
|
504
509
|
extensions: z4.unknown().optional()
|
|
505
510
|
});
|
|
506
|
-
// ../../types/src/zod/clr.ts
|
|
507
|
-
import { z as z5 } from "zod/v4";
|
|
508
511
|
var W3C_CREDENTIALS_CONTEXT = "https://www.w3.org/ns/credentials/v2";
|
|
509
512
|
var ClrContextArray = z5.array(z5.url()).min(3, "@context must include W3C, CLR, and OB context URLs").refine((arr) => arr[0] === W3C_CREDENTIALS_CONTEXT, `First @context entry must be "${W3C_CREDENTIALS_CONTEXT}"`);
|
|
510
513
|
var ClrImageSchema = z5.object({
|
|
@@ -604,8 +607,6 @@ var ClrCredentialInput = z5.object({
|
|
|
604
607
|
proof: z5.array(ClrProofSchema).optional(),
|
|
605
608
|
credentialSchema: z5.array(ClrCredentialSchemaSchema).optional()
|
|
606
609
|
});
|
|
607
|
-
// ../../types/src/zod/config.ts
|
|
608
|
-
import { z as z6 } from "zod/v4";
|
|
609
610
|
var CourseIds = z6.object({
|
|
610
611
|
staging: z6.string().meta({ description: "Course ID in staging environment" }).optional(),
|
|
611
612
|
production: z6.string().meta({ description: "Course ID in production environment" }).optional()
|
|
@@ -726,8 +727,6 @@ var TimebackConfig = z6.object({
|
|
|
726
727
|
message: "Each course must have an effective sensor. Either set `sensor` explicitly (top-level or per-course), or provide a `launchUrl` so sensor can be derived from its origin.",
|
|
727
728
|
path: ["courses"]
|
|
728
729
|
});
|
|
729
|
-
// ../../types/src/zod/edubridge.ts
|
|
730
|
-
import { z as z7 } from "zod/v4";
|
|
731
730
|
var EdubridgeDateString = z7.union([IsoDateTimeString, IsoDateString]);
|
|
732
731
|
var EduBridgeEnrollment = z7.object({
|
|
733
732
|
id: z7.string(),
|
|
@@ -832,8 +831,6 @@ var EdubridgeEnrollmentFactsParams = z7.object({
|
|
|
832
831
|
endDate: EdubridgeDateString.optional(),
|
|
833
832
|
timezone: z7.string().optional()
|
|
834
833
|
});
|
|
835
|
-
// ../../types/src/zod/masterytrack.ts
|
|
836
|
-
import { z as z8 } from "zod/v4";
|
|
837
834
|
var MasteryTrackAuthorizerInput = z8.object({
|
|
838
835
|
email: z8.email()
|
|
839
836
|
});
|
|
@@ -909,8 +906,6 @@ var MasteryTrackInvalidateAssignmentInput = z8.object({
|
|
|
909
906
|
});
|
|
910
907
|
}
|
|
911
908
|
});
|
|
912
|
-
// ../../types/src/zod/oneroster.ts
|
|
913
|
-
import { z as z9 } from "zod/v4";
|
|
914
909
|
var Status = z9.enum(["active", "tobedeleted"]);
|
|
915
910
|
var Metadata = z9.record(z9.string(), z9.unknown()).nullable().optional();
|
|
916
911
|
var Ref = z9.object({
|
|
@@ -1391,8 +1386,6 @@ var OneRosterBulkResultItem = z9.object({
|
|
|
1391
1386
|
student: Ref
|
|
1392
1387
|
}).loose();
|
|
1393
1388
|
var OneRosterBulkResultsInput = z9.array(OneRosterBulkResultItem).min(1, "results must have at least one item");
|
|
1394
|
-
// ../../types/src/zod/powerpath.ts
|
|
1395
|
-
import { z as z10 } from "zod/v4";
|
|
1396
1389
|
var ToolProvider = z10.enum(["edulastic", "mastery-track"]);
|
|
1397
1390
|
var LessonTypeRequired = z10.enum([
|
|
1398
1391
|
"powerpath-100",
|
|
@@ -1676,8 +1669,6 @@ var PowerPathRenderConfigUpsertInput = z10.object({
|
|
|
1676
1669
|
var PowerPathSyllabusQueryParams = z10.object({
|
|
1677
1670
|
status: z10.enum(["active", "tobedeleted"]).optional()
|
|
1678
1671
|
});
|
|
1679
|
-
// ../../types/src/zod/qti.ts
|
|
1680
|
-
import { z as z11 } from "zod/v4";
|
|
1681
1672
|
var QtiAssessmentItemType = z11.enum([
|
|
1682
1673
|
"choice",
|
|
1683
1674
|
"text-entry",
|
|
@@ -1937,8 +1928,6 @@ var QtiLessonFeedbackInput = z11.object({
|
|
|
1937
1928
|
lessonId: NonEmptyString,
|
|
1938
1929
|
humanApproved: z11.boolean().optional()
|
|
1939
1930
|
}).strict();
|
|
1940
|
-
// ../../types/src/zod/reporting.ts
|
|
1941
|
-
import { z as z12 } from "zod/v4";
|
|
1942
1931
|
var ReportingAuthMode = z12.enum(["creator_only", "same_org", "all_orgs"]);
|
|
1943
1932
|
var ReportingSavedQueryId = z12.string().uuid();
|
|
1944
1933
|
var ReportingUserEmail = z12.email();
|
|
@@ -1954,6 +1943,7 @@ var PersistReportingQueryInput = z12.object({
|
|
|
1954
1943
|
var RemoveReportingQueryInput = z12.object({
|
|
1955
1944
|
endpointId: ReportingSavedQueryId
|
|
1956
1945
|
});
|
|
1946
|
+
|
|
1957
1947
|
// src/resources/webhooks.ts
|
|
1958
1948
|
class WebhooksResource {
|
|
1959
1949
|
transport;
|
|
@@ -2095,8 +2085,8 @@ function createWebhooksClient(registry = DEFAULT_PROVIDER_REGISTRY) {
|
|
|
2095
2085
|
_provider;
|
|
2096
2086
|
webhooks;
|
|
2097
2087
|
webhookFilters;
|
|
2098
|
-
constructor(
|
|
2099
|
-
const resolved = resolveToProvider2(
|
|
2088
|
+
constructor(config = {}) {
|
|
2089
|
+
const resolved = resolveToProvider2(config, registry);
|
|
2100
2090
|
if (resolved.mode === "transport") {
|
|
2101
2091
|
this.transport = resolved.transport;
|
|
2102
2092
|
log.info("Client initialized with custom transport");
|
package/dist/public-types.d.ts
CHANGED
|
@@ -1,170 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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';
|
package/dist/public-types.js
CHANGED
|
@@ -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.1
|
|
3
|
+
"version": "0.2.1",
|
|
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.2.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
|
},
|