@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.
Files changed (93) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/components/ui/app-brand.js +17 -17
  3. package/dist/components/ui/code-block.js +6 -6
  4. package/dist/components/ui/color-picker.d.ts +30 -0
  5. package/dist/components/ui/color-picker.js +386 -0
  6. package/dist/components/ui/copy-button.js +4 -4
  7. package/dist/components/ui/data-table.js +468 -455
  8. package/dist/components/ui/editing-locale-switcher.js +10 -10
  9. package/dist/components/ui/effect-form.js +186 -185
  10. package/dist/components/ui/error-component.js +10 -18
  11. package/dist/components/ui/file-picker.js +2 -2
  12. package/dist/components/ui/form.d.ts +131 -335
  13. package/dist/components/ui/form.js +137 -136
  14. package/dist/components/ui/google-map.js +38 -6
  15. package/dist/components/ui/icon-input.js +48 -45
  16. package/dist/components/ui/krakstack-provider.js +2 -2
  17. package/dist/components/ui/locale-switcher.js +4 -4
  18. package/dist/components/ui/pagination.js +2 -2
  19. package/dist/components/ui/search-menu.js +2 -2
  20. package/dist/components/ui/sidebar-layout.js +82 -80
  21. package/dist/components/ui/theme-switcher.js +6 -6
  22. package/dist/components/ui/virtualized-combobox.js +34 -31
  23. package/dist/lib/docs.d.ts +2 -2
  24. package/dist/lib/docs.js +187 -185
  25. package/dist/lib/docs.server.js +45 -23
  26. package/dist/lib/documentation-toolkit.d.ts +2 -2
  27. package/dist/lib/documentation-toolkit.js +45 -23
  28. package/dist/lib/httpapi-adapter.d.ts +11 -3
  29. package/dist/lib/httpapi-adapter.js +42 -15
  30. package/dist/lib/httpapi-cli.d.ts +13 -4
  31. package/dist/lib/httpapi-cli.js +70 -28
  32. package/dist/lib/httpapi-toolkit.js +40 -13
  33. package/dist/lib/query.d.ts +4 -4
  34. package/dist/lib/query.js +13 -13
  35. package/dist/lib/seo.js +2 -2
  36. package/dist/lib/webfetch-toolkit.js +7 -7
  37. package/dist/oxlint/anti-slop/index.js +2 -2
  38. package/dist/services/agent/client/index.js +155 -153
  39. package/dist/services/agent/index.js +3 -3
  40. package/dist/services/agent/schema.js +5 -5
  41. package/dist/services/events/browser.js +38 -23
  42. package/dist/services/events/client/audit-log-table.js +472 -459
  43. package/dist/services/events/client/tracking-notice.js +9 -4
  44. package/dist/services/events/index.d.ts +3 -1
  45. package/dist/services/events/index.js +79 -74
  46. package/dist/services/events/migrations.js +2 -2
  47. package/dist/services/events/record.js +2 -2
  48. package/dist/services/events/schema.d.ts +18 -10
  49. package/dist/services/events/schema.js +42 -42
  50. package/dist/services/file-extraction/index.js +4 -4
  51. package/dist/services/file-extraction/schema.d.ts +3 -1
  52. package/dist/services/file-extraction/schema.js +2 -2
  53. package/dist/services/health/api.builder.d.ts +8 -8
  54. package/dist/services/health/api.group.d.ts +8 -8
  55. package/dist/services/health/index.d.ts +10 -6
  56. package/dist/services/health/index.js +17 -13
  57. package/dist/services/health/schema.d.ts +7 -7
  58. package/dist/services/notification/channels/ses/index.js +2 -2
  59. package/dist/services/notification/channels/ses/schema.js +2 -2
  60. package/dist/services/notification/client/index.js +5 -5
  61. package/dist/services/notification/index.js +3 -3
  62. package/dist/services/notification/persistence/drizzle.js +2 -2
  63. package/dist/services/notification/persistence/index.js +15 -15
  64. package/dist/services/notification/persistence/schema.js +12 -12
  65. package/dist/services/notification/public.js +8 -8
  66. package/dist/services/notification/schema.d.ts +3 -1
  67. package/dist/services/notification/schema.js +2 -2
  68. package/dist/services/opentelemetry/api.js +7 -5
  69. package/dist/services/opentelemetry/browser.js +9 -9
  70. package/dist/services/opentelemetry/index.js +2 -2
  71. package/dist/services/opentelemetry/processor.d.ts +3 -1
  72. package/dist/services/opentelemetry/web-vitals.js +12 -7
  73. package/dist/services/s3/index.js +2 -2
  74. package/dist/services/s3/schema.d.ts +3 -1
  75. package/dist/services/s3/schema.js +2 -2
  76. package/dist/services/speech/api.js +3 -1
  77. package/dist/services/speech/index.js +15 -8
  78. package/dist/services/speech/schema.d.ts +3 -1
  79. package/dist/services/speech/schema.js +12 -10
  80. package/dist/services/webhooks/client/delivery-table.d.ts +62 -0
  81. package/dist/services/webhooks/client/delivery-table.js +4711 -0
  82. package/dist/services/webhooks/http-client.d.ts +1 -0
  83. package/dist/services/webhooks/http-client.js +17 -5
  84. package/dist/services/webhooks/index.d.ts +2 -0
  85. package/dist/services/webhooks/index.js +249 -114
  86. package/dist/services/webhooks/migrations.d.ts +3 -0
  87. package/dist/services/webhooks/migrations.js +21 -2
  88. package/dist/services/webhooks/receiver.d.ts +45 -0
  89. package/dist/services/webhooks/schema.d.ts +15 -5
  90. package/dist/services/webhooks/schema.js +41 -21
  91. package/dist/services/webhooks/url.d.ts +5 -0
  92. package/dist/services/webhooks/url.js +18 -2
  93. package/package.json +10 -1
@@ -0,0 +1,45 @@
1
+ import { Context, Effect, Layer, Redacted, Schema } from "effect";
2
+ import { SqlClient } from "effect/sql";
3
+ declare const WebhookVerificationError_base: Schema.Class<WebhookVerificationError, Schema.TaggedStruct<"WebhookVerificationError", {
4
+ readonly reason: Schema.Literals<readonly ["headers", "timestamp", "signature", "payload"]>;
5
+ }>, import("effect/Cause").YieldableError & {
6
+ readonly brand: unique symbol;
7
+ }>;
8
+ export declare class WebhookVerificationError extends WebhookVerificationError_base {
9
+ }
10
+ declare const WebhookReceiptConflict_base: Schema.Class<WebhookReceiptConflict, Schema.TaggedStruct<"WebhookReceiptConflict", {}>, import("effect/Cause").YieldableError & {
11
+ readonly brand: unique symbol;
12
+ }>;
13
+ export declare class WebhookReceiptConflict extends WebhookReceiptConflict_base {
14
+ }
15
+ declare const WebhooksReceiver_base: Context.ServiceClass<WebhooksReceiver, "krakstack/webhooks/WebhooksReceiver", {
16
+ receive: <S extends Schema.Top, E, R>(input: {
17
+ readonly receiver: string;
18
+ readonly secret: Redacted.Redacted<string>;
19
+ readonly headers: Readonly<Record<string, string | undefined>>;
20
+ readonly body: string;
21
+ readonly schema: S;
22
+ readonly handle: (payload: S["Type"]) => Effect.Effect<void, E, R>;
23
+ }) => Effect.Effect<{
24
+ duplicate: boolean;
25
+ }, E | import("effect/crypto/CryptoError").CryptoError | import("effect/Cause").NoSuchElementError | Schema.SchemaError | import("effect/sql/SqlError").SqlError | WebhookReceiptConflict | WebhookVerificationError, R | S["DecodingServices"]>;
26
+ cleanup: () => Effect.Effect<void, import("effect/sql/SqlError").SqlError, never>;
27
+ }> & {
28
+ readonly make: Effect.Effect<{
29
+ receive: <S extends Schema.Top, E, R>(input: {
30
+ readonly receiver: string;
31
+ readonly secret: Redacted.Redacted<string>;
32
+ readonly headers: Readonly<Record<string, string | undefined>>;
33
+ readonly body: string;
34
+ readonly schema: S;
35
+ readonly handle: (payload: S["Type"]) => Effect.Effect<void, E, R>;
36
+ }) => Effect.Effect<{
37
+ duplicate: boolean;
38
+ }, E | import("effect/crypto/CryptoError").CryptoError | import("effect/Cause").NoSuchElementError | Schema.SchemaError | import("effect/sql/SqlError").SqlError | WebhookReceiptConflict | WebhookVerificationError, R | S["DecodingServices"]>;
39
+ cleanup: () => Effect.Effect<void, import("effect/sql/SqlError").SqlError, never>;
40
+ }, never, SqlClient.SqlClient>;
41
+ };
42
+ export declare class WebhooksReceiver extends WebhooksReceiver_base {
43
+ static readonly layer: Layer.Layer<WebhooksReceiver, import("effect/sql/Migrator").MigrationError | import("effect/sql/SqlError").SqlError, SqlClient.SqlClient>;
44
+ }
45
+ export {};
@@ -58,6 +58,14 @@ export declare const WebhookPayload: Schema.Struct<{
58
58
  readonly events: Schema.NullOr<Schema.$Array<Schema.NonEmptyString>>;
59
59
  readonly customHeaders: Schema.NullOr<Schema.$Record<Schema.String, Schema.String>>;
60
60
  }>;
61
+ export declare const webhookPayloadSchema: (allowLoopback: boolean) => Schema.Struct<{
62
+ readonly name: Schema.optional<Schema.Trim>;
63
+ readonly description: Schema.NullOr<Schema.String>;
64
+ readonly enabled: Schema.Boolean;
65
+ readonly events: Schema.NullOr<Schema.$Array<Schema.NonEmptyString>>;
66
+ readonly customHeaders: Schema.NullOr<Schema.$Record<Schema.String, Schema.String>>;
67
+ readonly url: Schema.String;
68
+ }>;
61
69
  export declare const Webhook: Schema.Struct<{
62
70
  readonly id: Schema.String;
63
71
  readonly name: Schema.String;
@@ -86,8 +94,8 @@ export declare const WebhookDelivery: Schema.Struct<{
86
94
  }>;
87
95
  export declare const WebhookDeliverySortId: Schema.Literals<readonly ["id", "event", "status", "createdAt", "completedAt"]>;
88
96
  export declare const WebhookDeliveriesQuery: Schema.Struct<{
89
- readonly page: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Number, Schema.NumberFromString]>>, never, never>;
90
- readonly pageSize: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Number, Schema.NumberFromString]>>, never, never>;
97
+ readonly page: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Finite, Schema.FiniteFromString]>>, never, never>;
98
+ readonly pageSize: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Finite, Schema.FiniteFromString]>>, never, never>;
91
99
  readonly globalFilter: Schema.optional<Schema.String>;
92
100
  readonly filters: Schema.optional<Schema.declare<readonly ({
93
101
  readonly id: string;
@@ -145,8 +153,8 @@ export declare const WebhookDeliveriesQuery: Schema.Struct<{
145
153
  }[]>>;
146
154
  }>;
147
155
  export declare const ListWebhookDeliveries: Schema.Struct<{
148
- readonly page: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Number, Schema.NumberFromString]>>, never, never>;
149
- readonly pageSize: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Number, Schema.NumberFromString]>>, never, never>;
156
+ readonly page: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Finite, Schema.FiniteFromString]>>, never, never>;
157
+ readonly pageSize: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Finite, Schema.FiniteFromString]>>, never, never>;
150
158
  readonly globalFilter: Schema.optional<Schema.String>;
151
159
  readonly organizationId: Schema.NonEmptyString;
152
160
  readonly id: Schema.NonEmptyString;
@@ -234,7 +242,9 @@ export declare const PublishWebhook: Schema.Struct<{
234
242
  }>;
235
243
  declare const WebhookError_base: Schema.Class<WebhookError, Schema.TaggedStruct<"WebhookError", {
236
244
  readonly message: Schema.String;
237
- }>, import("effect/Cause").YieldableError>;
245
+ }>, import("effect/Cause").YieldableError & {
246
+ readonly brand: unique symbol;
247
+ }>;
238
248
  export declare class WebhookError extends WebhookError_base {
239
249
  }
240
250
  export type Webhook = typeof Webhook.Type;
@@ -2,6 +2,7 @@
2
2
  import { Schema as Schema2 } from "effect";
3
3
 
4
4
  // ../../src/services/webhooks/url.ts
5
+ import { Context } from "effect";
5
6
  var hostname = (value) => value.toLowerCase().replace(/^\[|\]$/g, "").replace(/\.$/, "");
6
7
  var isPublicIpAddress = (value) => {
7
8
  const address = hostname(value);
@@ -28,6 +29,18 @@ var isPublicWebhookUrlString = (value) => {
28
29
  return false;
29
30
  }
30
31
  };
32
+ var isAllowedWebhookUrlString = (value, allowLoopback) => {
33
+ try {
34
+ const url = new URL(value);
35
+ return isPublicWebhookUrl(url) || allowLoopback && isLoopbackWebhookUrl(url);
36
+ } catch {
37
+ return false;
38
+ }
39
+ };
40
+ var WebhookAllowLoopback = Context.Reference("Webhooks/AllowLoopback", {
41
+ defaultValue: () => false
42
+ });
43
+ var isLoopbackWebhookUrl = (url) => ["http:", "https:"].includes(url.protocol) && !url.username && !url.password && ["localhost", "127.0.0.1", "[::1]"].includes(url.hostname);
31
44
 
32
45
  // ../../src/lib/query.ts
33
46
  import {
@@ -156,11 +169,11 @@ var ColumnFilters = Schema.declare(Schema.is(ColumnFiltersArray), {
156
169
  toCodecStringTree: () => Schema.link()(Schema.fromJsonString(ColumnFiltersArray), SchemaTransformation.passthrough())
157
170
  });
158
171
  var Query = Schema.Struct({
159
- page: Schema.optional(Schema.Union([Schema.Number, Schema.NumberFromString]).check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0))).pipe(Schema.decodeTo(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), {
172
+ page: Schema.optional(Schema.Union([Schema.Finite, Schema.FiniteFromString]).check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0))).pipe(Schema.decodeTo(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), {
160
173
  decode: SchemaGetter.withDefault(Effect.succeed(0)),
161
174
  encode: SchemaGetter.transformOptional(Option.filter((page) => page !== 0))
162
175
  })),
163
- pageSize: Schema.optional(Schema.Union([Schema.Number, Schema.NumberFromString]).check(Schema.isInt(), Schema.isBetween({ minimum: 1, maximum: 100 }))).pipe(Schema.decodeTo(Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 100 })), {
176
+ pageSize: Schema.optional(Schema.Union([Schema.Finite, Schema.FiniteFromString]).check(Schema.isInt(), Schema.isBetween({ minimum: 1, maximum: 100 }))).pipe(Schema.decodeTo(Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 100 })), {
164
177
  decode: SchemaGetter.withDefault(Effect.succeed(20)),
165
178
  encode: SchemaGetter.transformOptional(Option.filter((pageSize) => pageSize !== 20))
166
179
  })),
@@ -252,6 +265,12 @@ var WebhookPayload = Schema2.Struct({
252
265
  "webhook-signature"
253
266
  ].includes(name.toLowerCase())), { expected: "headers that do not override webhook protocol headers" }))
254
267
  }).annotate({ identifier: "WebhookPayload" });
268
+ var webhookPayloadSchema = (allowLoopback) => Schema2.Struct({
269
+ ...WebhookPayload.fields,
270
+ url: Schema2.String.check(Schema2.makeFilter((value) => isAllowedWebhookUrlString(value, allowLoopback), {
271
+ expected: "a public HTTP(S) URL, or an explicitly enabled development loopback URL"
272
+ }))
273
+ }).annotate({ identifier: "ConfiguredWebhookPayload" });
255
274
  var Webhook = Schema2.Struct({
256
275
  id: Schema2.String,
257
276
  name: Schema2.String,
@@ -310,24 +329,25 @@ class WebhookError extends Schema2.TaggedError()("WebhookError", {
310
329
  }) {
311
330
  }
312
331
  export {
313
- ListWebhookDeliveries,
314
- PublishWebhook,
315
- Webhook,
316
- WebhookDeliveries,
317
- WebhookDeliveriesQuery,
318
- WebhookDelivery,
319
- WebhookDeliveryBucket,
320
- WebhookDeliveryCounts,
321
- WebhookDeliverySortId,
322
- WebhookError,
323
- WebhookEventCount,
324
- WebhookName,
325
- WebhookPayload,
326
- WebhookRequest,
327
- WebhookScope,
328
- WebhookStatistics,
329
- WebhookStatisticsInterval,
330
- WebhookStatisticsRequest,
332
+ webhookPayloadSchema,
333
+ webhookColumns,
331
334
  deliveryColumns,
332
- webhookColumns
335
+ WebhookStatisticsRequest,
336
+ WebhookStatisticsInterval,
337
+ WebhookStatistics,
338
+ WebhookScope,
339
+ WebhookRequest,
340
+ WebhookPayload,
341
+ WebhookName,
342
+ WebhookEventCount,
343
+ WebhookError,
344
+ WebhookDeliverySortId,
345
+ WebhookDeliveryCounts,
346
+ WebhookDeliveryBucket,
347
+ WebhookDelivery,
348
+ WebhookDeliveriesQuery,
349
+ WebhookDeliveries,
350
+ Webhook,
351
+ PublishWebhook,
352
+ ListWebhookDeliveries
333
353
  };
@@ -1,3 +1,8 @@
1
1
  export declare const isPublicIpAddress: (value: string) => boolean;
2
2
  export declare const isPublicWebhookUrl: (url: URL) => boolean;
3
3
  export declare const isPublicWebhookUrlString: (value: string) => boolean;
4
+ export declare const isAllowedWebhookUrlString: (value: string, allowLoopback: boolean) => boolean;
5
+ import { Context } from "effect";
6
+ /** Opt in only in a local development composition root, never from a request. */
7
+ export declare const WebhookAllowLoopback: Context.Reference<boolean>;
8
+ export declare const isLoopbackWebhookUrl: (url: URL) => boolean;
@@ -1,4 +1,5 @@
1
1
  // ../../src/services/webhooks/url.ts
2
+ import { Context } from "effect";
2
3
  var hostname = (value) => value.toLowerCase().replace(/^\[|\]$/g, "").replace(/\.$/, "");
3
4
  var isPublicIpAddress = (value) => {
4
5
  const address = hostname(value);
@@ -25,8 +26,23 @@ var isPublicWebhookUrlString = (value) => {
25
26
  return false;
26
27
  }
27
28
  };
29
+ var isAllowedWebhookUrlString = (value, allowLoopback) => {
30
+ try {
31
+ const url = new URL(value);
32
+ return isPublicWebhookUrl(url) || allowLoopback && isLoopbackWebhookUrl(url);
33
+ } catch {
34
+ return false;
35
+ }
36
+ };
37
+ var WebhookAllowLoopback = Context.Reference("Webhooks/AllowLoopback", {
38
+ defaultValue: () => false
39
+ });
40
+ var isLoopbackWebhookUrl = (url) => ["http:", "https:"].includes(url.protocol) && !url.username && !url.password && ["localhost", "127.0.0.1", "[::1]"].includes(url.hostname);
28
41
  export {
29
- isPublicIpAddress,
42
+ isPublicWebhookUrlString,
30
43
  isPublicWebhookUrl,
31
- isPublicWebhookUrlString
44
+ isPublicIpAddress,
45
+ isLoopbackWebhookUrl,
46
+ isAllowedWebhookUrlString,
47
+ WebhookAllowLoopback
32
48
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krak-stack/registry",
3
- "version": "0.1.60",
3
+ "version": "0.2.0",
4
4
  "description": "Tree-shakable KrakStack components and Effect services.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -17,6 +17,10 @@
17
17
  "type": "module",
18
18
  "sideEffects": false,
19
19
  "exports": {
20
+ "./webhooks/client": {
21
+ "types": "./dist/services/webhooks/client/delivery-table.d.ts",
22
+ "import": "./dist/services/webhooks/client/delivery-table.js"
23
+ },
20
24
  "./webhooks/http-client": {
21
25
  "types": "./dist/services/webhooks/http-client.d.ts",
22
26
  "import": "./dist/services/webhooks/http-client.js"
@@ -156,6 +160,10 @@
156
160
  "types": "./dist/components/ui/copy-button.d.ts",
157
161
  "import": "./dist/components/ui/copy-button.js"
158
162
  },
163
+ "./color-picker": {
164
+ "types": "./dist/components/ui/color-picker.d.ts",
165
+ "import": "./dist/components/ui/color-picker.js"
166
+ },
159
167
  "./data-table": {
160
168
  "types": "./dist/components/ui/data-table.d.ts",
161
169
  "import": "./dist/components/ui/data-table.js"
@@ -298,6 +306,7 @@
298
306
  "dependencies": {
299
307
  "@oxlint/plugins": "1.78.0",
300
308
  "bowser": "^2.14.1",
309
+ "react-colorful": "^5.8.1",
301
310
  "web-vitals": "^5.1.0"
302
311
  },
303
312
  "peerDependencies": {