@shivaedev/server 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +4 -1
- package/dist/adapters/boundedOtlpResponse.d.ts +4 -0
- package/dist/adapters/boundedOtlpResponse.d.ts.map +1 -0
- package/dist/adapters/boundedOtlpResponse.js +19 -0
- package/dist/adapters/boundedOtlpResponse.js.map +1 -0
- package/dist/appDatabase.d.ts +1 -1
- package/dist/appDatabase.d.ts.map +1 -1
- package/dist/appDatabase.js +4 -3
- package/dist/appDatabase.js.map +1 -1
- package/dist/appHostHttp.d.ts +2 -2
- package/dist/appHostHttp.d.ts.map +1 -1
- package/dist/appHostHttp.js +1 -1
- package/dist/appHostHttp.js.map +1 -1
- package/dist/browserErrorRoute.d.ts +6 -1
- package/dist/browserErrorRoute.d.ts.map +1 -1
- package/dist/browserErrorRoute.js +38 -8
- package/dist/browserErrorRoute.js.map +1 -1
- package/dist/hostOptions.d.ts +2 -0
- package/dist/hostOptions.d.ts.map +1 -1
- package/dist/otlpHttpClient.d.ts.map +1 -1
- package/dist/otlpHttpClient.js +2 -1
- package/dist/otlpHttpClient.js.map +1 -1
- package/dist/otlpTracing.d.ts.map +1 -1
- package/dist/otlpTracing.js +7 -4
- package/dist/otlpTracing.js.map +1 -1
- package/package.json +15 -15
- package/src/adapters/boundedOtlpResponse.ts +27 -0
- package/src/appDatabase.ts +4 -3
- package/src/appHostHttp.ts +7 -1
- package/src/browserErrorRoute.ts +51 -8
- package/src/hostOptions.ts +2 -0
- package/src/otlpHttpClient.ts +2 -1
- package/src/otlpTracing.ts +12 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.18.0 - 2026-11-02
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Add `redactBrowserText` to mask quoted browser literals, including escaped quotes and multiline content, while preserving diagnostic shape and the existing server text policy.
|
|
8
|
+
- Add opt-in `browserErrors` settings for an Error log per report, signed-in `user.id` attribution and session enforcement. The starter enables all three.
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Mask browser report messages and stacks before they reach diagnostic sinks and record reports at Error severity.
|
|
13
|
+
- Install PostgreSQL change hooks before preparing hosted migrations so committed repository writes refresh subscribers in other processes exactly once.
|
|
14
|
+
- Limit OTLP collector response bodies to 64 KiB, cancelling oversized responses with a typed HTTP decode error while preserving bounded, redacted failure diagnostics.
|
|
15
|
+
- Fail host startup with a typed configuration error for malformed or non-HTTP(S) OTLP endpoints instead of disabling export or falling back from an invalid traces endpoint.
|
|
16
|
+
- Fail the scope coordinating a worker release with the original cause when heartbeat or ownership polling retries are exhausted, and stop registered jobs workers before removing the release lease. Application-host workers can no longer keep fetching after their release coordinator fails.
|
|
17
|
+
|
|
3
18
|
## 0.17.0 - 2026-11-01
|
|
4
19
|
|
|
5
20
|
### Added
|
package/README.md
CHANGED
|
@@ -168,7 +168,10 @@ Timeouts fail through the HTTP client's typed transport-error channel and use th
|
|
|
168
168
|
|
|
169
169
|
For existing Railway services, enable manual tracing per service and environment, then redeploy. The starter does this through `tracing: { enabled: true, autoInstrumentation: false }` in its infrastructure configuration (Railway CLI 5.63.0 or newer). Railway documents that it injects the `OTEL_*` variables, including `OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf`, only when the app sets no endpoint of its own. The framework exports through Effect's own `effect/observability` OTLP tracer; eBPF auto-instrumentation is outside this path. For a worker, provide `otlpTracing` from `@shivaedev/server/otlpTracing.ts` to its application Layer. Railway accepts traces only: logs become `effect.log` spans with a `log` event, and Effect `ErrorReporter` reports become failed `effect.error` spans with exception events. Both use the same exporter and redaction as application spans; no OTLP logs endpoint is used. Exported diagnostic annotations mask the entire `rpc.payload`, since a request value can repeat a sensitive error field under a public payload key. The exporter batches ended Effect spans and flushes during scoped shutdown with a three-second bound by default. The first failed export logs a warning with the collector status and redacted response body, or the transport failure kind when no response arrives. Repeated failures stay quiet until a successful export. Collector connection failures and HTTP errors leave requests, jobs and shutdown successful.
|
|
170
170
|
|
|
171
|
-
`appHost` mounts `POST /_platform/errors`. Mount `useBrowserErrors` from `@shivaedev/react/client/adapters/useBrowserErrors.ts` once in the root component to forward uncaught browser errors and unhandled rejections, including before sign-in. The route accepts `{ kind: "error" | "unhandledrejection", message, stack?, url }`, returns 202, and reports through the
|
|
171
|
+
`appHost` mounts `POST /_platform/errors`. Mount `useBrowserErrors` from `@shivaedev/react/client/adapters/useBrowserErrors.ts` once in the root component to forward uncaught browser errors and unhandled rejections, including before sign-in. The route accepts `{ kind: "error" | "unhandledrejection", message, stack?, url }`, returns 202, and reports through the server redaction and `ErrorReporter` pipeline at Error severity. Quoted literals in browser messages and stacks are masked before reporting; diagnostic text and stack frames remain readable. It accepts at most 20 reports per minute per client IP per process, returning 429 afterwards. Railway's `x-real-ip` is used only from a configured trusted proxy; otherwise the socket peer identifies the client. Foreign origins return 403. Invalid JSON or reports over 16 KiB return 400. Limits reset with the process and are independent across replicas.
|
|
172
|
+
|
|
173
|
+
Set `browserErrors: { log: true, includeUserId: true, requireSession: true }` on `appHost` for the recommended signed-in application setting. `log` writes one Error log with the masked message and stack per accepted report, including when OTLP export is off. `includeUserId` resolves the session and adds `user.id` to the HTTP span and error report when signed in. `requireSession` rejects signed-out reports with 401; a session-provider outage returns 503. Session lookups use the host's session and origin policy. With no session policy, requiring a session rejects reports. All three options default to false, preserving reports before sign-in without session lookups or an extra log line. `browserErrorRoute(trustedProxy?, options?)` accepts the same options when composed directly.
|
|
174
|
+
|
|
172
175
|
|
|
173
176
|
For local traces, run an OpenTelemetry Collector on loopback with an OTLP HTTP receiver and its `debug` exporter. Set `OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318` for the app and worker; the collector's console shows the redacted spans, diagnostic events and reported errors. A minimal collector configuration is:
|
|
174
177
|
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { HttpClientError, HttpClientResponse } from "effect/http";
|
|
3
|
+
export declare const boundedOtlpResponse: (response: HttpClientResponse.HttpClientResponse) => Effect.Effect<HttpClientResponse.HttpClientResponse, HttpClientError.HttpClientError, never>;
|
|
4
|
+
//# sourceMappingURL=boundedOtlpResponse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boundedOtlpResponse.d.ts","sourceRoot":"","sources":["../../src/adapters/boundedOtlpResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAKlE,eAAO,MAAM,mBAAmB,mJAoB9B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { HttpClientError, HttpClientResponse } from "effect/http";
|
|
3
|
+
import { readBoundedBody } from "@shivaedev/http/body.ts";
|
|
4
|
+
const responseLimit = 64 * 1024;
|
|
5
|
+
export const boundedOtlpResponse = Effect.fnUntraced(function* (response) {
|
|
6
|
+
const bytes = yield* readBoundedBody(response, responseLimit).pipe(Effect.mapError((error) => HttpClientError.isHttpClientError(error)
|
|
7
|
+
? error
|
|
8
|
+
: new HttpClientError.HttpClientError({
|
|
9
|
+
reason: new HttpClientError.DecodeError({
|
|
10
|
+
description: `OTLP collector response exceeds ${responseLimit} bytes`,
|
|
11
|
+
request: response.request,
|
|
12
|
+
response,
|
|
13
|
+
}),
|
|
14
|
+
})));
|
|
15
|
+
const buffered = HttpClientResponse.fromWeb(response.request, new Response(bytes.byteLength === 0 ? null : bytes, { headers: response.headers, status: response.status }));
|
|
16
|
+
yield* buffered.arrayBuffer;
|
|
17
|
+
return buffered;
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=boundedOtlpResponse.js.map
|
|
@@ -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AC"}
|
package/dist/appDatabase.d.ts
CHANGED
|
@@ -11,5 +11,5 @@ export interface DatabaseConfig extends PostgresOptions {
|
|
|
11
11
|
readonly databaseUrl?: Redacted.Redacted<string>;
|
|
12
12
|
readonly listenDatabaseUrl?: Redacted.Redacted<string>;
|
|
13
13
|
}
|
|
14
|
-
export declare function appDatabase<R, E = never>(options: AppDatabaseOptions<R, E>): Layer.Layer<"@shivaedev/contract/LiveServer" | PgClient.PgClient | import("@effect/sql-pg/PgPool").PgPool | Reactivity.Reactivity | import("effect/sql/SqlClient").SqlClient, E | Config.ConfigError | Migrator.MigrationError | import("@shivaedev/sql/PostgresListenerError.ts").PostgresListenerError | import("effect/Schema").SchemaError | import("effect/sql/SqlError").SqlError, Exclude<Exclude<R, import("effect/Scope").Scope>, PgClient.PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/sql/SqlClient").SqlClient>>;
|
|
14
|
+
export declare function appDatabase<R, E = never>(options: AppDatabaseOptions<R, E>): Layer.Layer<"@shivaedev/contract/LiveServer" | PgClient.PgClient | import("@effect/sql-pg/PgPool").PgPool | Reactivity.Reactivity | import("effect/sql/SqlClient").SqlClient, E | Config.ConfigError | Migrator.MigrationError | import("@shivaedev/sql/PostgresListenerError.ts").PostgresListenerError | import("effect/Schema").SchemaError | import("effect/sql/SqlError").SqlError, Exclude<Exclude<R, import("effect/Scope").Scope>, "@shivaedev/contract/LiveServer" | PgClient.PgClient | import("@effect/sql-pg/PgPool").PgPool | Reactivity.Reactivity | import("effect/sql/SqlClient").SqlClient>>;
|
|
15
15
|
//# sourceMappingURL=appDatabase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appDatabase.d.ts","sourceRoot":"","sources":["../src/appDatabase.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAoC,KAAK,EAAU,QAAQ,EAAY,MAAM,QAAQ,CAAC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CAAiC,CAAC;AAEtF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,WAAW,cAAe,SAAQ,eAAe;IACtD,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,QAAQ,GAAG,gBAAgB,GAAG,mBAAmB,GAAG,eAAe,GAAG,QAAQ,CAAC,CAAC,CAAC;IACzI,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;CACvD;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,ilBAoD1E"}
|
package/dist/appDatabase.js
CHANGED
|
@@ -19,15 +19,14 @@ export function appDatabase(options) {
|
|
|
19
19
|
};
|
|
20
20
|
const clock = Layer.succeed(Clock.Clock, config.clock ?? Clock.Clock.defaultValue());
|
|
21
21
|
const pool = Layer.unwrap(Effect.map(options.config?.databaseUrl === undefined ? Config.Redacted("DATABASE_URL") : Effect.succeed(options.config.databaseUrl), (url) => postgresLayer(url, config).pipe(Layer.provide(clock))));
|
|
22
|
-
const prepared = Layer.effectDiscard(prepareMigrations(options.migrations)).pipe(Layer.provideMerge(pool));
|
|
23
22
|
const live = LiveServer.layer.pipe(Layer.provideMerge(Reactivity.layer));
|
|
24
23
|
const migrations = options.migrations;
|
|
25
24
|
const worker = migrations.mode === "wait" && migrations.release !== undefined
|
|
26
25
|
? Layer.effect(WorkerRelease, coordinateWorkerRelease(migrations.release, migrations.pollInterval, migrations.table))
|
|
27
26
|
: Layer.empty;
|
|
28
|
-
const base = Layer.merge(
|
|
27
|
+
const base = Layer.merge(pool, live);
|
|
29
28
|
const changes = options.config?.changes;
|
|
30
|
-
|
|
29
|
+
const connected = Layer.unwrap(Effect.gen(function* () {
|
|
31
30
|
const client = yield* PgClient.PgClient;
|
|
32
31
|
const hints = yield* LiveServer;
|
|
33
32
|
const url = options.config?.databaseUrl ?? (yield* Config.Redacted("DATABASE_URL"));
|
|
@@ -51,6 +50,8 @@ export function appDatabase(options) {
|
|
|
51
50
|
resync: hints.resync(),
|
|
52
51
|
}).pipe(Layer.provide(clock));
|
|
53
52
|
})).pipe(Layer.provideMerge(base));
|
|
53
|
+
const prepared = Layer.effectDiscard(prepareMigrations(migrations)).pipe(Layer.provideMerge(connected));
|
|
54
|
+
return worker.pipe(Layer.provideMerge(prepared));
|
|
54
55
|
}
|
|
55
56
|
function prepareMigrations(migrations) {
|
|
56
57
|
switch (migrations.mode) {
|
package/dist/appDatabase.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appDatabase.js","sourceRoot":"","sources":["../src/appDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC5G,OAAO,KAAK,UAAU,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAC9G,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,C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YAAY,IAAI,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,IAAI,WAAW,CAAC,CAAC,CAAC;YACxI,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,YAAY,QAAQ,CAAC,cAAc,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU;SACvF,CAAC,EACF,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CACzB,KAAK,YAAY,QAAQ,CAAC,cAAc,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CACtI,CACD,CAAC;QACF,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC5B,KAAK,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YACjC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC;QACtD,CAAC;IACF,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC"}
|
package/dist/appHostHttp.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export declare function appHostHttp<TRpcs extends Rpc.Any, THandlers, THandlerEr
|
|
|
38
38
|
}>>>, import("effect/rpc/RpcSerialization").RpcSerialization>, never>, never>>, HttpRouter.HttpRouter>, import("effect/Scope").Scope>, TServices>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>>;
|
|
39
39
|
export declare function migratedHost<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TRouteError = never, TRouteRequirements = HostRouteRequirements, TMigrationError = never>(options: HostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TRouteError, TRouteRequirements> & HostPolicy & {
|
|
40
40
|
readonly migrations: MigrationOptions<TMigrations, TMigrationError>;
|
|
41
|
-
}, database: ReturnType<typeof appDatabase<TMigrations, TMigrationError>>): Layer.Layer<"@shivaedev/contract/LiveServer" | TServices | import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient | import("@effect/platform-node/NodeServices").NodeServices, TMigrationError | TServiceError | import("effect/Config").ConfigError | import("effect/sql/Migrator").MigrationError | import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicies | import("@shivaedev/sql/PostgresListenerError.ts").PostgresListenerError | import("effect/Schema").SchemaError | import("@shivaedev/errors/schemaFieldScope.ts").SensitiveFieldConflict | import("effect/http/HttpServerError").ServeError | import("effect/sql/SqlError").SqlError | import("./TrustedProxyRequired.ts").TrustedProxyRequired | HttpRouter.Request.Without<THandlerError> | HttpRouter.Request.Without<TRouteError>, Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<TServiceRequirements, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpPlatform").HttpPlatform, "@shivaedev/contract/LiveServer" | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy, "@shivaedev/contract/LiveServer" | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<TMigrations, import("effect/Scope").Scope>, import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/sql/SqlClient").SqlClient>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<THandlerRequirements, import("effect/rpc/RpcSerialization").RpcSerialization>, never>, never>>, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices>, "@shivaedev/contract/LiveServer" | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<TRouteRequirements, never>, never>, never>>, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices>, "@shivaedev/contract/LiveServer" | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
41
|
+
}, database: ReturnType<typeof appDatabase<TMigrations, TMigrationError>>): Layer.Layer<"@shivaedev/contract/LiveServer" | TServices | import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient | import("@effect/platform-node/NodeServices").NodeServices, TMigrationError | TServiceError | import("effect/Config").ConfigError | import("effect/sql/Migrator").MigrationError | import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicies | import("@shivaedev/sql/PostgresListenerError.ts").PostgresListenerError | import("effect/Schema").SchemaError | import("@shivaedev/errors/schemaFieldScope.ts").SensitiveFieldConflict | import("effect/http/HttpServerError").ServeError | import("effect/sql/SqlError").SqlError | import("./TrustedProxyRequired.ts").TrustedProxyRequired | HttpRouter.Request.Without<THandlerError> | HttpRouter.Request.Without<TRouteError>, Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<TServiceRequirements, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpPlatform").HttpPlatform, "@shivaedev/contract/LiveServer" | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy, "@shivaedev/contract/LiveServer" | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<TMigrations, import("effect/Scope").Scope>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<THandlerRequirements, import("effect/rpc/RpcSerialization").RpcSerialization>, never>, never>>, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices>, "@shivaedev/contract/LiveServer" | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<TRouteRequirements, never>, never>, never>>, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices>, "@shivaedev/contract/LiveServer" | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
42
42
|
readonly _tag: `${string}.$changes`;
|
|
43
43
|
}>>>, import("effect/rpc/RpcSerialization").RpcSerialization>, never>, never>>, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices>, "@shivaedev/contract/LiveServer" | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<HttpRouter.Request<"Requires", import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
44
44
|
readonly _tag: `${string}.$changes`;
|
|
@@ -69,7 +69,7 @@ export declare function migratedHost<TRpcs extends Rpc.Any, THandlers, THandlerE
|
|
|
69
69
|
}>>>, import("effect/rpc/RpcSerialization").RpcSerialization>, never>, never>>, HttpRouter.HttpRouter>, import("effect/Scope").Scope>, "@shivaedev/contract/LiveServer" | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Rpc.ToHandler<Rpc.AddMiddleware<Rpc.AddMiddleware<TRpcs, typeof import("./hostRpc.ts").HostedReadPolicy>, typeof import("@shivaedev/identity/middleware.ts").RequestTracing>>, import("./hostRpc.ts").HostedReadPolicy>, import("effect/rpc/RpcSerialization").RpcSerialization>, import("effect/Scope").Scope>, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
70
70
|
readonly _tag: `${string}.$changes`;
|
|
71
71
|
}>>>, import("effect/rpc/RpcSerialization").RpcSerialization>, never>, never>>, HttpRouter.HttpRouter>, import("effect/Scope").Scope>, "@shivaedev/contract/LiveServer" | TServices | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>>;
|
|
72
|
-
export declare function deferredHost<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TApplicationError, TApplicationRequirements, TRouteError = never, TRouteRequirements = HostRouteRequirements, TMigrationError = never>(application: Effect.Effect<AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, never, never, never, TRouteError, TRouteRequirements>, TApplicationError, TApplicationRequirements>, database: ReturnType<typeof appDatabase<TMigrations, TMigrationError>>): Layer.Layer<"@shivaedev/contract/LiveServer" | TServices | import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient | import("@effect/platform-node/NodeServices").NodeServices, TApplicationError | TMigrationError | TServiceError | import("effect/Config").ConfigError | import("effect/sql/Migrator").MigrationError | import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicies | import("@shivaedev/sql/PostgresListenerError.ts").PostgresListenerError | import("effect/Schema").SchemaError | import("@shivaedev/errors/schemaFieldScope.ts").SensitiveFieldConflict | import("effect/http/HttpServerError").ServeError | import("effect/sql/SqlError").SqlError | import("./TrustedProxyRequired.ts").TrustedProxyRequired | HttpRouter.Request.Without<THandlerError> | HttpRouter.Request.Without<TRouteError>, Exclude<Exclude<TApplicationRequirements, import("effect/Scope").Scope>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<TMigrations, import("effect/Scope").Scope>, import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<TServiceRequirements, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpPlatform").HttpPlatform, TServices>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy, TServices>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<THandlerRequirements, import("effect/rpc/RpcSerialization").RpcSerialization>, never>, never>>, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices>, TServices>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<TRouteRequirements, never>, never>, never>>, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices>, TServices>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
72
|
+
export declare function deferredHost<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, TMigrations, TApplicationError, TApplicationRequirements, TRouteError = never, TRouteRequirements = HostRouteRequirements, TMigrationError = never>(application: Effect.Effect<AppHttpHostOptions<TRpcs, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements, never, never, never, TRouteError, TRouteRequirements>, TApplicationError, TApplicationRequirements>, database: ReturnType<typeof appDatabase<TMigrations, TMigrationError>>): Layer.Layer<"@shivaedev/contract/LiveServer" | TServices | import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient | import("@effect/platform-node/NodeServices").NodeServices, TApplicationError | TMigrationError | TServiceError | import("effect/Config").ConfigError | import("effect/sql/Migrator").MigrationError | import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicies | import("@shivaedev/sql/PostgresListenerError.ts").PostgresListenerError | import("effect/Schema").SchemaError | import("@shivaedev/errors/schemaFieldScope.ts").SensitiveFieldConflict | import("effect/http/HttpServerError").ServeError | import("effect/sql/SqlError").SqlError | import("./TrustedProxyRequired.ts").TrustedProxyRequired | HttpRouter.Request.Without<THandlerError> | HttpRouter.Request.Without<TRouteError>, Exclude<Exclude<TApplicationRequirements, import("effect/Scope").Scope>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<TMigrations, import("effect/Scope").Scope>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<TServiceRequirements, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("effect/http/HttpPlatform").HttpPlatform, TServices>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy, TServices>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<THandlerRequirements, import("effect/rpc/RpcSerialization").RpcSerialization>, never>, never>>, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices>, TServices>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<TRouteRequirements, never>, never>, never>>, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices>, TServices>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<HttpRouter.HttpRouter, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
73
73
|
readonly _tag: `${string}.$changes`;
|
|
74
74
|
}>>>, import("effect/rpc/RpcSerialization").RpcSerialization>, never>, never>>, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | HttpServer.HttpServer | import("@effect/platform-node/NodeServices").NodeServices>, TServices>, import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("@effect/platform-node/NodeServices").NodeServices>, never>, never>, never>, "@shivaedev/contract/LiveServer" | import("@effect/sql-pg/PgClient").PgClient | import("@effect/sql-pg/PgPool").PgPool | import("effect/reactivity/Reactivity").Reactivity | import("effect/sql/SqlClient").SqlClient> | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<Exclude<Exclude<HttpRouter.Request<"Requires", import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy>, THandlers | import("@shivaedev/identity/middleware.ts").RequestTracing | Rpc.ToHandler<Extract<TRpcs, {
|
|
75
75
|
readonly _tag: `${string}.$changes`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appHostHttp.d.ts","sourceRoot":"","sources":["../src/appHostHttp.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CA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ACT,aAAa,EACb,oBAAoB,EACpB,KAAK,EACL,KAAK,EACL,KAAK,EACL,WAAW,EACX,kBAAkB,CAClB,EACD,iBAAiB,EACjB,wBAAwB,CACxB,EACD,QAAQ,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8lBAGtE"}
|
package/dist/appHostHttp.js
CHANGED
|
@@ -23,7 +23,7 @@ export function appHostHttp(options) {
|
|
|
23
23
|
const sessions = Layer.mergeAll(Layer.empty, ...(options.sessions === undefined ? [] : [options.sessions]));
|
|
24
24
|
const server = nodeHttpServer(host, options.config);
|
|
25
25
|
const applicationRoutes = hostApplicationRoutes(options.routes, bodySize);
|
|
26
|
-
const httpRoutes = Layer.mergeAll(routes, healthRoute, browserErrorRoute(trustedProxy), assets, applicationRoutes).pipe(Layer.provide(nativeClientOrigins(nativeOrigins, trustedProxy, false, options.rpcPath)), Layer.provide(nativeClientOrigins(nativeOrigins, trustedProxy, options.nativeOrigins === undefined ? "preflight" : true)));
|
|
26
|
+
const httpRoutes = Layer.mergeAll(routes, healthRoute, browserErrorRoute(trustedProxy, options.browserErrors), assets, applicationRoutes).pipe(Layer.provide(nativeClientOrigins(nativeOrigins, trustedProxy, false, options.rpcPath)), Layer.provide(nativeClientOrigins(nativeOrigins, trustedProxy, options.nativeOrigins === undefined ? "preflight" : true)));
|
|
27
27
|
return Layer.unwrap(HttpRouter.toHttpEffect(httpRoutes).pipe(Effect.map((handler) => HttpServer.serve(handler).pipe(HttpServer.withLogAddress, Layer.provideMerge(server))))).pipe(Layer.provideMerge(application), Layer.provide(sessions), Layer.provideMerge(NodeHttpServer.layerHttpServices));
|
|
28
28
|
})).pipe(Layer.provide(redactingDiagnostics(sensitive)), Layer.provide(otlpTracing), Layer.provide(Layer.succeed(RedactionPolicy, sensitive)))));
|
|
29
29
|
}
|
package/dist/appHostHttp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
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BAAiB,CAAC,CAAC,CAAC;IACxH,CAAC,CAAC,CACF,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC,CAAC,CAC5I,CACD,CAAC;AACH,CAAC;AAED,MAAM,UAAU,YAAY,CAa3B,OAaE,EACF,QAAsE;IAEtE,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;IACjE,OAAO,WAAW,CAAC,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;AAC3F,CAAC;AAED,MAAM,UAAU,YAAY,CAe3B,WAiBC,EACD,QAAsE;IAEtE,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;AACpH,CAAC"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { Layer } from "effect";
|
|
2
2
|
import { HttpRouter } from "effect/http";
|
|
3
|
-
export
|
|
3
|
+
export interface BrowserErrorOptions {
|
|
4
|
+
readonly includeUserId?: boolean;
|
|
5
|
+
readonly log?: boolean;
|
|
6
|
+
readonly requireSession?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function browserErrorRoute(trustedProxy?: string, options?: BrowserErrorOptions): Layer.Layer<never, never, HttpRouter.HttpRouter>;
|
|
4
9
|
//# sourceMappingURL=browserErrorRoute.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browserErrorRoute.d.ts","sourceRoot":"","sources":["../src/browserErrorRoute.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0C,KAAK,EAAkB,MAAM,QAAQ,CAAC;AACvF,OAAO,EAAuB,UAAU,EAAyC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"browserErrorRoute.d.ts","sourceRoot":"","sources":["../src/browserErrorRoute.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0C,KAAK,EAAkB,MAAM,QAAQ,CAAC;AACvF,OAAO,EAAuB,UAAU,EAAyC,MAAM,aAAa,CAAC;AAgBrG,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;CAClC;AAgDD,wBAAgB,iBAAiB,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,oDA6BzF"}
|
|
@@ -2,29 +2,59 @@ import { ByteSize, Cause, Effect, ErrorReporter, Layer, Option, Schema } from "e
|
|
|
2
2
|
import { HttpIncomingMessage, HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/http";
|
|
3
3
|
import * as HttpStatus from "effect/http/HttpStatus";
|
|
4
4
|
import { RateLimiter } from "effect/persistence";
|
|
5
|
+
import { redactBrowserText } from "@shivaedev/errors/redactBrowserText.ts";
|
|
6
|
+
import { isAuthUnavailable, isForbidden } from "@shivaedev/errors/taxonomy.ts";
|
|
5
7
|
import { localTransport, trustedProxyPeer } from "@shivaedev/identity/server/local.ts";
|
|
8
|
+
import { SessionPolicy } from "@shivaedev/identity/server/SessionPolicy.ts";
|
|
9
|
+
import { resolveSession } from "@shivaedev/identity/server/session.ts";
|
|
6
10
|
const BrowserErrorReport = Schema.Struct({
|
|
7
11
|
kind: Schema.Literals(["error", "unhandledrejection"]),
|
|
8
12
|
message: Schema.String,
|
|
9
13
|
stack: Schema.optional(Schema.String),
|
|
10
14
|
url: Schema.String,
|
|
11
15
|
});
|
|
12
|
-
|
|
16
|
+
class BrowserError extends Error {
|
|
17
|
+
name = "BrowserError";
|
|
18
|
+
[ErrorReporter.severity] = "Error";
|
|
19
|
+
}
|
|
20
|
+
const receiveReport = Effect.fnUntraced(function* (options, userId) {
|
|
13
21
|
const parsed = yield* HttpServerRequest.schemaBodyJson(BrowserErrorReport).pipe(Effect.provideService(HttpIncomingMessage.MaxBodySize, ByteSize.kibibytes(16)), Effect.option);
|
|
14
22
|
if (Option.isNone(parsed)) {
|
|
15
23
|
return HttpServerResponse.empty({ status: HttpStatus.fromLiteral("BadRequest") });
|
|
16
24
|
}
|
|
17
|
-
const error = new
|
|
18
|
-
error.name = "BrowserError";
|
|
25
|
+
const error = new BrowserError(redactBrowserText(parsed.value.message));
|
|
19
26
|
if (parsed.value.stack !== undefined) {
|
|
20
|
-
error.stack = parsed.value.stack;
|
|
27
|
+
error.stack = redactBrowserText(parsed.value.stack);
|
|
28
|
+
}
|
|
29
|
+
const cause = Cause.die(error);
|
|
30
|
+
if (userId !== undefined) {
|
|
31
|
+
yield* Effect.annotateCurrentSpan("user.id", userId);
|
|
21
32
|
}
|
|
22
|
-
yield*
|
|
33
|
+
yield* Effect.gen(function* () {
|
|
34
|
+
yield* ErrorReporter.report(cause);
|
|
35
|
+
if (options.log) {
|
|
36
|
+
yield* Effect.logError("Browser error", cause);
|
|
37
|
+
}
|
|
38
|
+
}).pipe(Effect.annotateLogs({ "browser.kind": parsed.value.kind, "url.full": parsed.value.url, ...(userId === undefined ? {} : { "user.id": userId }) }));
|
|
23
39
|
return HttpServerResponse.empty({ status: HttpStatus.fromLiteral("Accepted") });
|
|
24
40
|
});
|
|
25
|
-
|
|
41
|
+
const receiveForSession = Effect.fnUntraced(function* (options, policy) {
|
|
42
|
+
if (!(options.requireSession || options.includeUserId)) {
|
|
43
|
+
return yield* receiveReport(options);
|
|
44
|
+
}
|
|
45
|
+
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
46
|
+
const session = Option.isSome(policy)
|
|
47
|
+
? yield* resolveSession(request.headers, "$browserError").pipe(Effect.provideService(SessionPolicy, policy.value))
|
|
48
|
+
: Option.none();
|
|
49
|
+
if (options.requireSession && Option.isNone(session)) {
|
|
50
|
+
return HttpServerResponse.empty({ status: HttpStatus.fromLiteral("Unauthorized") });
|
|
51
|
+
}
|
|
52
|
+
return yield* receiveReport(options, options.includeUserId && Option.isSome(session) ? session.value.user.id : undefined);
|
|
53
|
+
});
|
|
54
|
+
export function browserErrorRoute(trustedProxy, options = {}) {
|
|
26
55
|
return HttpRouter.use((router) => Effect.gen(function* () {
|
|
27
56
|
const limiter = yield* RateLimiter.RateLimiter;
|
|
57
|
+
const policy = yield* Effect.serviceOption(SessionPolicy);
|
|
28
58
|
const allowed = localTransport(trustedProxy);
|
|
29
59
|
const trusted = trustedProxyPeer(trustedProxy);
|
|
30
60
|
yield* router.add("POST", "/_platform/errors", Effect.gen(function* () {
|
|
@@ -38,8 +68,8 @@ export function browserErrorRoute(trustedProxy) {
|
|
|
38
68
|
if (!accepted) {
|
|
39
69
|
return HttpServerResponse.empty({ status: HttpStatus.fromLiteral("TooManyRequests") });
|
|
40
70
|
}
|
|
41
|
-
return yield*
|
|
42
|
-
}));
|
|
71
|
+
return yield* receiveForSession(options, policy);
|
|
72
|
+
}).pipe(Effect.catchIf(isAuthUnavailable, () => Effect.succeed(HttpServerResponse.empty({ status: HttpStatus.fromLiteral("ServiceUnavailable") }))), Effect.catchIf(isForbidden, () => Effect.succeed(HttpServerResponse.empty({ status: HttpStatus.fromLiteral("Forbidden") })))));
|
|
43
73
|
})).pipe(Layer.provide(RateLimiter.layer.pipe(Layer.provide(RateLimiter.layerStoreMemory))));
|
|
44
74
|
}
|
|
45
75
|
//# sourceMappingURL=browserErrorRoute.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browserErrorRoute.js","sourceRoot":"","sources":["../src/browserErrorRoute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACvF,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACrG,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"browserErrorRoute.js","sourceRoot":"","sources":["../src/browserErrorRoute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACvF,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACrG,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAEvE,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,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H,CACD,CAAC;IACH,CAAC,CAAC,CACF,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5F,CAAC"}
|
package/dist/hostOptions.d.ts
CHANGED
|
@@ -4,9 +4,11 @@ import type { Rpc, RpcGroup } from "effect/rpc";
|
|
|
4
4
|
import type { SessionPolicy } from "@shivaedev/identity/server/SessionPolicy.ts";
|
|
5
5
|
import type { AssetOptions } from "#AssetOptions.ts";
|
|
6
6
|
import type { AppDatabaseOptions } from "#appHost.ts";
|
|
7
|
+
import type { BrowserErrorOptions } from "#browserErrorRoute.ts";
|
|
7
8
|
export type HostRouteRequirements = HttpRouter.HttpRouter | HttpRouter.Request<"Error", unknown>;
|
|
8
9
|
export type HostCoreOptions<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> = {
|
|
9
10
|
readonly assets?: string | AssetOptions;
|
|
11
|
+
readonly browserErrors?: BrowserErrorOptions;
|
|
10
12
|
readonly config?: AppDatabaseOptions["config"] & {
|
|
11
13
|
readonly port?: number;
|
|
12
14
|
readonly host?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hostOptions.d.ts","sourceRoot":"","sources":["../src/hostOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,kBAAkB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AAW,EAAE,kBAAkB,CAAC,CAAC;AAE7C,MAAM,MAAM,UAAU,GACnB;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;CAAE,GAC9E;IAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otlpHttpClient.d.ts","sourceRoot":"","sources":["../src/otlpHttpClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAmB,UAAU,EAAoE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"otlpHttpClient.d.ts","sourceRoot":"","sources":["../src/otlpHttpClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAmB,UAAU,EAAoE,MAAM,aAAa,CAAC;AAY5H,wBAAgB,cAAc,CAAC,OAAO,SAAS,oDA6C9C"}
|
package/dist/otlpHttpClient.js
CHANGED
|
@@ -2,6 +2,7 @@ import { Effect, Layer } from "effect";
|
|
|
2
2
|
import { FetchHttpClient, HttpClient, HttpClientError } from "effect/http";
|
|
3
3
|
import { redactText } from "@shivaedev/errors/sensitive.ts";
|
|
4
4
|
import { filterStatus } from "@shivaedev/http/filterStatus.ts";
|
|
5
|
+
import { boundedOtlpResponse } from "#adapters/boundedOtlpResponse.ts";
|
|
5
6
|
import { RedactionPolicy } from "#RedactionPolicy.ts";
|
|
6
7
|
function timeoutError(request) {
|
|
7
8
|
return new HttpClientError.HttpClientError({
|
|
@@ -32,7 +33,7 @@ export function otlpHttpClient(timeout = 10_000) {
|
|
|
32
33
|
}),
|
|
33
34
|
});
|
|
34
35
|
}
|
|
35
|
-
return client.pipe(HttpClient.
|
|
36
|
+
return client.pipe(HttpClient.transformResponse(Effect.flatMap(boundedOtlpResponse)), HttpClient.transform((requestEffect, request) => requestEffect.pipe(Effect.timeoutOrElse({
|
|
36
37
|
duration: timeout,
|
|
37
38
|
orElse: () => Effect.fail(timeoutError(request)),
|
|
38
39
|
}))), HttpClient.tap(recordStatus), HttpClient.tapError((error) => warnOnce(Effect.succeed({ "otlp.failure": error.reason._tag }))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otlpHttpClient.js","sourceRoot":"","sources":["../src/otlpHttpClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,eAAe,EAAmD,MAAM,aAAa,CAAC;AAC5H,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,SAAS,YAAY,CAAC,OAA4C;IACjE,OAAO,IAAI,eAAe,CAAC,eAAe,CAAC;QAC1C,MAAM,EAAE,IAAI,eAAe,CAAC,cAAc,CAAC,EAAE,WAAW,EAAE,+BAA+B,EAAE,OAAO,EAAE,CAAC;KACrG,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAAO,GAAG,MAAM;IAC9C,OAAO,KAAK,CAAC,MAAM,CAClB,UAAU,CAAC,UAAU,EACrB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QACnB,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC;QAC5C,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,eAAe,CAAC;QACzC,IAAI,MAAM,GAAG,KAAK,CAAC;QACnB,SAAS,QAAQ,CAAC,UAAkD;YACnE,O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AC,YAAY,CAAC,OAAO,CAAC,CAAC;SAChD,CAAC,CACF,CACD,EACD,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,EAC5B,UAAU,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAC/F,CAAC;IACH,CAAC,CAAC,CACF,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otlpTracing.d.ts","sourceRoot":"","sources":["../src/otlpTracing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,KAAK,EAAU,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"otlpTracing.d.ts","sourceRoot":"","sources":["../src/otlpTracing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,KAAK,EAAU,MAAM,QAAQ,CAAC;AAWvD,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,WAAW,CAwD9D,CAAC"}
|
package/dist/otlpTracing.js
CHANGED
|
@@ -6,11 +6,14 @@ import { RedactionPolicy } from "#RedactionPolicy.ts";
|
|
|
6
6
|
import { redactingDiagnostics } from "#redactingDiagnostics.ts";
|
|
7
7
|
import { redactingTracer } from "#redactingTracer.ts";
|
|
8
8
|
import { safeOtlpSerialization } from "#safeOtlpSerialization.ts";
|
|
9
|
+
const endpointUrl = Schema.URL.check(Schema.makeFilter((url) => url.protocol === "http:" || url.protocol === "https:"));
|
|
9
10
|
export const otlpTracing = Layer.unwrap(Effect.gen(function* () {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const tracesEndpoint = yield* Config.schema(endpointUrl, "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT").pipe(Config.withDefault(undefined));
|
|
12
|
+
const endpoint = tracesEndpoint
|
|
13
|
+
?? (yield* Config.schema(endpointUrl, "OTEL_EXPORTER_OTLP_ENDPOINT").pipe(Config.map((url) => {
|
|
14
|
+
url.pathname = `${url.pathname.replace(/\/$/u, "")}/v1/traces`;
|
|
15
|
+
return url;
|
|
16
|
+
}), Config.withDefault(undefined)));
|
|
14
17
|
if (endpoint === undefined) {
|
|
15
18
|
return Layer.empty;
|
|
16
19
|
}
|
package/dist/otlpTracing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otlpTracing.js","sourceRoot":"","sources":["../src/otlpTracing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,MAAM,CAAC,MAAM,WAAW,GAA2C,KAAK,CAAC,MAAM,CAC9E,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IACnB,MAAM,
|
|
1
|
+
{"version":3,"file":"otlpTracing.js","sourceRoot":"","sources":["../src/otlpTracing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACvD,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CAAC,aAAa,CAAC,CAAC,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CACvI,EACD,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC,CAC7C,CAAC;IACF,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,eAAe,CAAC;IACzC,OAAO,oBAAoB,CAAC,SAAS,CAAC,CAAC,IAAI,CAC1C,KAAK,CAAC,YAAY,CAAC,gBAAgB,CAAC,EACpC,KAAK,CAAC,YAAY,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAC/E,CAAC;AACH,CAAC,CAAC,CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaedev/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "The Effect application host: HTTP and RPC serving, health, OTLP export, database and migrations, and development mode",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"effect"
|
|
@@ -45,25 +45,25 @@
|
|
|
45
45
|
"README.md"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@shivaedev/changes": "0.
|
|
49
|
-
"@shivaedev/contract": "0.30.
|
|
50
|
-
"@shivaedev/errors": "0.
|
|
51
|
-
"@shivaedev/http": "0.
|
|
52
|
-
"@shivaedev/identity": "0.
|
|
53
|
-
"@shivaedev/local-postgres": "0.
|
|
54
|
-
"@shivaedev/sql": "0.
|
|
48
|
+
"@shivaedev/changes": "0.7.0",
|
|
49
|
+
"@shivaedev/contract": "0.30.2",
|
|
50
|
+
"@shivaedev/errors": "0.5.0",
|
|
51
|
+
"@shivaedev/http": "0.4.0",
|
|
52
|
+
"@shivaedev/identity": "0.18.0",
|
|
53
|
+
"@shivaedev/local-postgres": "0.9.0",
|
|
54
|
+
"@shivaedev/sql": "0.32.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@effect/platform-node": "4.0.6",
|
|
58
58
|
"@effect/sql-pg": "4.0.6",
|
|
59
59
|
"@effect/vitest": "4.0.6",
|
|
60
|
-
"@shivaedev/access": "0.3.
|
|
61
|
-
"@shivaedev/admin": "0.
|
|
62
|
-
"@shivaedev/jobs": "0.29.
|
|
63
|
-
"@shivaedev/quality": "0.
|
|
64
|
-
"@shivaedev/test": "0.12.
|
|
65
|
-
"@shivaedev/test-sql": "0.16.
|
|
66
|
-
"@shivaedev/test-story": "0.
|
|
60
|
+
"@shivaedev/access": "0.3.6",
|
|
61
|
+
"@shivaedev/admin": "0.18.0",
|
|
62
|
+
"@shivaedev/jobs": "0.29.2",
|
|
63
|
+
"@shivaedev/quality": "0.55.0",
|
|
64
|
+
"@shivaedev/test": "0.12.1",
|
|
65
|
+
"@shivaedev/test-sql": "0.16.1",
|
|
66
|
+
"@shivaedev/test-story": "0.33.0",
|
|
67
67
|
"@types/node": "24.19.2",
|
|
68
68
|
"better-auth": "1.7.12",
|
|
69
69
|
"effect": "4.0.6",
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { HttpClientError, HttpClientResponse } from "effect/http";
|
|
3
|
+
import { readBoundedBody } from "@shivaedev/http/body.ts";
|
|
4
|
+
|
|
5
|
+
const responseLimit = 64 * 1024;
|
|
6
|
+
|
|
7
|
+
export const boundedOtlpResponse = Effect.fnUntraced(function* (response: HttpClientResponse.HttpClientResponse) {
|
|
8
|
+
const bytes = yield* readBoundedBody(response, responseLimit).pipe(
|
|
9
|
+
Effect.mapError((error) =>
|
|
10
|
+
HttpClientError.isHttpClientError(error)
|
|
11
|
+
? error
|
|
12
|
+
: new HttpClientError.HttpClientError({
|
|
13
|
+
reason: new HttpClientError.DecodeError({
|
|
14
|
+
description: `OTLP collector response exceeds ${responseLimit} bytes`,
|
|
15
|
+
request: response.request,
|
|
16
|
+
response,
|
|
17
|
+
}),
|
|
18
|
+
}),
|
|
19
|
+
),
|
|
20
|
+
);
|
|
21
|
+
const buffered = HttpClientResponse.fromWeb(
|
|
22
|
+
response.request,
|
|
23
|
+
new Response(bytes.byteLength === 0 ? null : bytes, { headers: response.headers, status: response.status }),
|
|
24
|
+
);
|
|
25
|
+
yield* buffered.arrayBuffer;
|
|
26
|
+
return buffered;
|
|
27
|
+
});
|
package/src/appDatabase.ts
CHANGED
|
@@ -32,16 +32,15 @@ export function appDatabase<R, E = never>(options: AppDatabaseOptions<R, E>) {
|
|
|
32
32
|
postgresLayer(url, config).pipe(Layer.provide(clock)),
|
|
33
33
|
),
|
|
34
34
|
);
|
|
35
|
-
const prepared = Layer.effectDiscard(prepareMigrations(options.migrations)).pipe(Layer.provideMerge(pool));
|
|
36
35
|
const live = LiveServer.layer.pipe(Layer.provideMerge(Reactivity.layer));
|
|
37
36
|
const migrations = options.migrations;
|
|
38
37
|
const worker =
|
|
39
38
|
migrations.mode === "wait" && migrations.release !== undefined
|
|
40
39
|
? Layer.effect(WorkerRelease, coordinateWorkerRelease(migrations.release, migrations.pollInterval, migrations.table))
|
|
41
40
|
: Layer.empty;
|
|
42
|
-
const base = Layer.merge(
|
|
41
|
+
const base = Layer.merge(pool, live);
|
|
43
42
|
const changes = options.config?.changes;
|
|
44
|
-
|
|
43
|
+
const connected = Layer.unwrap(
|
|
45
44
|
Effect.gen(function* () {
|
|
46
45
|
const client = yield* PgClient.PgClient;
|
|
47
46
|
const hints = yield* LiveServer;
|
|
@@ -71,6 +70,8 @@ export function appDatabase<R, E = never>(options: AppDatabaseOptions<R, E>) {
|
|
|
71
70
|
}).pipe(Layer.provide(clock));
|
|
72
71
|
}),
|
|
73
72
|
).pipe(Layer.provideMerge(base));
|
|
73
|
+
const prepared = Layer.effectDiscard(prepareMigrations(migrations)).pipe(Layer.provideMerge(connected));
|
|
74
|
+
return worker.pipe(Layer.provideMerge(prepared));
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
function prepareMigrations<R, E>(migrations: AppDatabaseOptions<R, E>["migrations"]) {
|
package/src/appHostHttp.ts
CHANGED
|
@@ -55,7 +55,13 @@ export function appHostHttp<
|
|
|
55
55
|
const sessions = Layer.mergeAll(Layer.empty, ...(options.sessions === undefined ? [] : [options.sessions]));
|
|
56
56
|
const server = nodeHttpServer(host, options.config);
|
|
57
57
|
const applicationRoutes = hostApplicationRoutes(options.routes, bodySize);
|
|
58
|
-
const httpRoutes = Layer.mergeAll(
|
|
58
|
+
const httpRoutes = Layer.mergeAll(
|
|
59
|
+
routes,
|
|
60
|
+
healthRoute,
|
|
61
|
+
browserErrorRoute(trustedProxy, options.browserErrors),
|
|
62
|
+
assets,
|
|
63
|
+
applicationRoutes,
|
|
64
|
+
).pipe(
|
|
59
65
|
Layer.provide(nativeClientOrigins(nativeOrigins, trustedProxy, false, options.rpcPath)),
|
|
60
66
|
Layer.provide(nativeClientOrigins(nativeOrigins, trustedProxy, options.nativeOrigins === undefined ? "preflight" : true)),
|
|
61
67
|
);
|
package/src/browserErrorRoute.ts
CHANGED
|
@@ -2,7 +2,11 @@ import { ByteSize, Cause, Effect, ErrorReporter, Layer, Option, Schema } from "e
|
|
|
2
2
|
import { HttpIncomingMessage, HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/http";
|
|
3
3
|
import * as HttpStatus from "effect/http/HttpStatus";
|
|
4
4
|
import { RateLimiter } from "effect/persistence";
|
|
5
|
+
import { redactBrowserText } from "@shivaedev/errors/redactBrowserText.ts";
|
|
6
|
+
import { isAuthUnavailable, isForbidden } from "@shivaedev/errors/taxonomy.ts";
|
|
5
7
|
import { localTransport, trustedProxyPeer } from "@shivaedev/identity/server/local.ts";
|
|
8
|
+
import { SessionPolicy } from "@shivaedev/identity/server/SessionPolicy.ts";
|
|
9
|
+
import { resolveSession } from "@shivaedev/identity/server/session.ts";
|
|
6
10
|
|
|
7
11
|
const BrowserErrorReport = Schema.Struct({
|
|
8
12
|
kind: Schema.Literals(["error", "unhandledrejection"]),
|
|
@@ -11,7 +15,18 @@ const BrowserErrorReport = Schema.Struct({
|
|
|
11
15
|
url: Schema.String,
|
|
12
16
|
});
|
|
13
17
|
|
|
14
|
-
|
|
18
|
+
export interface BrowserErrorOptions {
|
|
19
|
+
readonly includeUserId?: boolean;
|
|
20
|
+
readonly log?: boolean;
|
|
21
|
+
readonly requireSession?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
class BrowserError extends Error {
|
|
25
|
+
override readonly name = "BrowserError";
|
|
26
|
+
override readonly [ErrorReporter.severity] = "Error";
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const receiveReport = Effect.fnUntraced(function* (options: BrowserErrorOptions, userId?: string) {
|
|
15
30
|
const parsed = yield* HttpServerRequest.schemaBodyJson(BrowserErrorReport).pipe(
|
|
16
31
|
Effect.provideService(HttpIncomingMessage.MaxBodySize, ByteSize.kibibytes(16)),
|
|
17
32
|
Effect.option,
|
|
@@ -19,19 +34,44 @@ const receiveReport = Effect.gen(function* () {
|
|
|
19
34
|
if (Option.isNone(parsed)) {
|
|
20
35
|
return HttpServerResponse.empty({ status: HttpStatus.fromLiteral("BadRequest") });
|
|
21
36
|
}
|
|
22
|
-
const error = new
|
|
23
|
-
error.name = "BrowserError";
|
|
37
|
+
const error = new BrowserError(redactBrowserText(parsed.value.message));
|
|
24
38
|
if (parsed.value.stack !== undefined) {
|
|
25
|
-
error.stack = parsed.value.stack;
|
|
39
|
+
error.stack = redactBrowserText(parsed.value.stack);
|
|
40
|
+
}
|
|
41
|
+
const cause = Cause.die(error);
|
|
42
|
+
if (userId !== undefined) {
|
|
43
|
+
yield* Effect.annotateCurrentSpan("user.id", userId);
|
|
26
44
|
}
|
|
27
|
-
yield*
|
|
45
|
+
yield* Effect.gen(function* () {
|
|
46
|
+
yield* ErrorReporter.report(cause);
|
|
47
|
+
if (options.log) {
|
|
48
|
+
yield* Effect.logError("Browser error", cause);
|
|
49
|
+
}
|
|
50
|
+
}).pipe(
|
|
51
|
+
Effect.annotateLogs({ "browser.kind": parsed.value.kind, "url.full": parsed.value.url, ...(userId === undefined ? {} : { "user.id": userId }) }),
|
|
52
|
+
);
|
|
28
53
|
return HttpServerResponse.empty({ status: HttpStatus.fromLiteral("Accepted") });
|
|
29
54
|
});
|
|
30
55
|
|
|
31
|
-
|
|
56
|
+
const receiveForSession = Effect.fnUntraced(function* (options: BrowserErrorOptions, policy: Option.Option<SessionPolicy["Service"]>) {
|
|
57
|
+
if (!(options.requireSession || options.includeUserId)) {
|
|
58
|
+
return yield* receiveReport(options);
|
|
59
|
+
}
|
|
60
|
+
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
61
|
+
const session = Option.isSome(policy)
|
|
62
|
+
? yield* resolveSession(request.headers, "$browserError").pipe(Effect.provideService(SessionPolicy, policy.value))
|
|
63
|
+
: Option.none();
|
|
64
|
+
if (options.requireSession && Option.isNone(session)) {
|
|
65
|
+
return HttpServerResponse.empty({ status: HttpStatus.fromLiteral("Unauthorized") });
|
|
66
|
+
}
|
|
67
|
+
return yield* receiveReport(options, options.includeUserId && Option.isSome(session) ? session.value.user.id : undefined);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
export function browserErrorRoute(trustedProxy?: string, options: BrowserErrorOptions = {}) {
|
|
32
71
|
return HttpRouter.use((router) =>
|
|
33
72
|
Effect.gen(function* () {
|
|
34
73
|
const limiter = yield* RateLimiter.RateLimiter;
|
|
74
|
+
const policy = yield* Effect.serviceOption(SessionPolicy);
|
|
35
75
|
const allowed = localTransport(trustedProxy);
|
|
36
76
|
const trusted = trustedProxyPeer(trustedProxy);
|
|
37
77
|
yield* router.add(
|
|
@@ -48,8 +88,11 @@ export function browserErrorRoute(trustedProxy?: string) {
|
|
|
48
88
|
if (!accepted) {
|
|
49
89
|
return HttpServerResponse.empty({ status: HttpStatus.fromLiteral("TooManyRequests") });
|
|
50
90
|
}
|
|
51
|
-
return yield*
|
|
52
|
-
})
|
|
91
|
+
return yield* receiveForSession(options, policy);
|
|
92
|
+
}).pipe(
|
|
93
|
+
Effect.catchIf(isAuthUnavailable, () => Effect.succeed(HttpServerResponse.empty({ status: HttpStatus.fromLiteral("ServiceUnavailable") }))),
|
|
94
|
+
Effect.catchIf(isForbidden, () => Effect.succeed(HttpServerResponse.empty({ status: HttpStatus.fromLiteral("Forbidden") }))),
|
|
95
|
+
),
|
|
53
96
|
);
|
|
54
97
|
}),
|
|
55
98
|
).pipe(Layer.provide(RateLimiter.layer.pipe(Layer.provide(RateLimiter.layerStoreMemory))));
|
package/src/hostOptions.ts
CHANGED
|
@@ -4,11 +4,13 @@ import type { Rpc, RpcGroup } from "effect/rpc";
|
|
|
4
4
|
import type { SessionPolicy } from "@shivaedev/identity/server/SessionPolicy.ts";
|
|
5
5
|
import type { AssetOptions } from "#AssetOptions.ts";
|
|
6
6
|
import type { AppDatabaseOptions } from "#appHost.ts";
|
|
7
|
+
import type { BrowserErrorOptions } from "#browserErrorRoute.ts";
|
|
7
8
|
|
|
8
9
|
export type HostRouteRequirements = HttpRouter.HttpRouter | HttpRouter.Request<"Error", unknown>;
|
|
9
10
|
|
|
10
11
|
export type HostCoreOptions<TRpcs extends Rpc.Any, THandlers, THandlerError, THandlerRequirements, TServices, TServiceError, TServiceRequirements> = {
|
|
11
12
|
readonly assets?: string | AssetOptions;
|
|
13
|
+
readonly browserErrors?: BrowserErrorOptions;
|
|
12
14
|
readonly config?: AppDatabaseOptions["config"] & {
|
|
13
15
|
readonly port?: number;
|
|
14
16
|
readonly host?: string;
|
package/src/otlpHttpClient.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Effect, Layer } from "effect";
|
|
|
2
2
|
import { FetchHttpClient, HttpClient, HttpClientError, type HttpClientRequest, type HttpClientResponse } from "effect/http";
|
|
3
3
|
import { redactText } from "@shivaedev/errors/sensitive.ts";
|
|
4
4
|
import { filterStatus } from "@shivaedev/http/filterStatus.ts";
|
|
5
|
+
import { boundedOtlpResponse } from "#adapters/boundedOtlpResponse.ts";
|
|
5
6
|
import { RedactionPolicy } from "#RedactionPolicy.ts";
|
|
6
7
|
|
|
7
8
|
function timeoutError(request: HttpClientRequest.HttpClientRequest) {
|
|
@@ -41,7 +42,7 @@ export function otlpHttpClient(timeout = 10_000) {
|
|
|
41
42
|
});
|
|
42
43
|
}
|
|
43
44
|
return client.pipe(
|
|
44
|
-
HttpClient.
|
|
45
|
+
HttpClient.transformResponse(Effect.flatMap(boundedOtlpResponse)),
|
|
45
46
|
HttpClient.transform((requestEffect, request) =>
|
|
46
47
|
requestEffect.pipe(
|
|
47
48
|
Effect.timeoutOrElse({
|
package/src/otlpTracing.ts
CHANGED
|
@@ -7,19 +7,20 @@ import { redactingDiagnostics } from "#redactingDiagnostics.ts";
|
|
|
7
7
|
import { redactingTracer } from "#redactingTracer.ts";
|
|
8
8
|
import { safeOtlpSerialization } from "#safeOtlpSerialization.ts";
|
|
9
9
|
|
|
10
|
+
const endpointUrl = Schema.URL.check(Schema.makeFilter((url) => url.protocol === "http:" || url.protocol === "https:"));
|
|
11
|
+
|
|
10
12
|
export const otlpTracing: Layer.Layer<never, Config.ConfigError> = Layer.unwrap(
|
|
11
13
|
Effect.gen(function* () {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
),
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
);
|
|
14
|
+
const tracesEndpoint = yield* Config.schema(endpointUrl, "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT").pipe(Config.withDefault(undefined));
|
|
15
|
+
const endpoint =
|
|
16
|
+
tracesEndpoint
|
|
17
|
+
?? (yield* Config.schema(endpointUrl, "OTEL_EXPORTER_OTLP_ENDPOINT").pipe(
|
|
18
|
+
Config.map((url) => {
|
|
19
|
+
url.pathname = `${url.pathname.replace(/\/$/u, "")}/v1/traces`;
|
|
20
|
+
return url;
|
|
21
|
+
}),
|
|
22
|
+
Config.withDefault(undefined),
|
|
23
|
+
));
|
|
23
24
|
if (endpoint === undefined) {
|
|
24
25
|
return Layer.empty;
|
|
25
26
|
}
|