@krak-stack/registry 0.1.61 → 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.
Files changed (56) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/components/ui/color-picker.d.ts +30 -0
  3. package/dist/components/ui/color-picker.js +384 -0
  4. package/dist/components/ui/data-table.js +26 -14
  5. package/dist/components/ui/effect-form.js +2 -2
  6. package/dist/components/ui/error-component.js +4 -12
  7. package/dist/components/ui/form.d.ts +126 -330
  8. package/dist/components/ui/google-map.js +38 -6
  9. package/dist/components/ui/sidebar-layout.js +10 -13
  10. package/dist/lib/docs.d.ts +2 -2
  11. package/dist/lib/docs.js +16 -19
  12. package/dist/lib/docs.server.js +5 -5
  13. package/dist/lib/documentation-toolkit.d.ts +2 -2
  14. package/dist/lib/documentation-toolkit.js +4 -4
  15. package/dist/lib/httpapi-adapter.d.ts +11 -3
  16. package/dist/lib/httpapi-adapter.js +40 -13
  17. package/dist/lib/httpapi-cli.d.ts +13 -4
  18. package/dist/lib/httpapi-cli.js +63 -21
  19. package/dist/lib/httpapi-toolkit.js +40 -13
  20. package/dist/lib/query.d.ts +4 -4
  21. package/dist/lib/query.js +2 -2
  22. package/dist/lib/webfetch-toolkit.js +1 -1
  23. package/dist/services/agent/index.js +1 -1
  24. package/dist/services/events/browser.js +32 -17
  25. package/dist/services/events/client/audit-log-table.js +26 -14
  26. package/dist/services/events/client/tracking-notice.js +9 -4
  27. package/dist/services/events/index.d.ts +3 -1
  28. package/dist/services/events/index.js +22 -17
  29. package/dist/services/events/schema.d.ts +18 -10
  30. package/dist/services/events/schema.js +3 -3
  31. package/dist/services/file-extraction/schema.d.ts +3 -1
  32. package/dist/services/health/api.builder.d.ts +8 -8
  33. package/dist/services/health/api.group.d.ts +8 -8
  34. package/dist/services/health/index.d.ts +10 -6
  35. package/dist/services/health/index.js +8 -4
  36. package/dist/services/health/schema.d.ts +7 -7
  37. package/dist/services/notification/index.js +1 -1
  38. package/dist/services/notification/public.js +1 -1
  39. package/dist/services/notification/schema.d.ts +3 -1
  40. package/dist/services/opentelemetry/api.js +5 -3
  41. package/dist/services/opentelemetry/browser.js +2 -2
  42. package/dist/services/opentelemetry/index.js +2 -2
  43. package/dist/services/opentelemetry/processor.d.ts +3 -1
  44. package/dist/services/opentelemetry/web-vitals.js +10 -5
  45. package/dist/services/s3/schema.d.ts +3 -1
  46. package/dist/services/speech/api.js +3 -1
  47. package/dist/services/speech/index.js +15 -8
  48. package/dist/services/speech/schema.d.ts +3 -1
  49. package/dist/services/speech/schema.js +3 -1
  50. package/dist/services/webhooks/client/delivery-table.js +26 -14
  51. package/dist/services/webhooks/http-client.js +1 -1
  52. package/dist/services/webhooks/index.js +14 -14
  53. package/dist/services/webhooks/receiver.d.ts +6 -2
  54. package/dist/services/webhooks/schema.d.ts +7 -5
  55. package/dist/services/webhooks/schema.js +2 -2
  56. package/package.json +6 -1
@@ -116,7 +116,7 @@ class OtlpEvents extends Context.Service()("krakstack/opentelemetry/Events") {
116
116
  }));
117
117
  }
118
118
  var event = Effect.fnUntraced(function* (name, properties, options) {
119
- const decoded = yield* Schema2.decodeUnknownEffect(TelemetryEvent)({
119
+ const decoded = yield* Schema2.decodeEffect(TelemetryEvent)({
120
120
  name,
121
121
  properties,
122
122
  options
@@ -178,7 +178,7 @@ var ServerEventsLive = Layer2.unwrap(Effect2.gen(function* () {
178
178
 
179
179
  class Otlp extends Context2.Service()("krakstack/opentelemetry/Otlp") {
180
180
  static event = event;
181
- static layer = Layer2.mergeAll(Layer2.succeed(this, { resource: OtlpResource2.fromConfig() }), EffectOtlp.layerFromConfig(), ServerEventsLive).pipe(Layer2.provideMerge(OtlpExporter2.layerFlusher), Layer2.provide(OtlpSerialization2.layerJson), Layer2.provide(FetchHttpClient.layer));
181
+ static layer = Layer2.mergeAll(Layer2.succeed(this, { resource: OtlpResource2.fromConfig() }), ServerEventsLive).pipe(Layer2.provideMerge(EffectOtlp.layerFromConfig()), Layer2.provideMerge(OtlpExporter2.layerFlusher), Layer2.provide(OtlpSerialization2.layerJson), Layer2.provide(FetchHttpClient.layer));
182
182
  }
183
183
  export {
184
184
  Otlp
@@ -7,7 +7,9 @@ export interface OtlpLogsResult {
7
7
  }
8
8
  declare const OtlpProcessingError_base: Schema.Class<OtlpProcessingError, Schema.TaggedStruct<"OtlpProcessingError", {
9
9
  readonly status: Schema.Literals<readonly [400, 403, 409, 413, 503]>;
10
- }>, import("effect/Cause").YieldableError>;
10
+ }>, import("effect/Cause").YieldableError & {
11
+ readonly brand: unique symbol;
12
+ }>;
11
13
  export declare class OtlpProcessingError extends OtlpProcessingError_base {
12
14
  }
13
15
  declare const OtlpLogsProcessor_base: Context.ServiceClass<OtlpLogsProcessor, "krakstack/opentelemetry/OtlpLogsProcessor", {
@@ -110,7 +110,7 @@ class OtlpEvents extends Context.Service()("krakstack/opentelemetry/Events") {
110
110
  }));
111
111
  }
112
112
  var event = Effect.fnUntraced(function* (name, properties, options) {
113
- const decoded = yield* Schema2.decodeUnknownEffect(TelemetryEvent)({
113
+ const decoded = yield* Schema2.decodeEffect(TelemetryEvent)({
114
114
  name,
115
115
  properties,
116
116
  options
@@ -146,8 +146,11 @@ var event = Effect.fnUntraced(function* (name, properties, options) {
146
146
  });
147
147
 
148
148
  // ../../src/services/opentelemetry/consent.ts
149
+ import * as Data from "effect/Data";
149
150
  import { SecureRandom } from "effect/crypto";
150
151
  import { Effect as Effect2, Option as Option2, Schema as Schema3 } from "effect";
152
+ class AnalyticsPreferenceStorageError extends Data.TaggedError("AnalyticsPreferenceStorageError") {
153
+ }
151
154
  var ANALYTICS_CONSENT_COOKIE = "krakstack_analytics_consent";
152
155
  var ANALYTICS_NOTICE_VERSION = "1";
153
156
  var changedEvent = "krakstack:analytics-consent";
@@ -158,7 +161,7 @@ var analyticsPreference = (cookie, now = Date.now()) => {
158
161
  const value = readCookie(cookie);
159
162
  if (!value)
160
163
  return;
161
- const decoded = Schema3.decodeUnknownOption(codec)(value);
164
+ const decoded = Schema3.decodeOption(codec)(value);
162
165
  if (Option2.isNone(decoded))
163
166
  return;
164
167
  const preference = decoded.value;
@@ -175,8 +178,10 @@ var browserPreference = () => {
175
178
  return;
176
179
  const cookie = Effect2.runSync(Effect2.try({
177
180
  try: () => document.cookie,
178
- catch: () => new Error("Analytics preference storage unavailable")
179
- }).pipe(Effect2.catch(() => Effect2.succeed(""))));
181
+ catch: () => new AnalyticsPreferenceStorageError({
182
+ message: "Analytics preference storage unavailable"
183
+ })
184
+ }).pipe(Effect2.orElseSucceed(() => "")));
180
185
  return analyticsPreference(cookie);
181
186
  };
182
187
  var consentGeneration = 0;
@@ -261,7 +266,7 @@ var WebVitalsLive = (requireConsent, respectDoNotTrack) => Layer2.effectDiscard(
261
266
  const report = (input) => {
262
267
  if (!canExport())
263
268
  return;
264
- const parsed = Schema4.decodeUnknownOption(BrowserWebVital)(input);
269
+ const parsed = Schema4.decodeOption(BrowserWebVital)(input);
265
270
  if (parsed._tag === "None")
266
271
  return;
267
272
  const metric = parsed.value;
@@ -12,7 +12,9 @@ declare const S3ServiceError_base: Schema.Class<S3ServiceError, Schema.TaggedStr
12
12
  readonly message: Schema.String;
13
13
  readonly path: Schema.optional<Schema.String>;
14
14
  readonly error: Schema.optional<Schema.Defect>;
15
- }>, import("effect/Cause").YieldableError>;
15
+ }>, import("effect/Cause").YieldableError & {
16
+ readonly brand: unique symbol;
17
+ }>;
16
18
  export declare class S3ServiceError extends S3ServiceError_base {
17
19
  }
18
20
  export {};
@@ -42,7 +42,9 @@ var MeloRequest = Schema.Struct({
42
42
  }).annotate({ identifier: "GatewayMeloRequest" });
43
43
  var MeloResponse = Schema.Struct({
44
44
  success: Schema.Literal(true),
45
- result: Schema.Struct({ audio: Schema.Uint8ArrayFromBase64.check(Schema.isMinLength(1)) })
45
+ result: Schema.Struct({
46
+ audio: Schema.Uint8ArrayFromBase64.check(Schema.isMinLength(1))
47
+ })
46
48
  }).annotate({ identifier: "GatewayMeloResponse" });
47
49
 
48
50
  // ../../src/services/speech/api.ts
@@ -1,6 +1,11 @@
1
1
  // ../../src/services/speech/index.ts
2
2
  import { Context, Effect, Layer, Schema as Schema2 } from "effect";
3
- import { FetchHttpClient, HttpClient, HttpClientRequest, HttpClientResponse } from "effect/http";
3
+ import {
4
+ FetchHttpClient,
5
+ HttpClient,
6
+ HttpClientRequest,
7
+ HttpClientResponse
8
+ } from "effect/http";
4
9
 
5
10
  // ../../src/services/speech/schema.ts
6
11
  import { Schema } from "effect";
@@ -42,7 +47,9 @@ var MeloRequest = Schema.Struct({
42
47
  }).annotate({ identifier: "GatewayMeloRequest" });
43
48
  var MeloResponse = Schema.Struct({
44
49
  success: Schema.Literal(true),
45
- result: Schema.Struct({ audio: Schema.Uint8ArrayFromBase64.check(Schema.isMinLength(1)) })
50
+ result: Schema.Struct({
51
+ audio: Schema.Uint8ArrayFromBase64.check(Schema.isMinLength(1))
52
+ })
46
53
  }).annotate({ identifier: "GatewayMeloResponse" });
47
54
 
48
55
  // ../../src/services/speech/index.ts
@@ -50,8 +57,8 @@ class Speech extends Context.Service()("@krak-stack/registry/speech/Speech", {
50
57
  make: (options) => Effect.gen(function* () {
51
58
  const http = (yield* HttpClient.HttpClient).pipe(HttpClient.filterStatusOk);
52
59
  const transcribe = Effect.fn("Speech.transcribe")(function* (input) {
53
- const url = yield* Schema2.decodeUnknownEffect(Schema2.URLFromString)(options.baseUrl);
54
- const path = yield* Schema2.decodeUnknownEffect(Schema2.String.check(Schema2.isPattern(/^\/.*accounts\/[^/]+\/ai\/(v1|run)\/?$/)))(url.pathname);
60
+ const url = yield* Schema2.decodeEffect(Schema2.URLFromString)(options.baseUrl);
61
+ const path = yield* Schema2.decodeEffect(Schema2.String.check(Schema2.isPattern(/^\/.*accounts\/[^/]+\/ai\/(v1|run)\/?$/)))(url.pathname);
55
62
  url.pathname = path.replace(/\/(v1|run)\/?$/, "/run/@cf/openai/whisper-large-v3-turbo");
56
63
  url.search = "";
57
64
  url.hash = "";
@@ -72,9 +79,9 @@ class Speech extends Context.Service()("@krak-stack/registry/speech/Speech", {
72
79
  return { text: body.result.text.trim() };
73
80
  }, Effect.timeout("60 seconds"), Effect.mapError(() => new SpeechUnavailable({})));
74
81
  const synthesize = Effect.fn("Speech.synthesize")(function* (input) {
75
- const payload = yield* Schema2.decodeUnknownEffect(SynthesizeSpeech)(input);
76
- const url = yield* Schema2.decodeUnknownEffect(Schema2.URLFromString)(options.baseUrl);
77
- const path = yield* Schema2.decodeUnknownEffect(Schema2.String.check(Schema2.isPattern(/^\/.*accounts\/[^/]+\/ai\/(v1|run)\/?$/)))(url.pathname);
82
+ const payload = yield* Schema2.decodeEffect(SynthesizeSpeech)(input);
83
+ const url = yield* Schema2.decodeEffect(Schema2.URLFromString)(options.baseUrl);
84
+ const path = yield* Schema2.decodeEffect(Schema2.String.check(Schema2.isPattern(/^\/.*accounts\/[^/]+\/ai\/(v1|run)\/?$/)))(url.pathname);
78
85
  url.pathname = path.replace(/\/(v1|run)\/?$/, "/run/@cf/myshell-ai/melotts");
79
86
  url.search = "";
80
87
  url.hash = "";
@@ -90,7 +97,7 @@ class Speech extends Context.Service()("@krak-stack/registry/speech/Speech", {
90
97
  const response = yield* http.execute(request);
91
98
  if (response.headers["content-type"]?.split(";")[0]?.trim() === "audio/mpeg") {
92
99
  const bytes = new Uint8Array(yield* response.arrayBuffer);
93
- return yield* Schema2.decodeUnknownEffect(Schema2.Uint8Array.check(Schema2.isMinLength(1)))(bytes);
100
+ return yield* Schema2.decodeEffect(Schema2.Uint8Array.check(Schema2.isMinLength(1)))(bytes);
94
101
  }
95
102
  const body = yield* HttpClientResponse.schemaBodyJson(MeloResponse)(response);
96
103
  return body.result.audio;
@@ -21,7 +21,9 @@ export declare const WhisperResponse: Schema.Struct<{
21
21
  readonly text: Schema.String;
22
22
  }>;
23
23
  }>;
24
- declare const SpeechUnavailable_base: Schema.Class<SpeechUnavailable, Schema.TaggedStruct<"SpeechUnavailable", {}>, import("effect/Cause").YieldableError>;
24
+ declare const SpeechUnavailable_base: Schema.Class<SpeechUnavailable, Schema.TaggedStruct<"SpeechUnavailable", {}>, import("effect/Cause").YieldableError & {
25
+ readonly brand: unique symbol;
26
+ }>;
25
27
  export declare class SpeechUnavailable extends SpeechUnavailable_base {
26
28
  }
27
29
  export type TranscribeAudio = typeof TranscribeAudio.Type;
@@ -38,7 +38,9 @@ var MeloRequest = Schema.Struct({
38
38
  }).annotate({ identifier: "GatewayMeloRequest" });
39
39
  var MeloResponse = Schema.Struct({
40
40
  success: Schema.Literal(true),
41
- result: Schema.Struct({ audio: Schema.Uint8ArrayFromBase64.check(Schema.isMinLength(1)) })
41
+ result: Schema.Struct({
42
+ audio: Schema.Uint8ArrayFromBase64.check(Schema.isMinLength(1))
43
+ })
42
44
  }).annotate({ identifier: "GatewayMeloResponse" });
43
45
  export {
44
46
  AudioMimeType,
@@ -5,7 +5,7 @@ import { Check as Check3, Clock, FileJson as FileJson2, X as X2 } from "lucide-r
5
5
  // ../../src/components/ui/data-table.tsx
6
6
  import { useAtom, useAtomSet } from "@effect/atom-react";
7
7
  import { BrowserKeyValueStore } from "@effect/platform-browser";
8
- import { DateTime as DateTime2, Effect as Effect2, Option as Option2, Schema as Schema2, Stream } from "effect";
8
+ import { DateTime as DateTime2, Effect as Effect2, Formatter, Option as Option2, Schema as Schema2, Stream } from "effect";
9
9
  import { Csv } from "effect/encoding";
10
10
  import { AsyncResult, Atom } from "effect/reactivity";
11
11
  import {
@@ -1165,11 +1165,11 @@ var ColumnFilters = Schema.declare(Schema.is(ColumnFiltersArray), {
1165
1165
  toCodecStringTree: () => Schema.link()(Schema.fromJsonString(ColumnFiltersArray), SchemaTransformation.passthrough())
1166
1166
  });
1167
1167
  var Query = Schema.Struct({
1168
- page: Schema.optional(Schema.Union([Schema.Number, Schema.NumberFromString]).check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0))).pipe(Schema.decodeTo(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), {
1168
+ page: Schema.optional(Schema.Union([Schema.Finite, Schema.FiniteFromString]).check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0))).pipe(Schema.decodeTo(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), {
1169
1169
  decode: SchemaGetter.withDefault(Effect.succeed(0)),
1170
1170
  encode: SchemaGetter.transformOptional(Option.filter((page) => page !== 0))
1171
1171
  })),
1172
- 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 })), {
1172
+ 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 })), {
1173
1173
  decode: SchemaGetter.withDefault(Effect.succeed(20)),
1174
1174
  encode: SchemaGetter.transformOptional(Option.filter((pageSize) => pageSize !== 20))
1175
1175
  })),
@@ -1210,7 +1210,7 @@ import { useKrakstackLocale as useKrakstackLocale3 } from "@krak-stack/registry/
1210
1210
  import { jsx as jsx15, jsxs as jsxs9, Fragment } from "react/jsx-runtime";
1211
1211
  var DataTablePersistedUiStateSchema = Schema2.Struct({
1212
1212
  columnVisibility: Schema2.Record(Schema2.String, Schema2.Boolean),
1213
- columnSizing: Schema2.Record(Schema2.String, Schema2.Number),
1213
+ columnSizing: Schema2.Record(Schema2.String, Schema2.Finite),
1214
1214
  grouping: Schema2.optionalKey(Schema2.Array(Schema2.String)),
1215
1215
  view: Schema2.Literals(["table", "gallery"])
1216
1216
  }).annotate({ identifier: "DataTablePersistedUiState" });
@@ -1490,6 +1490,14 @@ var formatNumberValue = (value, options = {}, defaultLocale = "en") => {
1490
1490
  } = options;
1491
1491
  return new Intl.NumberFormat(locale ?? defaultLocale, format).format(value);
1492
1492
  };
1493
+ var scalarText = Schema2.is(Schema2.Union([
1494
+ Schema2.String,
1495
+ Schema2.Finite,
1496
+ Schema2.Boolean,
1497
+ Schema2.BigInt,
1498
+ Schema2.Symbol
1499
+ ]));
1500
+ var dataTableValueText = (value) => value == null ? "" : scalarText(value) ? String(value) : Formatter.format(value);
1493
1501
  var booleanLabel = (value, options) => value ? options?.trueLabel : options?.falseLabel;
1494
1502
  var getDataTableExportValue = (row, column, locale = "en") => {
1495
1503
  const value = row.values.get(column.id);
@@ -1521,7 +1529,7 @@ var filterDataTableRows = (rows, columns, globalFilter, locale = "en") => {
1521
1529
  return rows.filter((row) => searchable.some((column) => {
1522
1530
  const value = row.values.get(column.id);
1523
1531
  const colDef = column.colDef;
1524
- let text = String(value ?? "");
1532
+ let text = dataTableValueText(value);
1525
1533
  if (colDef.type === "date" || colDef.type === "dateTime") {
1526
1534
  const date = resolveDate(value, colDef.type);
1527
1535
  text = date ? `${formatDateValue(date, colDef, locale)} ${dateIsoValue(date)}` : "";
@@ -1568,7 +1576,7 @@ var filterDataTableColumnRows = (rows, columns, filters) => {
1568
1576
  }) : row.values.get(column.id);
1569
1577
  switch (filter.kind) {
1570
1578
  case "text": {
1571
- const text = String(value ?? "").toLocaleLowerCase();
1579
+ const text = dataTableValueText(value).toLocaleLowerCase();
1572
1580
  const query = filter.value.toLocaleLowerCase();
1573
1581
  switch (filter.operator) {
1574
1582
  case "contains":
@@ -1595,7 +1603,7 @@ var filterDataTableColumnRows = (rows, columns, filters) => {
1595
1603
  case "boolean":
1596
1604
  return Option2.getOrUndefined(decodeBooleanValue(value)) === filter.value;
1597
1605
  case "values": {
1598
- const values = column.colDef.type === "list" ? column.colDef.typeOptions.getItems(row.data).map((item) => item.value ?? item.label) : [String(value ?? "")];
1606
+ const values = column.colDef.type === "list" ? column.colDef.typeOptions.getItems(row.data).map((item) => item.value ?? item.label) : [dataTableValueText(value)];
1599
1607
  return filter.values.some((selected) => values.includes(selected));
1600
1608
  }
1601
1609
  }
@@ -1642,7 +1650,7 @@ var sortDataTableRows = (rows, columns, sorting) => {
1642
1650
  return sort.direction === "desc" ? -comparison : comparison;
1643
1651
  continue;
1644
1652
  }
1645
- const comparison = column.colDef.comparator ? column.colDef.comparator(leftValue, rightValue, left.row.data, right.row.data) : Object.is(leftValue, rightValue) ? 0 : leftValue === null || leftValue === undefined ? 1 : rightValue === null || rightValue === undefined ? -1 : Schema2.is(Schema2.Number)(leftValue) && Schema2.is(Schema2.Number)(rightValue) ? leftValue - rightValue : String(leftValue).localeCompare(String(rightValue), undefined, { numeric: true, sensitivity: "base" });
1653
+ const comparison = column.colDef.comparator ? column.colDef.comparator(leftValue, rightValue, left.row.data, right.row.data) : Object.is(leftValue, rightValue) ? 0 : leftValue === null || leftValue === undefined ? 1 : rightValue === null || rightValue === undefined ? -1 : Schema2.is(Schema2.Finite)(leftValue) && Schema2.is(Schema2.Finite)(rightValue) ? leftValue - rightValue : dataTableValueText(leftValue).localeCompare(dataTableValueText(rightValue), undefined, { numeric: true, sensitivity: "base" });
1646
1654
  if (comparison !== 0)
1647
1655
  return sort.direction === "desc" ? -comparison : comparison;
1648
1656
  }
@@ -1922,10 +1930,10 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
1922
1930
  totalCount: config.getTotalCount?.(row.data)
1923
1931
  });
1924
1932
  }
1925
- return column.colDef.valueFormatter?.(params) ?? (value === null || value === undefined ? null : String(value));
1933
+ return column.colDef.valueFormatter?.(params) ?? (value === null || value === undefined ? null : dataTableValueText(value));
1926
1934
  };
1927
1935
  var nodeText = (node) => {
1928
- if (Schema2.is(Schema2.String)(node) || Schema2.is(Schema2.Number)(node))
1936
+ if (Schema2.is(Schema2.String)(node) || Schema2.is(Schema2.Finite)(node))
1929
1937
  return String(node);
1930
1938
  if (!isValidElement(node))
1931
1939
  return "";
@@ -2242,7 +2250,7 @@ var DataTableToolbar = ({
2242
2250
  children: [
2243
2251
  /* @__PURE__ */ jsxs9(MenubarItem, {
2244
2252
  disabled: exporting || !exportRows.length,
2245
- onClick: () => downloadCsv(exportColumns.map(columnLabel), exportRows.map((row) => exportColumns.map((column) => String(getDataTableExportValue(row, column, store.config.locale) ?? ""))), features.export ? features.export.baseName : "table"),
2253
+ onClick: () => downloadCsv(exportColumns.map(columnLabel), exportRows.map((row) => exportColumns.map((column) => dataTableValueText(getDataTableExportValue(row, column, store.config.locale) ?? ""))), features.export ? features.export.baseName : "table"),
2246
2254
  children: [
2247
2255
  /* @__PURE__ */ jsx15(FileText, {}),
2248
2256
  labels.exportCsv
@@ -2421,8 +2429,8 @@ var FilterEditor = ({
2421
2429
  to: secondary || undefined
2422
2430
  });
2423
2431
  else {
2424
- const min = primary ? Schema2.decodeUnknownOption(Schema2.FiniteFromString)(primary) : Option2.some(undefined);
2425
- const max = secondary ? Schema2.decodeUnknownOption(Schema2.FiniteFromString)(secondary) : Option2.some(undefined);
2432
+ const min = primary ? Schema2.decodeOption(Schema2.FiniteFromString)(primary) : Option2.some(undefined);
2433
+ const max = secondary ? Schema2.decodeOption(Schema2.FiniteFromString)(secondary) : Option2.some(undefined);
2426
2434
  if (Option2.isNone(min) || Option2.isNone(max)) {
2427
2435
  setInvalid(true);
2428
2436
  return;
@@ -3915,7 +3923,11 @@ var EditableDataTableListCell = ({
3915
3923
  messages
3916
3924
  }) => {
3917
3925
  const [selected, setSelected] = useState([...items]);
3918
- useLayoutEffect(() => setSelected([...items]), [items]);
3926
+ const [previousItems, setPreviousItems] = useState(items);
3927
+ if (previousItems !== items) {
3928
+ setPreviousItems(items);
3929
+ setSelected([...items]);
3930
+ }
3919
3931
  const selectedValues = new Set(selected.map((item) => item.value));
3920
3932
  const available = options.filter((item) => !selectedValues.has(item.value));
3921
3933
  const canAdd = !!onAdd && available.length > 0;
@@ -37,7 +37,7 @@ var isPublicWebhookDestination = Effect.fn("Webhooks.isPublicDestination")(funct
37
37
  if (Result.isSuccess(NetAddress.ipFromString(hostname)))
38
38
  return true;
39
39
  const dns = yield* Dns.Dns;
40
- return yield* dns.lookup(hostname).pipe(Effect.map((addresses) => addresses.every((address) => isPublicIpAddress(NetAddress.formatIp(address)))), Effect.catch(() => Effect.succeed(false)));
40
+ return yield* dns.lookup(hostname).pipe(Effect.map((addresses) => addresses.every((address) => isPublicIpAddress(NetAddress.formatIp(address)))), Effect.orElseSucceed(() => false));
41
41
  });
42
42
  var isAllowedWebhookDestination = Effect.fn("Webhooks.isAllowedDestination")(function* (url) {
43
43
  if ((yield* WebhookAllowLoopback) && isLoopbackWebhookUrl(url))
@@ -124,7 +124,7 @@ var isPublicWebhookDestination = Effect2.fn("Webhooks.isPublicDestination")(func
124
124
  if (Result.isSuccess(NetAddress.ipFromString(hostname)))
125
125
  return true;
126
126
  const dns = yield* Dns.Dns;
127
- return yield* dns.lookup(hostname).pipe(Effect2.map((addresses) => addresses.every((address) => isPublicIpAddress(NetAddress.formatIp(address)))), Effect2.catch(() => Effect2.succeed(false)));
127
+ return yield* dns.lookup(hostname).pipe(Effect2.map((addresses) => addresses.every((address) => isPublicIpAddress(NetAddress.formatIp(address)))), Effect2.orElseSucceed(() => false));
128
128
  });
129
129
  var isAllowedWebhookDestination = Effect2.fn("Webhooks.isAllowedDestination")(function* (url) {
130
130
  if ((yield* WebhookAllowLoopback) && isLoopbackWebhookUrl(url))
@@ -280,11 +280,11 @@ var ColumnFilters = Schema.declare(Schema.is(ColumnFiltersArray), {
280
280
  toCodecStringTree: () => Schema.link()(Schema.fromJsonString(ColumnFiltersArray), SchemaTransformation.passthrough())
281
281
  });
282
282
  var Query = Schema.Struct({
283
- page: Schema.optional(Schema.Union([Schema.Number, Schema.NumberFromString]).check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0))).pipe(Schema.decodeTo(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), {
283
+ page: Schema.optional(Schema.Union([Schema.Finite, Schema.FiniteFromString]).check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0))).pipe(Schema.decodeTo(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), {
284
284
  decode: SchemaGetter.withDefault(Effect3.succeed(0)),
285
285
  encode: SchemaGetter.transformOptional(Option.filter((page) => page !== 0))
286
286
  })),
287
- 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 })), {
287
+ 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 })), {
288
288
  decode: SchemaGetter.withDefault(Effect3.succeed(20)),
289
289
  encode: SchemaGetter.transformOptional(Option.filter((pageSize) => pageSize !== 20))
290
290
  })),
@@ -491,8 +491,8 @@ class WebhooksReceiver extends Context2.Service()("krakstack/webhooks/WebhooksRe
491
491
  const valid = yield* mac.verify(key, signature, new TextEncoder().encode(`${headers["webhook-id"]}.${timestamp}.${input.body}`));
492
492
  if (!valid)
493
493
  return yield* new WebhookVerificationError({ reason: "signature" });
494
- const payload = yield* Schema3.decodeUnknownEffect(Schema3.fromJsonString(input.schema))(input.body).pipe(Effect4.mapError(() => new WebhookVerificationError({ reason: "payload" })));
495
- const request = yield* Schema3.decodeUnknownEffect(ReceiptRequest)({
494
+ const payload = yield* Schema3.decodeEffect(Schema3.fromJsonString(input.schema))(input.body).pipe(Effect4.mapError(() => new WebhookVerificationError({ reason: "payload" })));
495
+ const request = yield* Schema3.decodeEffect(ReceiptRequest)({
496
496
  receiver: input.receiver,
497
497
  eventId: headers["webhook-id"],
498
498
  bodyHash: yield* digest.digestHex(Digest.sha256, new TextEncoder().encode(input.body))
@@ -610,7 +610,7 @@ var workflowLayer = DeliverWebhookV1.toLayer((input) => Effect5.gen(function* ()
610
610
  for (let step = 0;; step++) {
611
611
  const wait = yield* Activity.make({
612
612
  name: `DeliverWebhookAttemptV1-${step}`,
613
- success: Schema4.NullOr(Schema4.Number),
613
+ success: Schema4.NullOr(Schema4.Finite),
614
614
  error: WebhookError,
615
615
  execute: processDelivery(input).pipe(Effect5.mapError(() => new WebhookError({
616
616
  message: "Webhook delivery persistence failed"
@@ -669,7 +669,7 @@ class Webhooks extends Context3.Service()("krakstack/webhooks/Webhooks", {
669
669
  });
670
670
  const status = sql`CASE WHEN d.status = 'pending' AND d.retries > 0 THEN 'failed' ELSE d.status END`;
671
671
  const listDeliveries = Effect5.fn("Webhooks.listDeliveries")(function* (input) {
672
- const request = yield* Schema4.decodeUnknownEffect(ListWebhookDeliveries)(input);
672
+ const request = yield* Schema4.decodeEffect(ListWebhookDeliveries)(input);
673
673
  if (Option3.isNone(yield* find(request)))
674
674
  return;
675
675
  const columns = {
@@ -730,7 +730,7 @@ class Webhooks extends Context3.Service()("krakstack/webhooks/Webhooks", {
730
730
  };
731
731
  });
732
732
  const statistics = Effect5.fn("Webhooks.statistics")(function* (input) {
733
- const request = yield* Schema4.decodeUnknownEffect(WebhookStatisticsRequest)(input);
733
+ const request = yield* Schema4.decodeEffect(WebhookStatisticsRequest)(input);
734
734
  if (Option3.isNone(yield* find(request)))
735
735
  return;
736
736
  const totals = yield* SqlSchema2.findOne({
@@ -775,8 +775,8 @@ class Webhooks extends Context3.Service()("krakstack/webhooks/Webhooks", {
775
775
  return { ...totals, buckets };
776
776
  });
777
777
  const create = Effect5.fn("Webhooks.create")(function* (input) {
778
- const { organizationId } = yield* Schema4.decodeUnknownEffect(WebhookScope)(input);
779
- const payload = yield* Schema4.decodeUnknownEffect(configuredPayload)(input.payload);
778
+ const { organizationId } = yield* Schema4.decodeEffect(WebhookScope)(input);
779
+ const payload = yield* Schema4.decodeEffect(configuredPayload)(input.payload);
780
780
  const id = yield* random.uuidV7();
781
781
  const secret = Hex2.encode(yield* random.randomBytes(32));
782
782
  yield* sql`INSERT INTO webhooks (id, organization_id, name, url, description, enabled, events, headers, secret)
@@ -785,8 +785,8 @@ class Webhooks extends Context3.Service()("krakstack/webhooks/Webhooks", {
785
785
  return { id };
786
786
  });
787
787
  const update = Effect5.fn("Webhooks.update")(function* (input) {
788
- const { organizationId, id } = yield* Schema4.decodeUnknownEffect(WebhookRequest)(input);
789
- const payload = yield* Schema4.decodeUnknownEffect(configuredPayload)(input.payload);
788
+ const { organizationId, id } = yield* Schema4.decodeEffect(WebhookRequest)(input);
789
+ const payload = yield* Schema4.decodeEffect(configuredPayload)(input.payload);
790
790
  return yield* SqlSchema2.findOneOption({
791
791
  Request: Schema4.Void,
792
792
  Result: Webhook,
@@ -796,12 +796,12 @@ class Webhooks extends Context3.Service()("krakstack/webhooks/Webhooks", {
796
796
  })().pipe(Effect5.map(Option3.getOrNull));
797
797
  });
798
798
  const remove = Effect5.fn("Webhooks.delete")(function* (input) {
799
- const { organizationId, id } = yield* Schema4.decodeUnknownEffect(WebhookRequest)(input);
799
+ const { organizationId, id } = yield* Schema4.decodeEffect(WebhookRequest)(input);
800
800
  const rows = yield* sql`DELETE FROM webhooks WHERE organization_id = ${organizationId} AND id = ${id} RETURNING id`;
801
801
  return rows.length ? { success: true } : null;
802
802
  });
803
803
  const publish = Effect5.fn("Webhooks.publish")(function* (input) {
804
- const { organizationId, eventId, event, data } = yield* Schema4.decodeUnknownEffect(PublishWebhook)(input);
804
+ const { organizationId, eventId, event, data } = yield* Schema4.decodeEffect(PublishWebhook)(input);
805
805
  const inserted = yield* sql`INSERT INTO webhook_publications (organization_id, event_id, event, data)
806
806
  VALUES (${organizationId}, ${eventId}, ${event}, ${pg.json(data)}) ON CONFLICT DO NOTHING RETURNING event_id`;
807
807
  if (!inserted.length) {
@@ -2,10 +2,14 @@ import { Context, Effect, Layer, Redacted, Schema } from "effect";
2
2
  import { SqlClient } from "effect/sql";
3
3
  declare const WebhookVerificationError_base: Schema.Class<WebhookVerificationError, Schema.TaggedStruct<"WebhookVerificationError", {
4
4
  readonly reason: Schema.Literals<readonly ["headers", "timestamp", "signature", "payload"]>;
5
- }>, import("effect/Cause").YieldableError>;
5
+ }>, import("effect/Cause").YieldableError & {
6
+ readonly brand: unique symbol;
7
+ }>;
6
8
  export declare class WebhookVerificationError extends WebhookVerificationError_base {
7
9
  }
8
- declare const WebhookReceiptConflict_base: Schema.Class<WebhookReceiptConflict, Schema.TaggedStruct<"WebhookReceiptConflict", {}>, import("effect/Cause").YieldableError>;
10
+ declare const WebhookReceiptConflict_base: Schema.Class<WebhookReceiptConflict, Schema.TaggedStruct<"WebhookReceiptConflict", {}>, import("effect/Cause").YieldableError & {
11
+ readonly brand: unique symbol;
12
+ }>;
9
13
  export declare class WebhookReceiptConflict extends WebhookReceiptConflict_base {
10
14
  }
11
15
  declare const WebhooksReceiver_base: Context.ServiceClass<WebhooksReceiver, "krakstack/webhooks/WebhooksReceiver", {
@@ -94,8 +94,8 @@ export declare const WebhookDelivery: Schema.Struct<{
94
94
  }>;
95
95
  export declare const WebhookDeliverySortId: Schema.Literals<readonly ["id", "event", "status", "createdAt", "completedAt"]>;
96
96
  export declare const WebhookDeliveriesQuery: Schema.Struct<{
97
- readonly page: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Number, Schema.NumberFromString]>>, never, never>;
98
- 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>;
99
99
  readonly globalFilter: Schema.optional<Schema.String>;
100
100
  readonly filters: Schema.optional<Schema.declare<readonly ({
101
101
  readonly id: string;
@@ -153,8 +153,8 @@ export declare const WebhookDeliveriesQuery: Schema.Struct<{
153
153
  }[]>>;
154
154
  }>;
155
155
  export declare const ListWebhookDeliveries: Schema.Struct<{
156
- readonly page: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Number, Schema.NumberFromString]>>, never, never>;
157
- 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>;
158
158
  readonly globalFilter: Schema.optional<Schema.String>;
159
159
  readonly organizationId: Schema.NonEmptyString;
160
160
  readonly id: Schema.NonEmptyString;
@@ -242,7 +242,9 @@ export declare const PublishWebhook: Schema.Struct<{
242
242
  }>;
243
243
  declare const WebhookError_base: Schema.Class<WebhookError, Schema.TaggedStruct<"WebhookError", {
244
244
  readonly message: Schema.String;
245
- }>, import("effect/Cause").YieldableError>;
245
+ }>, import("effect/Cause").YieldableError & {
246
+ readonly brand: unique symbol;
247
+ }>;
246
248
  export declare class WebhookError extends WebhookError_base {
247
249
  }
248
250
  export type Webhook = typeof Webhook.Type;
@@ -169,11 +169,11 @@ var ColumnFilters = Schema.declare(Schema.is(ColumnFiltersArray), {
169
169
  toCodecStringTree: () => Schema.link()(Schema.fromJsonString(ColumnFiltersArray), SchemaTransformation.passthrough())
170
170
  });
171
171
  var Query = Schema.Struct({
172
- 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)), {
173
173
  decode: SchemaGetter.withDefault(Effect.succeed(0)),
174
174
  encode: SchemaGetter.transformOptional(Option.filter((page) => page !== 0))
175
175
  })),
176
- 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 })), {
177
177
  decode: SchemaGetter.withDefault(Effect.succeed(20)),
178
178
  encode: SchemaGetter.transformOptional(Option.filter((pageSize) => pageSize !== 20))
179
179
  })),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krak-stack/registry",
3
- "version": "0.1.61",
3
+ "version": "0.2.1",
4
4
  "description": "Tree-shakable KrakStack components and Effect services.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -160,6 +160,10 @@
160
160
  "types": "./dist/components/ui/copy-button.d.ts",
161
161
  "import": "./dist/components/ui/copy-button.js"
162
162
  },
163
+ "./color-picker": {
164
+ "types": "./dist/components/ui/color-picker.d.ts",
165
+ "import": "./dist/components/ui/color-picker.js"
166
+ },
163
167
  "./data-table": {
164
168
  "types": "./dist/components/ui/data-table.d.ts",
165
169
  "import": "./dist/components/ui/data-table.js"
@@ -302,6 +306,7 @@
302
306
  "dependencies": {
303
307
  "@oxlint/plugins": "1.78.0",
304
308
  "bowser": "^2.14.1",
309
+ "react-colorful": "^5.8.1",
305
310
  "web-vitals": "^5.1.0"
306
311
  },
307
312
  "peerDependencies": {