@krak-stack/registry 0.1.61 → 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 +6 -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.js +506 -493
- package/dist/services/webhooks/http-client.js +5 -5
- package/dist/services/webhooks/index.js +47 -47
- package/dist/services/webhooks/migrations.js +5 -5
- package/dist/services/webhooks/receiver.d.ts +6 -2
- package/dist/services/webhooks/schema.d.ts +7 -5
- package/dist/services/webhooks/schema.js +22 -22
- package/dist/services/webhooks/url.js +5 -5
- package/package.json +6 -1
|
@@ -148,6 +148,7 @@ function DialogDescription({
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
// ../../src/services/opentelemetry/consent.ts
|
|
151
|
+
import * as Data from "effect/Data";
|
|
151
152
|
import { SecureRandom } from "effect/crypto";
|
|
152
153
|
import { Effect, Option, Schema as Schema2 } from "effect";
|
|
153
154
|
|
|
@@ -203,6 +204,8 @@ var TelemetryEvent = Schema.Struct({
|
|
|
203
204
|
}).annotate({ identifier: "TelemetryEvent" });
|
|
204
205
|
|
|
205
206
|
// ../../src/services/opentelemetry/consent.ts
|
|
207
|
+
class AnalyticsPreferenceStorageError extends Data.TaggedError("AnalyticsPreferenceStorageError") {
|
|
208
|
+
}
|
|
206
209
|
var ANALYTICS_CONSENT_COOKIE = "krakstack_analytics_consent";
|
|
207
210
|
var ANALYTICS_NOTICE_VERSION = "1";
|
|
208
211
|
var changedEvent = "krakstack:analytics-consent";
|
|
@@ -213,7 +216,7 @@ var analyticsPreference = (cookie, now = Date.now()) => {
|
|
|
213
216
|
const value = readCookie(cookie);
|
|
214
217
|
if (!value)
|
|
215
218
|
return;
|
|
216
|
-
const decoded = Schema2.
|
|
219
|
+
const decoded = Schema2.decodeOption(codec)(value);
|
|
217
220
|
if (Option.isNone(decoded))
|
|
218
221
|
return;
|
|
219
222
|
const preference = decoded.value;
|
|
@@ -230,8 +233,10 @@ var browserPreference = () => {
|
|
|
230
233
|
return;
|
|
231
234
|
const cookie = Effect.runSync(Effect.try({
|
|
232
235
|
try: () => document.cookie,
|
|
233
|
-
catch: () => new
|
|
234
|
-
|
|
236
|
+
catch: () => new AnalyticsPreferenceStorageError({
|
|
237
|
+
message: "Analytics preference storage unavailable"
|
|
238
|
+
})
|
|
239
|
+
}).pipe(Effect.orElseSucceed(() => "")));
|
|
235
240
|
return analyticsPreference(cookie);
|
|
236
241
|
};
|
|
237
242
|
var consentGeneration = 0;
|
|
@@ -338,7 +343,7 @@ var TrackingNotice = ({
|
|
|
338
343
|
const result = Effect2.runSync(Effect2.try({
|
|
339
344
|
try: () => saveAnalyticsPreference(choice),
|
|
340
345
|
catch: () => new ConsentStorageError
|
|
341
|
-
}).pipe(Effect2.
|
|
346
|
+
}).pipe(Effect2.orElseSucceed(() => false)));
|
|
342
347
|
setFailed(!result);
|
|
343
348
|
if (result)
|
|
344
349
|
setOpen(false);
|
|
@@ -24,7 +24,9 @@ export interface EventsOptions {
|
|
|
24
24
|
}
|
|
25
25
|
declare const EventsConfigurationError_base: Schema.Class<EventsConfigurationError, Schema.TaggedStruct<"EventsConfigurationError", {
|
|
26
26
|
readonly message: Schema.String;
|
|
27
|
-
}>, Cause.YieldableError
|
|
27
|
+
}>, Cause.YieldableError & {
|
|
28
|
+
readonly brand: unique symbol;
|
|
29
|
+
}>;
|
|
28
30
|
export declare class EventsConfigurationError extends EventsConfigurationError_base {
|
|
29
31
|
}
|
|
30
32
|
export declare const dailyVisitorId: (input: {
|
|
@@ -29,7 +29,9 @@ import {
|
|
|
29
29
|
// ../../src/services/opentelemetry/processor.ts
|
|
30
30
|
import { Context, Schema } from "effect";
|
|
31
31
|
|
|
32
|
-
class OtlpProcessingError extends Schema.TaggedError()("OtlpProcessingError", {
|
|
32
|
+
class OtlpProcessingError extends Schema.TaggedError()("OtlpProcessingError", {
|
|
33
|
+
status: Schema.Literals([400, 403, 409, 413, 503])
|
|
34
|
+
}) {
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
class OtlpLogsProcessor extends Context.Service()("krakstack/opentelemetry/OtlpLogsProcessor") {
|
|
@@ -156,7 +158,7 @@ class OtlpEvents extends Context2.Service()("krakstack/opentelemetry/Events") {
|
|
|
156
158
|
}));
|
|
157
159
|
}
|
|
158
160
|
var event = Effect2.fnUntraced(function* (name, properties, options) {
|
|
159
|
-
const decoded = yield* Schema3.
|
|
161
|
+
const decoded = yield* Schema3.decodeEffect(TelemetryEvent)({
|
|
160
162
|
name,
|
|
161
163
|
properties,
|
|
162
164
|
options
|
|
@@ -218,7 +220,7 @@ var ServerEventsLive = Layer2.unwrap(Effect3.gen(function* () {
|
|
|
218
220
|
|
|
219
221
|
class Otlp extends Context3.Service()("krakstack/opentelemetry/Otlp") {
|
|
220
222
|
static event = event;
|
|
221
|
-
static layer = Layer2.mergeAll(Layer2.succeed(this, { resource: OtlpResource2.fromConfig() }), EffectOtlp.layerFromConfig(),
|
|
223
|
+
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));
|
|
222
224
|
}
|
|
223
225
|
|
|
224
226
|
// ../../src/services/events/request-context.ts
|
|
@@ -355,11 +357,11 @@ var ColumnFilters = Schema5.declare(Schema5.is(ColumnFiltersArray), {
|
|
|
355
357
|
toCodecStringTree: () => Schema5.link()(Schema5.fromJsonString(ColumnFiltersArray), SchemaTransformation.passthrough())
|
|
356
358
|
});
|
|
357
359
|
var Query = Schema5.Struct({
|
|
358
|
-
page: Schema5.optional(Schema5.Union([Schema5.
|
|
360
|
+
page: Schema5.optional(Schema5.Union([Schema5.Finite, Schema5.FiniteFromString]).check(Schema5.isInt(), Schema5.isGreaterThanOrEqualTo(0))).pipe(Schema5.decodeTo(Schema5.Int.check(Schema5.isGreaterThanOrEqualTo(0)), {
|
|
359
361
|
decode: SchemaGetter.withDefault(Effect4.succeed(0)),
|
|
360
362
|
encode: SchemaGetter.transformOptional(Option2.filter((page) => page !== 0))
|
|
361
363
|
})),
|
|
362
|
-
pageSize: Schema5.optional(Schema5.Union([Schema5.
|
|
364
|
+
pageSize: Schema5.optional(Schema5.Union([Schema5.Finite, Schema5.FiniteFromString]).check(Schema5.isInt(), Schema5.isBetween({ minimum: 1, maximum: 100 }))).pipe(Schema5.decodeTo(Schema5.Int.check(Schema5.isBetween({ minimum: 1, maximum: 100 })), {
|
|
363
365
|
decode: SchemaGetter.withDefault(Effect4.succeed(20)),
|
|
364
366
|
encode: SchemaGetter.transformOptional(Option2.filter((pageSize) => pageSize !== 20))
|
|
365
367
|
})),
|
|
@@ -403,7 +405,7 @@ var EventIdentity = Schema6.Struct({
|
|
|
403
405
|
userId: Schema6.optional(Schema6.NonEmptyString),
|
|
404
406
|
organizationId: Schema6.optional(Schema6.NonEmptyString)
|
|
405
407
|
}).annotate({ identifier: "EventIdentity" });
|
|
406
|
-
var EventIpAddress = Schema6.String.check(Schema6.makeFilter((value) => Option3.isSome(Schema6.
|
|
408
|
+
var EventIpAddress = Schema6.String.check(Schema6.makeFilter((value) => Option3.isSome(Schema6.decodeOption(Schema6.IpAddressFromString)(value)) || "Invalid IP address")).annotate({ identifier: "EventIpAddress" });
|
|
407
409
|
var EventCountry = Schema6.String.check(Schema6.isPattern(/^[A-Z]{2}$/), Schema6.makeFilter((value) => !["XX", "T1"].includes(value) || "Unknown country")).annotate({ identifier: "EventCountry" });
|
|
408
410
|
var EventRegion = Schema6.String.check(Schema6.isPattern(/^[A-Z0-9]{1,3}$/)).annotate({ identifier: "EventRegion" });
|
|
409
411
|
var EventCity = Schema6.NonEmptyString.check(Schema6.isMaxLength(128)).annotate({ identifier: "EventCity" });
|
|
@@ -665,8 +667,11 @@ var migrateEvents = Migrator.make({})({
|
|
|
665
667
|
});
|
|
666
668
|
|
|
667
669
|
// ../../src/services/opentelemetry/consent.ts
|
|
670
|
+
import * as Data from "effect/Data";
|
|
668
671
|
import { SecureRandom } from "effect/crypto";
|
|
669
672
|
import { Effect as Effect7, Option as Option5, Schema as Schema8 } from "effect";
|
|
673
|
+
class AnalyticsPreferenceStorageError extends Data.TaggedError("AnalyticsPreferenceStorageError") {
|
|
674
|
+
}
|
|
670
675
|
var ANALYTICS_CONSENT_COOKIE = "krakstack_analytics_consent";
|
|
671
676
|
var ANALYTICS_NOTICE_VERSION = "1";
|
|
672
677
|
var lifetime = 180 * 24 * 60 * 60 * 1000;
|
|
@@ -676,7 +681,7 @@ var analyticsPreference = (cookie, now = Date.now()) => {
|
|
|
676
681
|
const value = readCookie(cookie);
|
|
677
682
|
if (!value)
|
|
678
683
|
return;
|
|
679
|
-
const decoded = Schema8.
|
|
684
|
+
const decoded = Schema8.decodeOption(codec)(value);
|
|
680
685
|
if (Option5.isNone(decoded))
|
|
681
686
|
return;
|
|
682
687
|
const preference = decoded.value;
|
|
@@ -771,7 +776,7 @@ class Events extends Context4.Service()("krakstack/events/Events", {
|
|
|
771
776
|
const telemetry = yield* Otlp;
|
|
772
777
|
const exporter = yield* OtlpEvents;
|
|
773
778
|
const resource = options.serviceName ? yield* OtlpResource3.fromConfig({ serviceName: options.serviceName }) : yield* telemetry.resource;
|
|
774
|
-
const configuration = yield* Schema9.
|
|
779
|
+
const configuration = yield* Schema9.decodeEffect(Configuration)({
|
|
775
780
|
...options,
|
|
776
781
|
serviceName: OtlpResource3.serviceNameUnsafe(resource),
|
|
777
782
|
secret: Redacted.value(options.secret)
|
|
@@ -815,8 +820,8 @@ class Events extends Context4.Service()("krakstack/events/Events", {
|
|
|
815
820
|
const insertEvent = SqlSchema.findOneOption({
|
|
816
821
|
Request: StoredEventRequest,
|
|
817
822
|
Result: StoredEventId,
|
|
818
|
-
execute: (
|
|
819
|
-
INSERT INTO events ${sql.insert({ service_name: configuration.serviceName, ...
|
|
823
|
+
execute: (event2) => sql`
|
|
824
|
+
INSERT INTO events ${sql.insert({ service_name: configuration.serviceName, ...event2 })}
|
|
820
825
|
ON CONFLICT (service_name, source, event_id) DO NOTHING RETURNING event_id
|
|
821
826
|
`
|
|
822
827
|
});
|
|
@@ -856,7 +861,7 @@ class Events extends Context4.Service()("krakstack/events/Events", {
|
|
|
856
861
|
}) : undefined;
|
|
857
862
|
const resolveGeolocation = Effect8.fnUntraced(function* (request) {
|
|
858
863
|
const location2 = configuration.geolocation === "cloudflare" ? cloudflareGeolocation(request.headers) : configuration.geolocation ? yield* configuration.geolocation(request) : null;
|
|
859
|
-
return yield* Schema9.
|
|
864
|
+
return yield* Schema9.decodeEffect(Schema9.NullOr(EventGeolocation))(location2);
|
|
860
865
|
}, Effect8.mapError(() => new EventGeolocationError({})));
|
|
861
866
|
const resolveRequestContext = Effect8.fnUntraced(function* (request, now, location2) {
|
|
862
867
|
const userAgent = request.headers["user-agent"]?.slice(0, 2048) ?? "";
|
|
@@ -905,7 +910,7 @@ class Events extends Context4.Service()("krakstack/events/Events", {
|
|
|
905
910
|
error: EventSubscriberError,
|
|
906
911
|
idempotencyKey: ({ eventId }) => eventId
|
|
907
912
|
});
|
|
908
|
-
yield* engine.register(workflow, ({ event, eventId }) => Effect8.gen(function* () {
|
|
913
|
+
yield* engine.register(workflow, ({ event: event2, eventId }) => Effect8.gen(function* () {
|
|
909
914
|
const step = yield* Schedule.toStep(Schedule.min([
|
|
910
915
|
Schedule.exponential("5 seconds", 4),
|
|
911
916
|
Schedule.spaced("10 hours")
|
|
@@ -915,14 +920,14 @@ class Events extends Context4.Service()("krakstack/events/Events", {
|
|
|
915
920
|
name: `HandleEventV1-${attempt}`,
|
|
916
921
|
success: Schema9.Void,
|
|
917
922
|
error: EventSubscriberError,
|
|
918
|
-
execute: definition.handle({ ...
|
|
923
|
+
execute: definition.handle({ ...event2, eventId }).pipe(Effect8.scoped, Effect8.updateContext(() => subscriberContext), Effect8.asVoid, Effect8.mapError(() => new EventSubscriberError({
|
|
919
924
|
subscription: subscription.name
|
|
920
925
|
})))
|
|
921
926
|
}).pipe(Effect8.result);
|
|
922
927
|
if (Result.isSuccess(result))
|
|
923
928
|
return;
|
|
924
929
|
if (attempt >= 7)
|
|
925
|
-
return yield*
|
|
930
|
+
return yield* result.failure;
|
|
926
931
|
const now = yield* DateTime3.now;
|
|
927
932
|
const [, delay] = yield* step(DateTime3.toEpochMillis(now), result.failure).pipe(Effect8.orDie);
|
|
928
933
|
yield* DurableClock.sleep({
|
|
@@ -934,7 +939,7 @@ class Events extends Context4.Service()("krakstack/events/Events", {
|
|
|
934
939
|
}));
|
|
935
940
|
const registered = {
|
|
936
941
|
events: new Set(subscription.events),
|
|
937
|
-
dispatch: (
|
|
942
|
+
dispatch: (event2) => workflow.execute({ event: event2, eventId: event2.eventId }, { discard: true }).pipe(Effect8.provideService(WorkflowEngine.WorkflowEngine, engine), Effect8.catchCause((cause) => Cause.hasInterruptsOnly(cause) ? Effect8.interrupt : Effect8.fail(new EventsPersistenceError({
|
|
938
943
|
operation: "subscriber.dispatch"
|
|
939
944
|
}))), Effect8.asVoid)
|
|
940
945
|
};
|
|
@@ -943,16 +948,16 @@ class Events extends Context4.Service()("krakstack/events/Events", {
|
|
|
943
948
|
if (subscribers.get(subscription.name) === registered)
|
|
944
949
|
subscribers.delete(subscription.name);
|
|
945
950
|
}));
|
|
946
|
-
}, registration.withPermit);
|
|
951
|
+
}, registration.withPermit.bind(registration));
|
|
947
952
|
const track = Effect8.fn("Events.track")(function* (input) {
|
|
948
|
-
const decoded = yield* Schema9.
|
|
953
|
+
const decoded = yield* Schema9.decodeEffect(TrackEventInput)(input);
|
|
949
954
|
const properties = decoded.properties === undefined ? undefined : yield* Schema9.encodeEffect(Schema9.fromJsonString(EventInputProperties))(decoded.properties).pipe(Effect8.flatMap(Schema9.decodeUnknownEffect(Schema9.fromJsonString(EventPropertiesSchema))));
|
|
950
|
-
const
|
|
955
|
+
const event2 = yield* Schema9.decodeEffect(TrackEvent)({
|
|
951
956
|
...decoded,
|
|
952
957
|
properties
|
|
953
958
|
});
|
|
954
|
-
const eventId =
|
|
955
|
-
const category =
|
|
959
|
+
const eventId = event2.eventId ?? (yield* random.uuidV7());
|
|
960
|
+
const category = event2.category ?? "analytics";
|
|
956
961
|
const receivedAt = yield* DateTime3.now;
|
|
957
962
|
const now = DateTime3.toEpochMillis(receivedAt);
|
|
958
963
|
const request = yield* Effect8.serviceOption(HttpServerRequest.HttpServerRequest);
|
|
@@ -968,12 +973,12 @@ class Events extends Context4.Service()("krakstack/events/Events", {
|
|
|
968
973
|
const identity = hasIdentity ? yield* Schema9.decodeUnknownEffect(EventIdentity)({
|
|
969
974
|
userId: annotations["user.id"],
|
|
970
975
|
organizationId: annotations["organization.id"]
|
|
971
|
-
}) :
|
|
976
|
+
}) : event2.identity;
|
|
972
977
|
if (category === "audit") {
|
|
973
978
|
yield* Schema9.decodeUnknownEffect(AuditAttribution)(annotations);
|
|
974
979
|
}
|
|
975
980
|
const attributes = {};
|
|
976
|
-
for (const [key, value] of Object.entries(
|
|
981
|
+
for (const [key, value] of Object.entries(event2.properties ?? {})) {
|
|
977
982
|
const name = key.startsWith("app.") ? key : `app.${key}`;
|
|
978
983
|
if (!reservedBrowserAttribute(name))
|
|
979
984
|
attributes[name] = value;
|
|
@@ -981,10 +986,10 @@ class Events extends Context4.Service()("krakstack/events/Events", {
|
|
|
981
986
|
Object.assign(attributes, identityAttributes(identity));
|
|
982
987
|
Object.assign(attributes, Object.fromEntries(Object.entries(annotations).filter(([key]) => (category === "audit" || !["user.full_name", "user.name", "user.email"].includes(key)) && key !== "user.image" && key !== "app.user.image")));
|
|
983
988
|
attributes["log.record.uid"] = eventId;
|
|
984
|
-
if (
|
|
985
|
-
attributes["app.audit.target.id"] =
|
|
986
|
-
attributes["app.audit.target.name"] =
|
|
987
|
-
attributes["app.audit.target.type"] =
|
|
989
|
+
if (event2.category === "audit") {
|
|
990
|
+
attributes["app.audit.target.id"] = event2.target.id;
|
|
991
|
+
attributes["app.audit.target.name"] = event2.target.name;
|
|
992
|
+
attributes["app.audit.target.type"] = event2.target.type;
|
|
988
993
|
}
|
|
989
994
|
attributes["app.event.schema.version"] = "1";
|
|
990
995
|
attributes["app.event.type"] = "track";
|
|
@@ -993,8 +998,8 @@ class Events extends Context4.Service()("krakstack/events/Events", {
|
|
|
993
998
|
const span = yield* Effect8.currentSpan.pipe(Effect8.option);
|
|
994
999
|
const location2 = Option6.isSome(request) && (!options.requireConsent || hasAnalyticsConsent(request.value.headers.cookie ?? "", request.value.headers)) ? yield* resolveGeolocation(request.value).pipe(Effect8.mapError(() => new EventsPersistenceError({ operation: "geolocation" }))) : null;
|
|
995
1000
|
const entry = {
|
|
996
|
-
eventName:
|
|
997
|
-
timeUnixNano: (BigInt(
|
|
1001
|
+
eventName: event2.name,
|
|
1002
|
+
timeUnixNano: (BigInt(event2.timestamp ? DateTime3.toEpochMillis(event2.timestamp) : now) * 1000000n).toString(),
|
|
998
1003
|
observedTimeUnixNano: (BigInt(now) * 1000000n).toString()
|
|
999
1004
|
};
|
|
1000
1005
|
return yield* Effect8.gen(function* () {
|
|
@@ -1007,7 +1012,7 @@ class Events extends Context4.Service()("krakstack/events/Events", {
|
|
|
1007
1012
|
});
|
|
1008
1013
|
const result = storage ? yield* storage.persist({
|
|
1009
1014
|
source: "server",
|
|
1010
|
-
compareTimestamp:
|
|
1015
|
+
compareTimestamp: event2.timestamp !== undefined,
|
|
1011
1016
|
record: validated,
|
|
1012
1017
|
now,
|
|
1013
1018
|
payload: {
|
|
@@ -1025,34 +1030,34 @@ class Events extends Context4.Service()("krakstack/events/Events", {
|
|
|
1025
1030
|
}
|
|
1026
1031
|
}) : { eventId, inserted: false };
|
|
1027
1032
|
for (const subscriber of subscribers.values()) {
|
|
1028
|
-
if (!subscriber.events.has(
|
|
1033
|
+
if (!subscriber.events.has(event2.name))
|
|
1029
1034
|
continue;
|
|
1030
1035
|
yield* subscriber.dispatch({
|
|
1031
|
-
...
|
|
1036
|
+
...event2,
|
|
1032
1037
|
eventId,
|
|
1033
1038
|
identity,
|
|
1034
|
-
timestamp:
|
|
1039
|
+
timestamp: event2.timestamp ?? receivedAt
|
|
1035
1040
|
});
|
|
1036
1041
|
}
|
|
1037
1042
|
return {
|
|
1038
1043
|
...result,
|
|
1039
1044
|
attributes: { ...requestContext, ...attributes }
|
|
1040
1045
|
};
|
|
1041
|
-
}).pipe((effect) => storage ? storage.sql.withTransaction(effect) : effect, Effect8.tap((result) => !storage || result.inserted ? Otlp.event(
|
|
1046
|
+
}).pipe((effect) => storage ? storage.sql.withTransaction(effect) : effect, Effect8.tap((result) => !storage || result.inserted ? Otlp.event(event2.name, result.attributes, {
|
|
1042
1047
|
messageId: result.eventId,
|
|
1043
|
-
timestamp:
|
|
1048
|
+
timestamp: event2.timestamp ?? receivedAt
|
|
1044
1049
|
}).pipe(Effect8.provideService(OtlpEvents, {
|
|
1045
1050
|
push: (record) => exporter.push({
|
|
1046
1051
|
...record,
|
|
1047
1052
|
scopeName: "krakstack.application.events"
|
|
1048
1053
|
})
|
|
1049
|
-
}), Effect8.provideService(References2.CurrentLogAnnotations, {})) : Effect8.void), Effect8.map(({ eventId, inserted }) => ({ eventId, inserted })), Effect8.mapError((error) => error._tag === "EventConflictError" ? error : new EventsPersistenceError({
|
|
1054
|
+
}), Effect8.provideService(References2.CurrentLogAnnotations, {})) : Effect8.void), Effect8.map(({ eventId: eventId2, inserted }) => ({ eventId: eventId2, inserted })), Effect8.mapError((error) => error._tag === "EventConflictError" ? error : new EventsPersistenceError({
|
|
1050
1055
|
operation: "track"
|
|
1051
1056
|
})));
|
|
1052
1057
|
});
|
|
1053
1058
|
const list = Effect8.fn("Events.list")(function* (input) {
|
|
1054
|
-
const request = yield* Schema9.
|
|
1055
|
-
const columnFilters = yield* Schema9.
|
|
1059
|
+
const request = yield* Schema9.decodeEffect(ListEvents)(input);
|
|
1060
|
+
const columnFilters = yield* Schema9.decodeEffect(Schema9.Array(EventColumnFilter))(request.filters ?? []);
|
|
1056
1061
|
if (!storage)
|
|
1057
1062
|
return yield* new EventsPersistenceError({
|
|
1058
1063
|
operation: "persistence-disabled"
|
|
@@ -1080,29 +1085,29 @@ class Events extends Context4.Service()("krakstack/events/Events", {
|
|
|
1080
1085
|
return sql`${sortColumns[id]} ${sql.literal(part.direction === "desc" ? "DESC" : "ASC")}`;
|
|
1081
1086
|
}));
|
|
1082
1087
|
const source = request.category === "audit" ? sql`AND source = 'server'` : sql``;
|
|
1083
|
-
const
|
|
1088
|
+
const event2 = request.eventName ? sql`AND event_name = ${request.eventName}` : sql``;
|
|
1084
1089
|
const actorName = sql`COALESCE(NULLIF(${text("user.full_name")}, ''), NULLIF(${text("user.name")}, ''), NULLIF(${text("user.email")}, ''), ${text("app.actor.type")}, '')`;
|
|
1085
1090
|
const actor = sql`${actorName} || ' ' || COALESCE(${text("user.email")}, '') || ' ' || COALESCE(${text("app.actor.id")}, ${text("user.id")}, '')`;
|
|
1086
1091
|
const record = sql`COALESCE(${text("app.audit.target.name")}, '') || ' ' || COALESCE(${text("app.audit.target.type")}, '') || ' ' || COALESCE(${text("app.audit.target.id")}, '')`;
|
|
1087
1092
|
const method = sql`CASE WHEN ${text("app.auth.method")} IN ('session', 'api_key') THEN ${text("app.auth.method")} ELSE 'unknown' END`;
|
|
1088
|
-
const predicates = columnFilters.map((
|
|
1089
|
-
switch (
|
|
1093
|
+
const predicates = columnFilters.map((filter2) => {
|
|
1094
|
+
switch (filter2.kind) {
|
|
1090
1095
|
case "values": {
|
|
1091
|
-
const column =
|
|
1092
|
-
return sql`AND ${sql.or(
|
|
1096
|
+
const column = filter2.id === "eventName" ? sql`event_name` : method;
|
|
1097
|
+
return sql`AND ${sql.or(filter2.values.map((value) => sql`${column} = ${value}`))}`;
|
|
1093
1098
|
}
|
|
1094
1099
|
case "date": {
|
|
1095
|
-
const from =
|
|
1096
|
-
const to =
|
|
1100
|
+
const from = filter2.from ? sql`AND occurred_at >= ${new Date(`${filter2.from}T00:00:00.000Z`).getTime()}` : sql``;
|
|
1101
|
+
const to = filter2.to ? sql`AND occurred_at < ${new Date(`${filter2.to}T00:00:00.000Z`).getTime() + 86400000}` : sql``;
|
|
1097
1102
|
return sql`${from} ${to}`;
|
|
1098
1103
|
}
|
|
1099
1104
|
case "text": {
|
|
1100
|
-
const column =
|
|
1101
|
-
const value =
|
|
1102
|
-
if (
|
|
1105
|
+
const column = filter2.id === "actor" ? actor : record;
|
|
1106
|
+
const value = filter2.value.toLowerCase();
|
|
1107
|
+
if (filter2.operator === "equals")
|
|
1103
1108
|
return sql`AND LOWER(${column}) = ${value}`;
|
|
1104
1109
|
const escaped = value.replace(/[\\%_]/g, "\\$&");
|
|
1105
|
-
const pattern =
|
|
1110
|
+
const pattern = filter2.operator === "startsWith" ? `${escaped}%` : filter2.operator === "endsWith" ? `%${escaped}` : `%${escaped}%`;
|
|
1106
1111
|
return sql`AND LOWER(${column}) LIKE ${pattern} ESCAPE ${"\\"}`;
|
|
1107
1112
|
}
|
|
1108
1113
|
default:
|
|
@@ -1123,7 +1128,7 @@ class Events extends Context4.Service()("krakstack/events/Events", {
|
|
|
1123
1128
|
].map((key) => sql`LOWER(${text(key)}) LIKE ${`%${search.toLowerCase()}%`}`)
|
|
1124
1129
|
])}` : sql``;
|
|
1125
1130
|
const predicate = sql`service_name = ${configuration.serviceName} AND organization_id = ${request.organizationId}
|
|
1126
|
-
AND ${text("app.event.category")} = ${request.category} ${source} ${
|
|
1131
|
+
AND ${text("app.event.category")} = ${request.category} ${source} ${event2} ${actions} ${filter}`;
|
|
1127
1132
|
const total = yield* SqlSchema.findOne({
|
|
1128
1133
|
Request: ListEvents,
|
|
1129
1134
|
Result: AuditCount,
|
|
@@ -1140,7 +1145,7 @@ class Events extends Context4.Service()("krakstack/events/Events", {
|
|
|
1140
1145
|
`
|
|
1141
1146
|
});
|
|
1142
1147
|
const rows = yield* find(request);
|
|
1143
|
-
const data = yield* Effect8.forEach(rows, (row) => Schema9.decodeUnknownEffect(EventLogRecord)(row.payload_json.resourceLogs.flatMap((
|
|
1148
|
+
const data = yield* Effect8.forEach(rows, (row) => Schema9.decodeUnknownEffect(EventLogRecord)(row.payload_json.resourceLogs.flatMap((resource2) => resource2.scopeLogs.flatMap((scope) => scope.logRecords))[0]));
|
|
1144
1149
|
return {
|
|
1145
1150
|
data,
|
|
1146
1151
|
meta: {
|
|
@@ -1153,13 +1158,13 @@ class Events extends Context4.Service()("krakstack/events/Events", {
|
|
|
1153
1158
|
});
|
|
1154
1159
|
const process = Effect8.fnUntraced(function* (body) {
|
|
1155
1160
|
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
1156
|
-
let payload = yield* Schema9.
|
|
1161
|
+
let payload = yield* Schema9.decodeEffect(codec2)(new TextDecoder().decode(body)).pipe(Effect8.mapError(() => new OtlpProcessingError({ status: 400 })));
|
|
1157
1162
|
if (options.requireConsent && !hasAnalyticsConsent(request.headers.cookie ?? "", request.headers)) {
|
|
1158
1163
|
payload = {
|
|
1159
1164
|
...payload,
|
|
1160
|
-
resourceLogs: payload.resourceLogs.map((
|
|
1161
|
-
...
|
|
1162
|
-
scopeLogs:
|
|
1165
|
+
resourceLogs: payload.resourceLogs.map((resource2) => ({
|
|
1166
|
+
...resource2,
|
|
1167
|
+
scopeLogs: resource2.scopeLogs.filter((scope) => scope.scope?.name !== "krakstack.application.events").map((scope) => ({
|
|
1163
1168
|
...scope,
|
|
1164
1169
|
logRecords: scope.logRecords.filter((record) => {
|
|
1165
1170
|
const parsed = Schema9.decodeUnknownOption(Schema9.Struct({
|
|
@@ -1175,7 +1180,7 @@ class Events extends Context4.Service()("krakstack/events/Events", {
|
|
|
1175
1180
|
persisted: false
|
|
1176
1181
|
};
|
|
1177
1182
|
}
|
|
1178
|
-
const analyticsScopes = payload.resourceLogs.flatMap((
|
|
1183
|
+
const analyticsScopes = payload.resourceLogs.flatMap((resource2) => resource2.scopeLogs).filter((scope) => scope.scope?.name === "krakstack.application.events");
|
|
1179
1184
|
if (analyticsScopes.length === 0)
|
|
1180
1185
|
return { body, persisted: false };
|
|
1181
1186
|
if (request.headers.origin !== configuration.origin.origin || request.headers["sec-fetch-site"] === "cross-site") {
|
|
@@ -1210,9 +1215,9 @@ class Events extends Context4.Service()("krakstack/events/Events", {
|
|
|
1210
1215
|
const ingest = Effect8.gen(function* () {
|
|
1211
1216
|
const requestContext = yield* resolveRequestContext(request, now, location2);
|
|
1212
1217
|
let index = 0;
|
|
1213
|
-
const resourceLogs = payload.resourceLogs.map((
|
|
1214
|
-
...
|
|
1215
|
-
scopeLogs:
|
|
1218
|
+
const resourceLogs = payload.resourceLogs.map((resource2) => ({
|
|
1219
|
+
...resource2,
|
|
1220
|
+
scopeLogs: resource2.scopeLogs.map((scope) => scope.scope?.name !== "krakstack.application.events" ? scope : {
|
|
1216
1221
|
...scope,
|
|
1217
1222
|
logRecords: scope.logRecords.map(() => {
|
|
1218
1223
|
const record = records[index++];
|
|
@@ -1241,13 +1246,13 @@ class Events extends Context4.Service()("krakstack/events/Events", {
|
|
|
1241
1246
|
}));
|
|
1242
1247
|
const persistedRecords = new Map;
|
|
1243
1248
|
if (storage) {
|
|
1244
|
-
for (const
|
|
1245
|
-
for (const scope of
|
|
1249
|
+
for (const resource2 of resourceLogs) {
|
|
1250
|
+
for (const scope of resource2.scopeLogs) {
|
|
1246
1251
|
if (scope.scope?.name !== "krakstack.application.events")
|
|
1247
1252
|
continue;
|
|
1248
1253
|
for (const raw of scope.logRecords) {
|
|
1249
1254
|
const record = yield* Schema9.decodeUnknownEffect(EventLogRecord)(raw);
|
|
1250
|
-
const
|
|
1255
|
+
const persisted2 = yield* storage.persist({
|
|
1251
1256
|
source: "browser",
|
|
1252
1257
|
record,
|
|
1253
1258
|
now: nowMillis,
|
|
@@ -1255,28 +1260,28 @@ class Events extends Context4.Service()("krakstack/events/Events", {
|
|
|
1255
1260
|
...payload,
|
|
1256
1261
|
resourceLogs: [
|
|
1257
1262
|
{
|
|
1258
|
-
...
|
|
1263
|
+
...resource2,
|
|
1259
1264
|
scopeLogs: [{ ...scope, logRecords: [record] }]
|
|
1260
1265
|
}
|
|
1261
1266
|
]
|
|
1262
1267
|
}
|
|
1263
1268
|
});
|
|
1264
|
-
persistedRecords.set(raw,
|
|
1269
|
+
persistedRecords.set(raw, persisted2.record);
|
|
1265
1270
|
}
|
|
1266
1271
|
}
|
|
1267
1272
|
}
|
|
1268
1273
|
}
|
|
1269
1274
|
const encoded = yield* Schema9.encodeEffect(codec2)({
|
|
1270
1275
|
...payload,
|
|
1271
|
-
resourceLogs: resourceLogs.map((
|
|
1272
|
-
...
|
|
1273
|
-
scopeLogs:
|
|
1276
|
+
resourceLogs: resourceLogs.map((resource2) => ({
|
|
1277
|
+
...resource2,
|
|
1278
|
+
scopeLogs: resource2.scopeLogs.map((scope) => ({
|
|
1274
1279
|
...scope,
|
|
1275
1280
|
logRecords: scope.logRecords.map((raw) => persistedRecords.get(raw) ?? raw)
|
|
1276
1281
|
}))
|
|
1277
1282
|
}))
|
|
1278
1283
|
});
|
|
1279
|
-
const persisted = Boolean(storage) && payload.resourceLogs.every((
|
|
1284
|
+
const persisted = Boolean(storage) && payload.resourceLogs.every((resource2) => resource2.scopeLogs.every((scope) => scope.scope?.name === "krakstack.application.events" || scope.logRecords.length === 0));
|
|
1280
1285
|
return { body: new TextEncoder().encode(encoded), persisted };
|
|
1281
1286
|
});
|
|
1282
1287
|
return yield* (storage ? ingest.pipe(storage.sql.withTransaction) : ingest).pipe(Effect8.mapError((error) => new OtlpProcessingError({
|
|
@@ -1312,12 +1317,12 @@ class Events extends Context4.Service()("krakstack/events/Events", {
|
|
|
1312
1317
|
static subscribe = (definition) => Layer3.effectDiscard(Effect8.flatMap(Events, (events) => events.subscribe(definition)));
|
|
1313
1318
|
}
|
|
1314
1319
|
export {
|
|
1315
|
-
|
|
1316
|
-
EventLogRecord,
|
|
1317
|
-
Events,
|
|
1318
|
-
EventsConfigurationError,
|
|
1319
|
-
ListEvents,
|
|
1320
|
-
SESSION_TIMEOUT_MS,
|
|
1320
|
+
dailyVisitorId,
|
|
1321
1321
|
TrackEvent,
|
|
1322
|
-
|
|
1322
|
+
SESSION_TIMEOUT_MS,
|
|
1323
|
+
ListEvents,
|
|
1324
|
+
EventsConfigurationError,
|
|
1325
|
+
Events,
|
|
1326
|
+
EventLogRecord,
|
|
1327
|
+
AuditTarget
|
|
1323
1328
|
};
|
|
@@ -9,6 +9,6 @@ var TextArrayValue = Schema.Struct({
|
|
|
9
9
|
var eventTextAttribute = (record, key) => Schema.decodeUnknownOption(TextValue)(record.attributes.find((attribute) => attribute.key === key)?.value).pipe(Option.map((value) => value.stringValue), Option.getOrNull);
|
|
10
10
|
var eventStringArrayAttribute = (record, key) => Schema.decodeUnknownOption(TextArrayValue)(record.attributes.find((attribute) => attribute.key === key)?.value).pipe(Option.map((value) => value.arrayValue.values.map((item) => item.stringValue)), Option.getOrElse(() => []));
|
|
11
11
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
eventTextAttribute,
|
|
13
|
+
eventStringArrayAttribute
|
|
14
14
|
};
|
|
@@ -18,7 +18,9 @@ export declare const EventGeolocation: Schema.Struct<{
|
|
|
18
18
|
readonly city: Schema.optional<Schema.NonEmptyString>;
|
|
19
19
|
}>;
|
|
20
20
|
export type EventGeolocation = typeof EventGeolocation.Type;
|
|
21
|
-
declare const EventGeolocationError_base: Schema.Class<EventGeolocationError, Schema.TaggedStruct<"EventGeolocationError", {}>, import("effect/Cause").YieldableError
|
|
21
|
+
declare const EventGeolocationError_base: Schema.Class<EventGeolocationError, Schema.TaggedStruct<"EventGeolocationError", {}>, import("effect/Cause").YieldableError & {
|
|
22
|
+
readonly brand: unique symbol;
|
|
23
|
+
}>;
|
|
22
24
|
export declare class EventGeolocationError extends EventGeolocationError_base {
|
|
23
25
|
}
|
|
24
26
|
export declare const BrowserEventOptions: Schema.Struct<{
|
|
@@ -114,7 +116,9 @@ export interface EventSubscriber<E = never, R = never> {
|
|
|
114
116
|
}
|
|
115
117
|
declare const EventSubscriberError_base: Schema.Class<EventSubscriberError, Schema.TaggedStruct<"EventSubscriberError", {
|
|
116
118
|
readonly subscription: Schema.String;
|
|
117
|
-
}>, import("effect/Cause").YieldableError
|
|
119
|
+
}>, import("effect/Cause").YieldableError & {
|
|
120
|
+
readonly brand: unique symbol;
|
|
121
|
+
}>;
|
|
118
122
|
export declare class EventSubscriberError extends EventSubscriberError_base {
|
|
119
123
|
}
|
|
120
124
|
export declare const EventActionFilter: Schema.Struct<{
|
|
@@ -147,8 +151,8 @@ export declare const EventColumnFilter: Schema.Union<readonly [Schema.Struct<{
|
|
|
147
151
|
readonly values: Schema.NonEmptyArray<Schema.String>;
|
|
148
152
|
}>]>;
|
|
149
153
|
export declare const EventQuery: Schema.Struct<{
|
|
150
|
-
readonly page: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.
|
|
151
|
-
readonly pageSize: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.
|
|
154
|
+
readonly page: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Finite, Schema.FiniteFromString]>>, never, never>;
|
|
155
|
+
readonly pageSize: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Finite, Schema.FiniteFromString]>>, never, never>;
|
|
152
156
|
readonly globalFilter: Schema.optional<Schema.String>;
|
|
153
157
|
readonly sort: Schema.optional<Schema.declare<readonly {
|
|
154
158
|
readonly id: string;
|
|
@@ -275,8 +279,8 @@ export declare const EventQueryStandard: import("effect/StandardSchema").Standar
|
|
|
275
279
|
})[] | undefined;
|
|
276
280
|
readonly eventName?: string | undefined;
|
|
277
281
|
}> & Schema.Struct<{
|
|
278
|
-
readonly page: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.
|
|
279
|
-
readonly pageSize: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.
|
|
282
|
+
readonly page: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Finite, Schema.FiniteFromString]>>, never, never>;
|
|
283
|
+
readonly pageSize: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Finite, Schema.FiniteFromString]>>, never, never>;
|
|
280
284
|
readonly globalFilter: Schema.optional<Schema.String>;
|
|
281
285
|
readonly sort: Schema.optional<Schema.declare<readonly {
|
|
282
286
|
readonly id: string;
|
|
@@ -336,8 +340,8 @@ export declare const EventQueryStandard: import("effect/StandardSchema").Standar
|
|
|
336
340
|
readonly eventName: Schema.optional<Schema.NonEmptyString>;
|
|
337
341
|
}>;
|
|
338
342
|
export declare const ListEvents: Schema.Struct<{
|
|
339
|
-
readonly page: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.
|
|
340
|
-
readonly pageSize: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.
|
|
343
|
+
readonly page: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Finite, Schema.FiniteFromString]>>, never, never>;
|
|
344
|
+
readonly pageSize: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Finite, Schema.FiniteFromString]>>, never, never>;
|
|
341
345
|
readonly globalFilter: Schema.optional<Schema.String>;
|
|
342
346
|
readonly sort: Schema.optional<Schema.declare<readonly {
|
|
343
347
|
readonly id: string;
|
|
@@ -419,12 +423,16 @@ export declare const RequestActorAttribution: Schema.Struct<{
|
|
|
419
423
|
}>;
|
|
420
424
|
declare const EventsPersistenceError_base: Schema.Class<EventsPersistenceError, Schema.TaggedStruct<"EventsPersistenceError", {
|
|
421
425
|
readonly operation: Schema.String;
|
|
422
|
-
}>, import("effect/Cause").YieldableError
|
|
426
|
+
}>, import("effect/Cause").YieldableError & {
|
|
427
|
+
readonly brand: unique symbol;
|
|
428
|
+
}>;
|
|
423
429
|
export declare class EventsPersistenceError extends EventsPersistenceError_base {
|
|
424
430
|
}
|
|
425
431
|
declare const EventConflictError_base: Schema.Class<EventConflictError, Schema.TaggedStruct<"EventConflictError", {
|
|
426
432
|
readonly eventId: Schema.NonEmptyString;
|
|
427
|
-
}>, import("effect/Cause").YieldableError
|
|
433
|
+
}>, import("effect/Cause").YieldableError & {
|
|
434
|
+
readonly brand: unique symbol;
|
|
435
|
+
}>;
|
|
428
436
|
export declare class EventConflictError extends EventConflictError_base {
|
|
429
437
|
}
|
|
430
438
|
export declare const EventSource: Schema.Literals<readonly ["browser", "server"]>;
|