@krak-stack/registry 0.1.59 → 0.1.60
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/CHANGELOG.md +4 -1
- package/dist/components/ui/data-table.d.ts +2 -0
- package/dist/components/ui/data-table.js +6 -2
- package/dist/components/ui/item.d.ts +22 -0
- package/dist/components/ui/trace.d.ts +18 -0
- package/dist/services/agent/client/index.js +584 -434
- package/dist/services/agent/client/widget.d.ts +1 -0
- package/dist/services/events/browser.js +29 -3
- package/dist/services/events/client/audit-log-table.js +6 -2
- package/dist/services/events/client/tracking-notice.js +2 -1
- package/dist/services/events/index.d.ts +26 -56
- package/dist/services/events/index.js +118 -7
- package/dist/services/events/schema.d.ts +66 -24
- package/dist/services/events/schema.js +34 -3
- package/dist/services/opentelemetry/api.js +2 -1
- package/dist/services/opentelemetry/browser.d.ts +1 -1
- package/dist/services/opentelemetry/browser.js +2 -1
- package/dist/services/opentelemetry/events.d.ts +1 -1
- package/dist/services/opentelemetry/index.d.ts +1 -1
- package/dist/services/opentelemetry/index.js +2 -1
- package/dist/services/opentelemetry/schema.d.ts +3 -1
- package/dist/services/opentelemetry/web-vitals.js +2 -1
- package/dist/services/webhooks/http-client.d.ts +7 -0
- package/dist/services/webhooks/http-client.js +57 -0
- package/dist/services/webhooks/index.d.ts +341 -0
- package/dist/services/webhooks/index.js +737 -0
- package/dist/services/webhooks/migrations.d.ts +5 -0
- package/dist/services/webhooks/migrations.js +44 -0
- package/dist/services/webhooks/schema.d.ts +243 -0
- package/dist/services/webhooks/schema.js +333 -0
- package/dist/services/webhooks/url.d.ts +3 -0
- package/dist/services/webhooks/url.js +32 -0
- package/package.json +25 -1
- package/dist/components/ui/marker.d.ts +0 -10
|
@@ -37,6 +37,7 @@ var EventAttributeValue = Schema.Union([
|
|
|
37
37
|
Schema.Array(Schema.Boolean)
|
|
38
38
|
]);
|
|
39
39
|
var EventAttributesSchema = Schema.Record(Schema.String, EventAttributeValue).annotate({ identifier: "EventAttributes" });
|
|
40
|
+
var EventPropertiesSchema = Schema.Record(Schema.String, Schema.Json).annotate({ identifier: "EventProperties" });
|
|
40
41
|
var EventOptionsSchema = Schema.Struct({
|
|
41
42
|
userId: Schema.optional(Schema.NonEmptyString),
|
|
42
43
|
anonymousId: Schema.optional(Schema.NonEmptyString),
|
|
@@ -47,7 +48,7 @@ var EventOptionsSchema = Schema.Struct({
|
|
|
47
48
|
}).annotate({ identifier: "EventOptions" });
|
|
48
49
|
var TelemetryEvent = Schema.Struct({
|
|
49
50
|
name: Schema.NonEmptyString,
|
|
50
|
-
properties: Schema.optional(
|
|
51
|
+
properties: Schema.optional(EventPropertiesSchema),
|
|
51
52
|
options: Schema.optional(EventOptionsSchema)
|
|
52
53
|
}).annotate({ identifier: "TelemetryEvent" });
|
|
53
54
|
|
|
@@ -259,7 +260,7 @@ var AuditTarget = Schema3.Struct({
|
|
|
259
260
|
var trackEventFields = {
|
|
260
261
|
eventId: Schema3.optional(EventId),
|
|
261
262
|
name: Schema3.NonEmptyString.check(Schema3.isMaxLength(128)),
|
|
262
|
-
properties: Schema3.optional(
|
|
263
|
+
properties: Schema3.optional(EventPropertiesSchema),
|
|
263
264
|
identity: Schema3.optional(EventIdentity),
|
|
264
265
|
timestamp: Schema3.optional(Schema3.DateTimeUtc)
|
|
265
266
|
};
|
|
@@ -274,6 +275,24 @@ var TrackEvent = Schema3.Union([
|
|
|
274
275
|
target: AuditTarget
|
|
275
276
|
})
|
|
276
277
|
]).annotate({ identifier: "TrackEvent" });
|
|
278
|
+
var EventInputProperties = Schema3.Record(Schema3.String, Schema3.Unknown).annotate({ identifier: "EventInputProperties" });
|
|
279
|
+
var TrackEventInput = Schema3.Union([
|
|
280
|
+
Schema3.Struct({
|
|
281
|
+
...TrackEvent.members[0].fields,
|
|
282
|
+
properties: Schema3.optional(EventInputProperties)
|
|
283
|
+
}),
|
|
284
|
+
Schema3.Struct({
|
|
285
|
+
...TrackEvent.members[1].fields,
|
|
286
|
+
properties: Schema3.optional(EventInputProperties)
|
|
287
|
+
})
|
|
288
|
+
]).annotate({ identifier: "TrackEventInput" });
|
|
289
|
+
var EventSubscription = Schema3.Struct({
|
|
290
|
+
name: Schema3.NonEmptyString.check(Schema3.isMaxLength(128)),
|
|
291
|
+
events: Schema3.NonEmptyArray(trackEventFields.name)
|
|
292
|
+
}).annotate({ identifier: "EventSubscription" });
|
|
293
|
+
|
|
294
|
+
class EventSubscriberError extends Schema3.TaggedError()("EventSubscriberError", { subscription: Schema3.String }) {
|
|
295
|
+
}
|
|
277
296
|
var EventActionFilter = Schema3.Struct({
|
|
278
297
|
id: Schema3.Literal("eventName"),
|
|
279
298
|
kind: Schema3.Literal("values"),
|
|
@@ -364,7 +383,7 @@ var AttributeValue = Schema3.Union([
|
|
|
364
383
|
]);
|
|
365
384
|
var EventAttribute = Schema3.Struct({
|
|
366
385
|
key: Schema3.NonEmptyString.check(Schema3.isMaxLength(128)),
|
|
367
|
-
value:
|
|
386
|
+
value: Schema3.StructWithRest(Schema3.Struct({ stringValue: Schema3.optional(Schema3.String) }), [Schema3.Record(Schema3.String, Schema3.Json)])
|
|
368
387
|
}).annotate({ identifier: "EventAttribute" });
|
|
369
388
|
var EventLogRecord = Schema3.Struct({
|
|
370
389
|
eventName: Schema3.NonEmptyString.check(Schema3.isMaxLength(128), Schema3.isPattern(/^[^\r\n]+$/)),
|
|
@@ -375,6 +394,13 @@ var EventLogRecord = Schema3.Struct({
|
|
|
375
394
|
spanId: Schema3.optional(Schema3.String.check(Schema3.isPattern(/^[a-f0-9]{16}$/))),
|
|
376
395
|
attributes: Schema3.Array(EventAttribute).check(Schema3.isMaxLength(64), Schema3.makeFilter((values) => new Set(values.map(({ key }) => key)).size === values.length || "Duplicate attribute keys"))
|
|
377
396
|
}).annotate({ identifier: "EventLogRecord" });
|
|
397
|
+
var BrowserEventLogRecord = Schema3.Struct({
|
|
398
|
+
...EventLogRecord.fields,
|
|
399
|
+
attributes: Schema3.Array(Schema3.Struct({
|
|
400
|
+
key: EventAttribute.fields.key,
|
|
401
|
+
value: AttributeValue
|
|
402
|
+
})).check(Schema3.isMaxLength(64), Schema3.makeFilter((values) => new Set(values.map(({ key }) => key)).size === values.length || "Duplicate attribute keys"))
|
|
403
|
+
}).annotate({ identifier: "BrowserEventLogRecord" });
|
|
378
404
|
var extensions = Schema3.Record(Schema3.String, Schema3.Unknown);
|
|
379
405
|
var OtlpLogs = Schema3.StructWithRest(Schema3.Struct({
|
|
380
406
|
resourceLogs: Schema3.Array(Schema3.StructWithRest(Schema3.Struct({
|
|
@@ -400,6 +426,7 @@ export {
|
|
|
400
426
|
AuditCount,
|
|
401
427
|
AuditSortId,
|
|
402
428
|
AuditTarget,
|
|
429
|
+
BrowserEventLogRecord,
|
|
403
430
|
BrowserEventOptions,
|
|
404
431
|
BrowserEventPath,
|
|
405
432
|
BrowserPage,
|
|
@@ -413,12 +440,15 @@ export {
|
|
|
413
440
|
EventGeolocationError,
|
|
414
441
|
EventId,
|
|
415
442
|
EventIdentity,
|
|
443
|
+
EventInputProperties,
|
|
416
444
|
EventIpAddress,
|
|
417
445
|
EventLogRecord,
|
|
418
446
|
EventQuery,
|
|
419
447
|
EventQueryStandard,
|
|
420
448
|
EventRegion,
|
|
421
449
|
EventSource,
|
|
450
|
+
EventSubscriberError,
|
|
451
|
+
EventSubscription,
|
|
422
452
|
EventUuid,
|
|
423
453
|
EventsPersistenceError,
|
|
424
454
|
ExistingEventRequest,
|
|
@@ -429,6 +459,7 @@ export {
|
|
|
429
459
|
StoredEventPayload,
|
|
430
460
|
StoredEventRequest,
|
|
431
461
|
TrackEvent,
|
|
462
|
+
TrackEventInput,
|
|
432
463
|
VisitorEventSession,
|
|
433
464
|
VisitorEventsRequest
|
|
434
465
|
};
|
|
@@ -74,6 +74,7 @@ var EventAttributeValue = Schema.Union([
|
|
|
74
74
|
Schema.Array(Schema.Boolean)
|
|
75
75
|
]);
|
|
76
76
|
var EventAttributesSchema = Schema.Record(Schema.String, EventAttributeValue).annotate({ identifier: "EventAttributes" });
|
|
77
|
+
var EventPropertiesSchema = Schema.Record(Schema.String, Schema.Json).annotate({ identifier: "EventProperties" });
|
|
77
78
|
var EventOptionsSchema = Schema.Struct({
|
|
78
79
|
userId: Schema.optional(Schema.NonEmptyString),
|
|
79
80
|
anonymousId: Schema.optional(Schema.NonEmptyString),
|
|
@@ -84,7 +85,7 @@ var EventOptionsSchema = Schema.Struct({
|
|
|
84
85
|
}).annotate({ identifier: "EventOptions" });
|
|
85
86
|
var TelemetryEvent = Schema.Struct({
|
|
86
87
|
name: Schema.NonEmptyString,
|
|
87
|
-
properties: Schema.optional(
|
|
88
|
+
properties: Schema.optional(EventPropertiesSchema),
|
|
88
89
|
options: Schema.optional(EventOptionsSchema)
|
|
89
90
|
}).annotate({ identifier: "TelemetryEvent" });
|
|
90
91
|
|
|
@@ -26,7 +26,7 @@ export interface BrowserOtlpOptions {
|
|
|
26
26
|
}
|
|
27
27
|
export declare class BrowserOtlp {
|
|
28
28
|
static readonly event: (name: string, properties?: {
|
|
29
|
-
readonly [x: string]:
|
|
29
|
+
readonly [x: string]: Schema.Json;
|
|
30
30
|
} | undefined, options?: {
|
|
31
31
|
readonly userId?: string | undefined;
|
|
32
32
|
readonly anonymousId?: string | undefined;
|
|
@@ -62,6 +62,7 @@ var EventAttributeValue = Schema.Union([
|
|
|
62
62
|
Schema.Array(Schema.Boolean)
|
|
63
63
|
]);
|
|
64
64
|
var EventAttributesSchema = Schema.Record(Schema.String, EventAttributeValue).annotate({ identifier: "EventAttributes" });
|
|
65
|
+
var EventPropertiesSchema = Schema.Record(Schema.String, Schema.Json).annotate({ identifier: "EventProperties" });
|
|
65
66
|
var EventOptionsSchema = Schema.Struct({
|
|
66
67
|
userId: Schema.optional(Schema.NonEmptyString),
|
|
67
68
|
anonymousId: Schema.optional(Schema.NonEmptyString),
|
|
@@ -72,7 +73,7 @@ var EventOptionsSchema = Schema.Struct({
|
|
|
72
73
|
}).annotate({ identifier: "EventOptions" });
|
|
73
74
|
var TelemetryEvent = Schema.Struct({
|
|
74
75
|
name: Schema.NonEmptyString,
|
|
75
|
-
properties: Schema.optional(
|
|
76
|
+
properties: Schema.optional(EventPropertiesSchema),
|
|
76
77
|
options: Schema.optional(EventOptionsSchema)
|
|
77
78
|
}).annotate({ identifier: "TelemetryEvent" });
|
|
78
79
|
|
|
@@ -27,7 +27,7 @@ interface EventRecord {
|
|
|
27
27
|
}
|
|
28
28
|
/** Emits an INFO event without creating a tracing span or persisting identity. */
|
|
29
29
|
export declare const event: (name: string, properties?: {
|
|
30
|
-
readonly [x: string]:
|
|
30
|
+
readonly [x: string]: Schema.Json;
|
|
31
31
|
} | undefined, options?: {
|
|
32
32
|
readonly userId?: string | undefined;
|
|
33
33
|
readonly anonymousId?: string | undefined;
|
|
@@ -8,7 +8,7 @@ declare const Otlp_base: Context.ServiceClass<Otlp, "krakstack/opentelemetry/Otl
|
|
|
8
8
|
/** Runtime-neutral server telemetry for HTTP applications, workers, and CLIs. */
|
|
9
9
|
export declare class Otlp extends Otlp_base {
|
|
10
10
|
static readonly event: (name: string, properties?: {
|
|
11
|
-
readonly [x: string]:
|
|
11
|
+
readonly [x: string]: Schema.Json;
|
|
12
12
|
} | undefined, options?: {
|
|
13
13
|
readonly userId?: string | undefined;
|
|
14
14
|
readonly anonymousId?: string | undefined;
|
|
@@ -61,6 +61,7 @@ var EventAttributeValue = Schema.Union([
|
|
|
61
61
|
Schema.Array(Schema.Boolean)
|
|
62
62
|
]);
|
|
63
63
|
var EventAttributesSchema = Schema.Record(Schema.String, EventAttributeValue).annotate({ identifier: "EventAttributes" });
|
|
64
|
+
var EventPropertiesSchema = Schema.Record(Schema.String, Schema.Json).annotate({ identifier: "EventProperties" });
|
|
64
65
|
var EventOptionsSchema = Schema.Struct({
|
|
65
66
|
userId: Schema.optional(Schema.NonEmptyString),
|
|
66
67
|
anonymousId: Schema.optional(Schema.NonEmptyString),
|
|
@@ -71,7 +72,7 @@ var EventOptionsSchema = Schema.Struct({
|
|
|
71
72
|
}).annotate({ identifier: "EventOptions" });
|
|
72
73
|
var TelemetryEvent = Schema.Struct({
|
|
73
74
|
name: Schema.NonEmptyString,
|
|
74
|
-
properties: Schema.optional(
|
|
75
|
+
properties: Schema.optional(EventPropertiesSchema),
|
|
75
76
|
options: Schema.optional(EventOptionsSchema)
|
|
76
77
|
}).annotate({ identifier: "TelemetryEvent" });
|
|
77
78
|
|
|
@@ -19,6 +19,7 @@ export declare const BrowserWebVital: Schema.Struct<{
|
|
|
19
19
|
readonly navigationType: Schema.Literals<readonly ["navigate", "reload", "back-forward", "back-forward-cache", "prerender", "restore"]>;
|
|
20
20
|
}>;
|
|
21
21
|
export declare const EventAttributesSchema: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.$Array<Schema.String>, Schema.$Array<Schema.Finite>, Schema.$Array<Schema.Boolean>]>>;
|
|
22
|
+
export declare const EventPropertiesSchema: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
22
23
|
export declare const EventOptionsSchema: Schema.Struct<{
|
|
23
24
|
readonly userId: Schema.optional<Schema.NonEmptyString>;
|
|
24
25
|
readonly anonymousId: Schema.optional<Schema.NonEmptyString>;
|
|
@@ -29,7 +30,7 @@ export declare const EventOptionsSchema: Schema.Struct<{
|
|
|
29
30
|
}>;
|
|
30
31
|
export declare const TelemetryEvent: Schema.Struct<{
|
|
31
32
|
readonly name: Schema.NonEmptyString;
|
|
32
|
-
readonly properties: Schema.optional<Schema.$Record<Schema.String, Schema.
|
|
33
|
+
readonly properties: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
33
34
|
readonly options: Schema.optional<Schema.Struct<{
|
|
34
35
|
readonly userId: Schema.optional<Schema.NonEmptyString>;
|
|
35
36
|
readonly anonymousId: Schema.optional<Schema.NonEmptyString>;
|
|
@@ -40,4 +41,5 @@ export declare const TelemetryEvent: Schema.Struct<{
|
|
|
40
41
|
}>>;
|
|
41
42
|
}>;
|
|
42
43
|
export type EventAttributes = typeof EventAttributesSchema.Type;
|
|
44
|
+
export type EventProperties = typeof EventPropertiesSchema.Type;
|
|
43
45
|
export type EventOptions = typeof EventOptionsSchema.Type;
|
|
@@ -55,6 +55,7 @@ var EventAttributeValue = Schema.Union([
|
|
|
55
55
|
Schema.Array(Schema.Boolean)
|
|
56
56
|
]);
|
|
57
57
|
var EventAttributesSchema = Schema.Record(Schema.String, EventAttributeValue).annotate({ identifier: "EventAttributes" });
|
|
58
|
+
var EventPropertiesSchema = Schema.Record(Schema.String, Schema.Json).annotate({ identifier: "EventProperties" });
|
|
58
59
|
var EventOptionsSchema = Schema.Struct({
|
|
59
60
|
userId: Schema.optional(Schema.NonEmptyString),
|
|
60
61
|
anonymousId: Schema.optional(Schema.NonEmptyString),
|
|
@@ -65,7 +66,7 @@ var EventOptionsSchema = Schema.Struct({
|
|
|
65
66
|
}).annotate({ identifier: "EventOptions" });
|
|
66
67
|
var TelemetryEvent = Schema.Struct({
|
|
67
68
|
name: Schema.NonEmptyString,
|
|
68
|
-
properties: Schema.optional(
|
|
69
|
+
properties: Schema.optional(EventPropertiesSchema),
|
|
69
70
|
options: Schema.optional(EventOptionsSchema)
|
|
70
71
|
}).annotate({ identifier: "TelemetryEvent" });
|
|
71
72
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Effect, Layer } from "effect";
|
|
2
|
+
import { Dns } from "effect/net";
|
|
3
|
+
import { HttpClient } from "effect/http";
|
|
4
|
+
/** DNS preflight. Network egress rules must also prevent DNS rebinding. */
|
|
5
|
+
export declare const isPublicWebhookDestination: (url: URL) => Effect.Effect<boolean, never, Dns.Dns>;
|
|
6
|
+
/** Built-in fetch client with public-destination checks and no redirects. */
|
|
7
|
+
export declare const layer: Layer.Layer<HttpClient.HttpClient, never, Dns.Dns>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// ../../src/services/webhooks/http-client.ts
|
|
2
|
+
import { Effect, Layer, Result } from "effect";
|
|
3
|
+
import { Dns, NetAddress } from "effect/net";
|
|
4
|
+
import { FetchHttpClient, HttpClient, HttpClientError } from "effect/http";
|
|
5
|
+
|
|
6
|
+
// ../../src/services/webhooks/url.ts
|
|
7
|
+
var hostname = (value) => value.toLowerCase().replace(/^\[|\]$/g, "").replace(/\.$/, "");
|
|
8
|
+
var isPublicIpAddress = (value) => {
|
|
9
|
+
const address = hostname(value);
|
|
10
|
+
const octets = address.split(".");
|
|
11
|
+
if (octets.length === 4 && octets.every((part) => /^\d{1,3}$/.test(part) && Number(part) <= 255)) {
|
|
12
|
+
const [a = 0, b = 0, c = 0] = octets.map(Number);
|
|
13
|
+
return !(a === 0 || a === 10 || a === 127 || a === 100 && b >= 64 && b <= 127 || a === 169 && b === 254 || a === 172 && b >= 16 && b <= 31 || a === 192 && (b === 0 || b === 168 || b === 88 && c === 99) || a === 198 && (b === 18 || b === 19 || b === 51) || a === 203 && b === 0 || a >= 224);
|
|
14
|
+
}
|
|
15
|
+
const first = Number.parseInt(address.split(":")[0] ?? "", 16);
|
|
16
|
+
return address.includes(":") && first >= 8192 && first <= 16383 && !address.startsWith("2001:") && !address.startsWith("2002:") && !address.startsWith("3fff:");
|
|
17
|
+
};
|
|
18
|
+
var isPublicWebhookUrl = (url) => {
|
|
19
|
+
if (!["https:", "http:"].includes(url.protocol) || url.username || url.password)
|
|
20
|
+
return false;
|
|
21
|
+
const host = hostname(url.hostname);
|
|
22
|
+
if (!host || host === "localhost" || host.endsWith(".localhost") || host.endsWith(".local"))
|
|
23
|
+
return false;
|
|
24
|
+
return !(host.includes(":") || /^\d+(?:\.\d+){3}$/.test(host)) || isPublicIpAddress(host);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// ../../src/services/webhooks/http-client.ts
|
|
28
|
+
var isPublicWebhookDestination = Effect.fn("Webhooks.isPublicDestination")(function* (url) {
|
|
29
|
+
if (!isPublicWebhookUrl(url))
|
|
30
|
+
return false;
|
|
31
|
+
const hostname = url.hostname.replace(/^\[|\]$/g, "");
|
|
32
|
+
if (Result.isSuccess(NetAddress.ipFromString(hostname)))
|
|
33
|
+
return true;
|
|
34
|
+
const dns = yield* Dns.Dns;
|
|
35
|
+
return yield* dns.lookup(hostname).pipe(Effect.map((addresses) => addresses.every((address) => isPublicIpAddress(NetAddress.formatIp(address)))), Effect.catch(() => Effect.succeed(false)));
|
|
36
|
+
});
|
|
37
|
+
var layer = Layer.effect(HttpClient.HttpClient, Effect.gen(function* () {
|
|
38
|
+
const client = yield* HttpClient.HttpClient;
|
|
39
|
+
const dns = yield* Dns.Dns;
|
|
40
|
+
return client.pipe(HttpClient.transform((response, request) => Effect.gen(function* () {
|
|
41
|
+
if (!(yield* isPublicWebhookDestination(new URL(request.url)).pipe(Effect.provideService(Dns.Dns, dns)))) {
|
|
42
|
+
return yield* new HttpClientError.HttpClientError({
|
|
43
|
+
reason: new HttpClientError.TransportError({
|
|
44
|
+
request,
|
|
45
|
+
description: "Webhook destination is not public"
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return yield* response.pipe(Effect.provideService(FetchHttpClient.RequestInit, {
|
|
50
|
+
redirect: "error"
|
|
51
|
+
}));
|
|
52
|
+
})));
|
|
53
|
+
})).pipe(Layer.provide(FetchHttpClient.layer));
|
|
54
|
+
export {
|
|
55
|
+
isPublicWebhookDestination,
|
|
56
|
+
layer
|
|
57
|
+
};
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { Cause, Context, Effect, Layer, Schema } from "effect";
|
|
2
|
+
import { HttpClient } from "effect/http";
|
|
3
|
+
import { Workflow } from "effect/workflow";
|
|
4
|
+
import { SqlClient } from "effect/sql";
|
|
5
|
+
import { WebhookError, WebhookPayload } from "./schema.js";
|
|
6
|
+
export * from "./schema.js";
|
|
7
|
+
export declare const DeliverWebhookV1: Workflow.Workflow<"KrakstackDeliverWebhookV1", Schema.Struct<{
|
|
8
|
+
organizationId: Schema.String;
|
|
9
|
+
id: Schema.String;
|
|
10
|
+
}>, Schema.Void, typeof WebhookError>;
|
|
11
|
+
declare const Webhooks_base: Context.ServiceClass<Webhooks, "krakstack/webhooks/Webhooks", {
|
|
12
|
+
list: (request: {
|
|
13
|
+
readonly organizationId: string;
|
|
14
|
+
}) => Effect.Effect<{
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly name: string;
|
|
17
|
+
readonly organizationId: string;
|
|
18
|
+
readonly url: string;
|
|
19
|
+
readonly description: string | null;
|
|
20
|
+
readonly headers: {
|
|
21
|
+
readonly [x: string]: string;
|
|
22
|
+
} | null;
|
|
23
|
+
readonly events: readonly string[] | null;
|
|
24
|
+
readonly secret: string;
|
|
25
|
+
readonly enabled: boolean;
|
|
26
|
+
readonly createdAt: Date;
|
|
27
|
+
readonly updatedAt: Date;
|
|
28
|
+
}[], Schema.SchemaError | import("effect/sql/SqlError").SqlError, never>;
|
|
29
|
+
get: (input: {
|
|
30
|
+
readonly organizationId: string;
|
|
31
|
+
readonly id: string;
|
|
32
|
+
}) => Effect.Effect<{
|
|
33
|
+
id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
organizationId: string;
|
|
36
|
+
url: string;
|
|
37
|
+
description: string | null;
|
|
38
|
+
headers: {
|
|
39
|
+
readonly [x: string]: string;
|
|
40
|
+
} | null;
|
|
41
|
+
events: readonly string[] | null;
|
|
42
|
+
secret: string;
|
|
43
|
+
enabled: boolean;
|
|
44
|
+
createdAt: Date;
|
|
45
|
+
updatedAt: Date;
|
|
46
|
+
deliveries: {
|
|
47
|
+
readonly id: string;
|
|
48
|
+
readonly webhookId: string;
|
|
49
|
+
readonly event: string;
|
|
50
|
+
readonly data: Schema.Json;
|
|
51
|
+
readonly status: "failed" | "pending" | "success";
|
|
52
|
+
readonly error: string | null;
|
|
53
|
+
readonly completedAt: Date | null;
|
|
54
|
+
readonly retryAt: Date;
|
|
55
|
+
readonly retries: number;
|
|
56
|
+
readonly createdAt: Date;
|
|
57
|
+
readonly updatedAt: Date;
|
|
58
|
+
}[];
|
|
59
|
+
} | undefined, Schema.SchemaError | import("effect/sql/SqlError").SqlError, never>;
|
|
60
|
+
listDeliveries: (input: {
|
|
61
|
+
readonly page?: string | number | undefined;
|
|
62
|
+
readonly pageSize?: string | number | undefined;
|
|
63
|
+
readonly globalFilter?: string | undefined;
|
|
64
|
+
readonly organizationId: string;
|
|
65
|
+
readonly id: string;
|
|
66
|
+
readonly filters?: readonly ({
|
|
67
|
+
readonly id: string;
|
|
68
|
+
readonly kind: "number";
|
|
69
|
+
readonly min?: number | undefined;
|
|
70
|
+
readonly max?: number | undefined;
|
|
71
|
+
} | {
|
|
72
|
+
readonly id: string;
|
|
73
|
+
readonly kind: "date";
|
|
74
|
+
readonly from?: string | undefined;
|
|
75
|
+
readonly to?: string | undefined;
|
|
76
|
+
} | {
|
|
77
|
+
readonly id: string;
|
|
78
|
+
readonly kind: "text";
|
|
79
|
+
readonly operator: "contains" | "endsWith" | "equals" | "startsWith";
|
|
80
|
+
readonly value: string;
|
|
81
|
+
} | {
|
|
82
|
+
readonly id: string;
|
|
83
|
+
readonly kind: "boolean";
|
|
84
|
+
readonly value: boolean;
|
|
85
|
+
} | {
|
|
86
|
+
readonly id: string;
|
|
87
|
+
readonly kind: "values";
|
|
88
|
+
readonly values: readonly [string, ...string[]];
|
|
89
|
+
})[] | undefined;
|
|
90
|
+
readonly sort?: readonly {
|
|
91
|
+
readonly id: string;
|
|
92
|
+
readonly direction: "asc" | "desc";
|
|
93
|
+
}[] | undefined;
|
|
94
|
+
}) => Effect.Effect<{
|
|
95
|
+
data: {
|
|
96
|
+
readonly id: string;
|
|
97
|
+
readonly webhookId: string;
|
|
98
|
+
readonly event: string;
|
|
99
|
+
readonly data: Schema.Json;
|
|
100
|
+
readonly status: "failed" | "pending" | "success";
|
|
101
|
+
readonly error: string | null;
|
|
102
|
+
readonly completedAt: Date | null;
|
|
103
|
+
readonly retryAt: Date;
|
|
104
|
+
readonly retries: number;
|
|
105
|
+
readonly createdAt: Date;
|
|
106
|
+
readonly updatedAt: Date;
|
|
107
|
+
}[];
|
|
108
|
+
meta: {
|
|
109
|
+
page: number;
|
|
110
|
+
pageSize: number;
|
|
111
|
+
total: number;
|
|
112
|
+
pageCount: number;
|
|
113
|
+
};
|
|
114
|
+
} | undefined, Cause.NoSuchElementError | Schema.SchemaError | import("effect/sql/SqlError").SqlError, never>;
|
|
115
|
+
statistics: (input: {
|
|
116
|
+
readonly organizationId: string;
|
|
117
|
+
readonly id: string;
|
|
118
|
+
readonly interval: "day" | "hour";
|
|
119
|
+
}) => Effect.Effect<{
|
|
120
|
+
total: number;
|
|
121
|
+
success: number;
|
|
122
|
+
failed: number;
|
|
123
|
+
buckets: {
|
|
124
|
+
readonly total: number;
|
|
125
|
+
readonly success: number;
|
|
126
|
+
readonly failed: number;
|
|
127
|
+
readonly bucket: Date;
|
|
128
|
+
readonly events: readonly {
|
|
129
|
+
readonly event: string;
|
|
130
|
+
readonly total: number;
|
|
131
|
+
}[];
|
|
132
|
+
}[];
|
|
133
|
+
} | undefined, Cause.NoSuchElementError | Schema.SchemaError | import("effect/sql/SqlError").SqlError, never>;
|
|
134
|
+
create: (input: {
|
|
135
|
+
organizationId: string;
|
|
136
|
+
payload: WebhookPayload;
|
|
137
|
+
}) => Effect.Effect<{
|
|
138
|
+
id: string;
|
|
139
|
+
}, Schema.SchemaError | import("effect/sql/SqlError").SqlError, never>;
|
|
140
|
+
update: (input: {
|
|
141
|
+
readonly organizationId: string;
|
|
142
|
+
readonly id: string;
|
|
143
|
+
} & {
|
|
144
|
+
payload: WebhookPayload;
|
|
145
|
+
}) => Effect.Effect<{
|
|
146
|
+
readonly id: string;
|
|
147
|
+
readonly name: string;
|
|
148
|
+
readonly organizationId: string;
|
|
149
|
+
readonly url: string;
|
|
150
|
+
readonly description: string | null;
|
|
151
|
+
readonly headers: {
|
|
152
|
+
readonly [x: string]: string;
|
|
153
|
+
} | null;
|
|
154
|
+
readonly events: readonly string[] | null;
|
|
155
|
+
readonly secret: string;
|
|
156
|
+
readonly enabled: boolean;
|
|
157
|
+
readonly createdAt: Date;
|
|
158
|
+
readonly updatedAt: Date;
|
|
159
|
+
} | null, Schema.SchemaError | import("effect/sql/SqlError").SqlError, never>;
|
|
160
|
+
delete: (input: {
|
|
161
|
+
readonly organizationId: string;
|
|
162
|
+
readonly id: string;
|
|
163
|
+
}) => Effect.Effect<{
|
|
164
|
+
success: boolean;
|
|
165
|
+
} | null, Schema.SchemaError | import("effect/sql/SqlError").SqlError, never>;
|
|
166
|
+
publish: (input: {
|
|
167
|
+
readonly organizationId: string;
|
|
168
|
+
readonly eventId: string;
|
|
169
|
+
readonly event: string;
|
|
170
|
+
readonly data: Schema.Json;
|
|
171
|
+
}) => Effect.Effect<undefined, Schema.SchemaError | import("effect/sql/SqlError").SqlError | WebhookError, never>;
|
|
172
|
+
cleanup: () => Effect.Effect<void, import("effect/sql/SqlError").SqlError, never>;
|
|
173
|
+
}> & {
|
|
174
|
+
readonly make: Effect.Effect<{
|
|
175
|
+
list: (request: {
|
|
176
|
+
readonly organizationId: string;
|
|
177
|
+
}) => Effect.Effect<{
|
|
178
|
+
readonly id: string;
|
|
179
|
+
readonly name: string;
|
|
180
|
+
readonly organizationId: string;
|
|
181
|
+
readonly url: string;
|
|
182
|
+
readonly description: string | null;
|
|
183
|
+
readonly headers: {
|
|
184
|
+
readonly [x: string]: string;
|
|
185
|
+
} | null;
|
|
186
|
+
readonly events: readonly string[] | null;
|
|
187
|
+
readonly secret: string;
|
|
188
|
+
readonly enabled: boolean;
|
|
189
|
+
readonly createdAt: Date;
|
|
190
|
+
readonly updatedAt: Date;
|
|
191
|
+
}[], Schema.SchemaError | import("effect/sql/SqlError").SqlError, never>;
|
|
192
|
+
get: (input: {
|
|
193
|
+
readonly organizationId: string;
|
|
194
|
+
readonly id: string;
|
|
195
|
+
}) => Effect.Effect<{
|
|
196
|
+
id: string;
|
|
197
|
+
name: string;
|
|
198
|
+
organizationId: string;
|
|
199
|
+
url: string;
|
|
200
|
+
description: string | null;
|
|
201
|
+
headers: {
|
|
202
|
+
readonly [x: string]: string;
|
|
203
|
+
} | null;
|
|
204
|
+
events: readonly string[] | null;
|
|
205
|
+
secret: string;
|
|
206
|
+
enabled: boolean;
|
|
207
|
+
createdAt: Date;
|
|
208
|
+
updatedAt: Date;
|
|
209
|
+
deliveries: {
|
|
210
|
+
readonly id: string;
|
|
211
|
+
readonly webhookId: string;
|
|
212
|
+
readonly event: string;
|
|
213
|
+
readonly data: Schema.Json;
|
|
214
|
+
readonly status: "failed" | "pending" | "success";
|
|
215
|
+
readonly error: string | null;
|
|
216
|
+
readonly completedAt: Date | null;
|
|
217
|
+
readonly retryAt: Date;
|
|
218
|
+
readonly retries: number;
|
|
219
|
+
readonly createdAt: Date;
|
|
220
|
+
readonly updatedAt: Date;
|
|
221
|
+
}[];
|
|
222
|
+
} | undefined, Schema.SchemaError | import("effect/sql/SqlError").SqlError, never>;
|
|
223
|
+
listDeliveries: (input: {
|
|
224
|
+
readonly page?: string | number | undefined;
|
|
225
|
+
readonly pageSize?: string | number | undefined;
|
|
226
|
+
readonly globalFilter?: string | undefined;
|
|
227
|
+
readonly organizationId: string;
|
|
228
|
+
readonly id: string;
|
|
229
|
+
readonly filters?: readonly ({
|
|
230
|
+
readonly id: string;
|
|
231
|
+
readonly kind: "number";
|
|
232
|
+
readonly min?: number | undefined;
|
|
233
|
+
readonly max?: number | undefined;
|
|
234
|
+
} | {
|
|
235
|
+
readonly id: string;
|
|
236
|
+
readonly kind: "date";
|
|
237
|
+
readonly from?: string | undefined;
|
|
238
|
+
readonly to?: string | undefined;
|
|
239
|
+
} | {
|
|
240
|
+
readonly id: string;
|
|
241
|
+
readonly kind: "text";
|
|
242
|
+
readonly operator: "contains" | "endsWith" | "equals" | "startsWith";
|
|
243
|
+
readonly value: string;
|
|
244
|
+
} | {
|
|
245
|
+
readonly id: string;
|
|
246
|
+
readonly kind: "boolean";
|
|
247
|
+
readonly value: boolean;
|
|
248
|
+
} | {
|
|
249
|
+
readonly id: string;
|
|
250
|
+
readonly kind: "values";
|
|
251
|
+
readonly values: readonly [string, ...string[]];
|
|
252
|
+
})[] | undefined;
|
|
253
|
+
readonly sort?: readonly {
|
|
254
|
+
readonly id: string;
|
|
255
|
+
readonly direction: "asc" | "desc";
|
|
256
|
+
}[] | undefined;
|
|
257
|
+
}) => Effect.Effect<{
|
|
258
|
+
data: {
|
|
259
|
+
readonly id: string;
|
|
260
|
+
readonly webhookId: string;
|
|
261
|
+
readonly event: string;
|
|
262
|
+
readonly data: Schema.Json;
|
|
263
|
+
readonly status: "failed" | "pending" | "success";
|
|
264
|
+
readonly error: string | null;
|
|
265
|
+
readonly completedAt: Date | null;
|
|
266
|
+
readonly retryAt: Date;
|
|
267
|
+
readonly retries: number;
|
|
268
|
+
readonly createdAt: Date;
|
|
269
|
+
readonly updatedAt: Date;
|
|
270
|
+
}[];
|
|
271
|
+
meta: {
|
|
272
|
+
page: number;
|
|
273
|
+
pageSize: number;
|
|
274
|
+
total: number;
|
|
275
|
+
pageCount: number;
|
|
276
|
+
};
|
|
277
|
+
} | undefined, Cause.NoSuchElementError | Schema.SchemaError | import("effect/sql/SqlError").SqlError, never>;
|
|
278
|
+
statistics: (input: {
|
|
279
|
+
readonly organizationId: string;
|
|
280
|
+
readonly id: string;
|
|
281
|
+
readonly interval: "day" | "hour";
|
|
282
|
+
}) => Effect.Effect<{
|
|
283
|
+
total: number;
|
|
284
|
+
success: number;
|
|
285
|
+
failed: number;
|
|
286
|
+
buckets: {
|
|
287
|
+
readonly total: number;
|
|
288
|
+
readonly success: number;
|
|
289
|
+
readonly failed: number;
|
|
290
|
+
readonly bucket: Date;
|
|
291
|
+
readonly events: readonly {
|
|
292
|
+
readonly event: string;
|
|
293
|
+
readonly total: number;
|
|
294
|
+
}[];
|
|
295
|
+
}[];
|
|
296
|
+
} | undefined, Cause.NoSuchElementError | Schema.SchemaError | import("effect/sql/SqlError").SqlError, never>;
|
|
297
|
+
create: (input: {
|
|
298
|
+
organizationId: string;
|
|
299
|
+
payload: WebhookPayload;
|
|
300
|
+
}) => Effect.Effect<{
|
|
301
|
+
id: string;
|
|
302
|
+
}, Schema.SchemaError | import("effect/sql/SqlError").SqlError, never>;
|
|
303
|
+
update: (input: {
|
|
304
|
+
readonly organizationId: string;
|
|
305
|
+
readonly id: string;
|
|
306
|
+
} & {
|
|
307
|
+
payload: WebhookPayload;
|
|
308
|
+
}) => Effect.Effect<{
|
|
309
|
+
readonly id: string;
|
|
310
|
+
readonly name: string;
|
|
311
|
+
readonly organizationId: string;
|
|
312
|
+
readonly url: string;
|
|
313
|
+
readonly description: string | null;
|
|
314
|
+
readonly headers: {
|
|
315
|
+
readonly [x: string]: string;
|
|
316
|
+
} | null;
|
|
317
|
+
readonly events: readonly string[] | null;
|
|
318
|
+
readonly secret: string;
|
|
319
|
+
readonly enabled: boolean;
|
|
320
|
+
readonly createdAt: Date;
|
|
321
|
+
readonly updatedAt: Date;
|
|
322
|
+
} | null, Schema.SchemaError | import("effect/sql/SqlError").SqlError, never>;
|
|
323
|
+
delete: (input: {
|
|
324
|
+
readonly organizationId: string;
|
|
325
|
+
readonly id: string;
|
|
326
|
+
}) => Effect.Effect<{
|
|
327
|
+
success: boolean;
|
|
328
|
+
} | null, Schema.SchemaError | import("effect/sql/SqlError").SqlError, never>;
|
|
329
|
+
publish: (input: {
|
|
330
|
+
readonly organizationId: string;
|
|
331
|
+
readonly eventId: string;
|
|
332
|
+
readonly event: string;
|
|
333
|
+
readonly data: Schema.Json;
|
|
334
|
+
}) => Effect.Effect<undefined, Schema.SchemaError | import("effect/sql/SqlError").SqlError | WebhookError, never>;
|
|
335
|
+
cleanup: () => Effect.Effect<void, import("effect/sql/SqlError").SqlError, never>;
|
|
336
|
+
}, never, SqlClient.SqlClient>;
|
|
337
|
+
};
|
|
338
|
+
export declare class Webhooks extends Webhooks_base {
|
|
339
|
+
static readonly layerWithoutMigrations: Layer.Layer<Webhooks, never, HttpClient.HttpClient | SqlClient.SqlClient | import("effect/workflow/WorkflowEngine").WorkflowEngine>;
|
|
340
|
+
static readonly layer: Layer.Layer<Webhooks, import("effect/sql/Migrator").MigrationError | import("effect/sql/SqlError").SqlError, import("effect/net/Dns").Dns | SqlClient.SqlClient | import("effect/workflow/WorkflowEngine").WorkflowEngine>;
|
|
341
|
+
}
|