@krak-stack/registry 0.1.60 → 0.2.0
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 +15 -0
- package/dist/components/ui/app-brand.js +17 -17
- package/dist/components/ui/code-block.js +6 -6
- package/dist/components/ui/color-picker.d.ts +30 -0
- package/dist/components/ui/color-picker.js +386 -0
- package/dist/components/ui/copy-button.js +4 -4
- package/dist/components/ui/data-table.js +468 -455
- package/dist/components/ui/editing-locale-switcher.js +10 -10
- package/dist/components/ui/effect-form.js +186 -185
- package/dist/components/ui/error-component.js +10 -18
- package/dist/components/ui/file-picker.js +2 -2
- package/dist/components/ui/form.d.ts +131 -335
- package/dist/components/ui/form.js +137 -136
- package/dist/components/ui/google-map.js +38 -6
- package/dist/components/ui/icon-input.js +48 -45
- package/dist/components/ui/krakstack-provider.js +2 -2
- package/dist/components/ui/locale-switcher.js +4 -4
- package/dist/components/ui/pagination.js +2 -2
- package/dist/components/ui/search-menu.js +2 -2
- package/dist/components/ui/sidebar-layout.js +82 -80
- package/dist/components/ui/theme-switcher.js +6 -6
- package/dist/components/ui/virtualized-combobox.js +34 -31
- package/dist/lib/docs.d.ts +2 -2
- package/dist/lib/docs.js +187 -185
- package/dist/lib/docs.server.js +45 -23
- package/dist/lib/documentation-toolkit.d.ts +2 -2
- package/dist/lib/documentation-toolkit.js +45 -23
- package/dist/lib/httpapi-adapter.d.ts +11 -3
- package/dist/lib/httpapi-adapter.js +42 -15
- package/dist/lib/httpapi-cli.d.ts +13 -4
- package/dist/lib/httpapi-cli.js +70 -28
- package/dist/lib/httpapi-toolkit.js +40 -13
- package/dist/lib/query.d.ts +4 -4
- package/dist/lib/query.js +13 -13
- package/dist/lib/seo.js +2 -2
- package/dist/lib/webfetch-toolkit.js +7 -7
- package/dist/oxlint/anti-slop/index.js +2 -2
- package/dist/services/agent/client/index.js +155 -153
- package/dist/services/agent/index.js +3 -3
- package/dist/services/agent/schema.js +5 -5
- package/dist/services/events/browser.js +38 -23
- package/dist/services/events/client/audit-log-table.js +472 -459
- package/dist/services/events/client/tracking-notice.js +9 -4
- package/dist/services/events/index.d.ts +3 -1
- package/dist/services/events/index.js +79 -74
- package/dist/services/events/migrations.js +2 -2
- package/dist/services/events/record.js +2 -2
- package/dist/services/events/schema.d.ts +18 -10
- package/dist/services/events/schema.js +42 -42
- package/dist/services/file-extraction/index.js +4 -4
- package/dist/services/file-extraction/schema.d.ts +3 -1
- package/dist/services/file-extraction/schema.js +2 -2
- package/dist/services/health/api.builder.d.ts +8 -8
- package/dist/services/health/api.group.d.ts +8 -8
- package/dist/services/health/index.d.ts +10 -6
- package/dist/services/health/index.js +17 -13
- package/dist/services/health/schema.d.ts +7 -7
- package/dist/services/notification/channels/ses/index.js +2 -2
- package/dist/services/notification/channels/ses/schema.js +2 -2
- package/dist/services/notification/client/index.js +5 -5
- package/dist/services/notification/index.js +3 -3
- package/dist/services/notification/persistence/drizzle.js +2 -2
- package/dist/services/notification/persistence/index.js +15 -15
- package/dist/services/notification/persistence/schema.js +12 -12
- package/dist/services/notification/public.js +8 -8
- package/dist/services/notification/schema.d.ts +3 -1
- package/dist/services/notification/schema.js +2 -2
- package/dist/services/opentelemetry/api.js +7 -5
- package/dist/services/opentelemetry/browser.js +9 -9
- package/dist/services/opentelemetry/index.js +2 -2
- package/dist/services/opentelemetry/processor.d.ts +3 -1
- package/dist/services/opentelemetry/web-vitals.js +12 -7
- package/dist/services/s3/index.js +2 -2
- package/dist/services/s3/schema.d.ts +3 -1
- package/dist/services/s3/schema.js +2 -2
- package/dist/services/speech/api.js +3 -1
- package/dist/services/speech/index.js +15 -8
- package/dist/services/speech/schema.d.ts +3 -1
- package/dist/services/speech/schema.js +12 -10
- package/dist/services/webhooks/client/delivery-table.d.ts +62 -0
- package/dist/services/webhooks/client/delivery-table.js +4711 -0
- package/dist/services/webhooks/http-client.d.ts +1 -0
- package/dist/services/webhooks/http-client.js +17 -5
- package/dist/services/webhooks/index.d.ts +2 -0
- package/dist/services/webhooks/index.js +249 -114
- package/dist/services/webhooks/migrations.d.ts +3 -0
- package/dist/services/webhooks/migrations.js +21 -2
- package/dist/services/webhooks/receiver.d.ts +45 -0
- package/dist/services/webhooks/schema.d.ts +15 -5
- package/dist/services/webhooks/schema.js +41 -21
- package/dist/services/webhooks/url.d.ts +5 -0
- package/dist/services/webhooks/url.js +18 -2
- package/package.json +10 -1
|
@@ -3,5 +3,6 @@ import { Dns } from "effect/net";
|
|
|
3
3
|
import { HttpClient } from "effect/http";
|
|
4
4
|
/** DNS preflight. Network egress rules must also prevent DNS rebinding. */
|
|
5
5
|
export declare const isPublicWebhookDestination: (url: URL) => Effect.Effect<boolean, never, Dns.Dns>;
|
|
6
|
+
export declare const isAllowedWebhookDestination: (url: URL) => Effect.Effect<boolean, never, Dns.Dns>;
|
|
6
7
|
/** Built-in fetch client with public-destination checks and no redirects. */
|
|
7
8
|
export declare const layer: Layer.Layer<HttpClient.HttpClient, never, Dns.Dns>;
|
|
@@ -4,6 +4,7 @@ import { Dns, NetAddress } from "effect/net";
|
|
|
4
4
|
import { FetchHttpClient, HttpClient, HttpClientError } from "effect/http";
|
|
5
5
|
|
|
6
6
|
// ../../src/services/webhooks/url.ts
|
|
7
|
+
import { Context } from "effect";
|
|
7
8
|
var hostname = (value) => value.toLowerCase().replace(/^\[|\]$/g, "").replace(/\.$/, "");
|
|
8
9
|
var isPublicIpAddress = (value) => {
|
|
9
10
|
const address = hostname(value);
|
|
@@ -23,22 +24,32 @@ var isPublicWebhookUrl = (url) => {
|
|
|
23
24
|
return false;
|
|
24
25
|
return !(host.includes(":") || /^\d+(?:\.\d+){3}$/.test(host)) || isPublicIpAddress(host);
|
|
25
26
|
};
|
|
27
|
+
var WebhookAllowLoopback = Context.Reference("Webhooks/AllowLoopback", {
|
|
28
|
+
defaultValue: () => false
|
|
29
|
+
});
|
|
30
|
+
var isLoopbackWebhookUrl = (url) => ["http:", "https:"].includes(url.protocol) && !url.username && !url.password && ["localhost", "127.0.0.1", "[::1]"].includes(url.hostname);
|
|
26
31
|
|
|
27
32
|
// ../../src/services/webhooks/http-client.ts
|
|
28
33
|
var isPublicWebhookDestination = Effect.fn("Webhooks.isPublicDestination")(function* (url) {
|
|
29
34
|
if (!isPublicWebhookUrl(url))
|
|
30
35
|
return false;
|
|
31
|
-
const
|
|
32
|
-
if (Result.isSuccess(NetAddress.ipFromString(
|
|
36
|
+
const hostname2 = url.hostname.replace(/^\[|\]$/g, "");
|
|
37
|
+
if (Result.isSuccess(NetAddress.ipFromString(hostname2)))
|
|
33
38
|
return true;
|
|
34
39
|
const dns = yield* Dns.Dns;
|
|
35
|
-
return yield* dns.lookup(
|
|
40
|
+
return yield* dns.lookup(hostname2).pipe(Effect.map((addresses) => addresses.every((address) => isPublicIpAddress(NetAddress.formatIp(address)))), Effect.orElseSucceed(() => false));
|
|
41
|
+
});
|
|
42
|
+
var isAllowedWebhookDestination = Effect.fn("Webhooks.isAllowedDestination")(function* (url) {
|
|
43
|
+
if ((yield* WebhookAllowLoopback) && isLoopbackWebhookUrl(url))
|
|
44
|
+
return true;
|
|
45
|
+
return yield* isPublicWebhookDestination(url);
|
|
36
46
|
});
|
|
37
47
|
var layer = Layer.effect(HttpClient.HttpClient, Effect.gen(function* () {
|
|
38
48
|
const client = yield* HttpClient.HttpClient;
|
|
39
49
|
const dns = yield* Dns.Dns;
|
|
50
|
+
const allowLoopback = yield* WebhookAllowLoopback;
|
|
40
51
|
return client.pipe(HttpClient.transform((response, request) => Effect.gen(function* () {
|
|
41
|
-
if (!(yield*
|
|
52
|
+
if (!(yield* isAllowedWebhookDestination(new URL(request.url)).pipe(Effect.provideService(Dns.Dns, dns), Effect.provideService(WebhookAllowLoopback, allowLoopback)))) {
|
|
42
53
|
return yield* new HttpClientError.HttpClientError({
|
|
43
54
|
reason: new HttpClientError.TransportError({
|
|
44
55
|
request,
|
|
@@ -52,6 +63,7 @@ var layer = Layer.effect(HttpClient.HttpClient, Effect.gen(function* () {
|
|
|
52
63
|
})));
|
|
53
64
|
})).pipe(Layer.provide(FetchHttpClient.layer));
|
|
54
65
|
export {
|
|
66
|
+
layer,
|
|
55
67
|
isPublicWebhookDestination,
|
|
56
|
-
|
|
68
|
+
isAllowedWebhookDestination
|
|
57
69
|
};
|
|
@@ -2,8 +2,10 @@ import { Cause, Context, Effect, Layer, Schema } from "effect";
|
|
|
2
2
|
import { HttpClient } from "effect/http";
|
|
3
3
|
import { Workflow } from "effect/workflow";
|
|
4
4
|
import { SqlClient } from "effect/sql";
|
|
5
|
+
export { WebhookAllowLoopback } from "./url.js";
|
|
5
6
|
import { WebhookError, WebhookPayload } from "./schema.js";
|
|
6
7
|
export * from "./schema.js";
|
|
8
|
+
export { WebhooksReceiver, WebhookVerificationError, WebhookReceiptConflict, } from "./receiver.js";
|
|
7
9
|
export declare const DeliverWebhookV1: Workflow.Workflow<"KrakstackDeliverWebhookV1", Schema.Struct<{
|
|
8
10
|
organizationId: Schema.String;
|
|
9
11
|
id: Schema.String;
|