@relayfx/sdk 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ import {
7
7
  RuntimeMigrationError,
8
8
  SqlFailure,
9
9
  exports_runtime_database
10
- } from "./index-pn652eef.js";
10
+ } from "./index-9k4k3wq1.js";
11
11
 
12
12
  // src/migration-errors.ts
13
13
  import { Cause, Effect, Function } from "effect";
@@ -2857,4 +2857,4 @@ var layerClient = (options) => {
2857
2857
  return normalizeHost(publicGraph(runner, options.databaseLayer, "client"), "client", options.databaseLayer[DatabaseDialect]);
2858
2858
  };
2859
2859
 
2860
- export { exports_operation, exports_command, Service2 as Service, exports_client, exports_runtime_database, makeDatabaseIdentity, DatabaseDialect, ConfigFailure, SqlFailure, DatabaseAlreadyOwned, MigratorError, SchemaHeadMismatch, RuntimeConfigurationError, RuntimeTopologyError, RuntimeMigrationError, exports_runtime };
2860
+ export { exports_operation, exports_command, Service2 as Service, exports_client, exports_runtime_database, makeDatabaseIdentity, DatabaseDialect, HostLayerError, ConfigFailure, SqlFailure, DatabaseAlreadyOwned, MigratorError, SchemaHeadMismatch, RuntimeConfigurationError, RuntimeTopologyError, RuntimeMigrationError, exports_runtime };
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  exports_operation,
10
10
  exports_runtime,
11
11
  makeDatabaseIdentity
12
- } from "./index-pn652eef.js";
12
+ } from "./index-9k4k3wq1.js";
13
13
  import {
14
14
  Dialect,
15
15
  __export,
package/dist/mysql.js CHANGED
@@ -3,12 +3,12 @@ import {
3
3
  normalizeClientLayer,
4
4
  normalizeMigrationCause,
5
5
  runtimeDatabaseLayer
6
- } from "./index-vwbatywf.js";
6
+ } from "./index-3sv8mmz5.js";
7
7
  import {
8
8
  MigratorError,
9
9
  RuntimeMigrationError,
10
10
  SqlFailure
11
- } from "./index-pn652eef.js";
11
+ } from "./index-9k4k3wq1.js";
12
12
  import"./index-c2skef55.js";
13
13
 
14
14
  // src/mysql.ts
package/dist/postgres.js CHANGED
@@ -3,11 +3,11 @@ import {
3
3
  normalizeClientLayer,
4
4
  normalizeMigrationCause,
5
5
  runtimeDatabaseLayer
6
- } from "./index-vwbatywf.js";
6
+ } from "./index-3sv8mmz5.js";
7
7
  import {
8
8
  RuntimeMigrationError,
9
9
  SqlFailure
10
- } from "./index-pn652eef.js";
10
+ } from "./index-9k4k3wq1.js";
11
11
  import"./index-c2skef55.js";
12
12
 
13
13
  // src/postgres.ts
package/dist/sqlite.js CHANGED
@@ -2,10 +2,11 @@
2
2
  import {
3
3
  normalizeMigrationCause,
4
4
  runtimeDatabaseLayer
5
- } from "./index-vwbatywf.js";
5
+ } from "./index-3sv8mmz5.js";
6
6
  import {
7
7
  DatabaseAlreadyOwned,
8
8
  DatabaseDialect,
9
+ HostLayerError,
9
10
  RuntimeConfigurationError,
10
11
  RuntimeMigrationError,
11
12
  RuntimeTopologyError,
@@ -14,7 +15,7 @@ import {
14
15
  exports_operation,
15
16
  exports_runtime,
16
17
  makeDatabaseIdentity
17
- } from "./index-pn652eef.js";
18
+ } from "./index-9k4k3wq1.js";
18
19
  import {
19
20
  __export,
20
21
  exports_activity_version_registry,
@@ -73,7 +74,7 @@ __export(exports_sqlite_runtime, {
73
74
  import { layer as sqliteClientLayer } from "@effect/sql-sqlite-bun/SqliteClient";
74
75
  import { layer as sqliteMigratorLayer, run as runSqliteMigrator } from "@effect/sql-sqlite-bun/SqliteMigrator";
75
76
  import { layer as bunServicesLayer } from "@effect/platform-bun/BunServices";
76
- import { Effect as Effect2, FileSystem, Function, Layer, Path } from "effect";
77
+ import { Cause, Effect as Effect2, FileSystem, Function, Layer, Path } from "effect";
77
78
  import { SqlClient as SqlClient2 } from "effect/unstable/sql/SqlClient";
78
79
 
79
80
  // ../../migrations/sqlite/0001_baseline.sql
@@ -754,17 +755,37 @@ var layer = (options) => {
754
755
  return sql;
755
756
  })).pipe(Layer.provide(client));
756
757
  };
758
+ var isAcquisitionError = (error) => typeof error === "object" && error !== null && ("_tag" in error) && (error._tag === "RuntimeConfigurationError" || error._tag === "RuntimeTopologyError" || error._tag === "RuntimeMigrationError");
759
+ var normalizeHostError = (error) => {
760
+ if (isAcquisitionError(error))
761
+ return error;
762
+ const hostFailure = HostLayerError.make({
763
+ service: "SQLite compatibility host graph",
764
+ reason: "host layer acquisition failed"
765
+ });
766
+ Object.defineProperty(hostFailure, "originalCause", { value: error, enumerable: false });
767
+ return RuntimeConfigurationError.make({
768
+ setting: "host layers",
769
+ nextAction: "provide-host-layer",
770
+ cause: hostFailure
771
+ });
772
+ };
773
+ var normalizeHostLayer = (source) => source.pipe(Layer.catchCause((cause) => {
774
+ if (Cause.hasInterrupts(cause))
775
+ return Layer.unwrap(Effect2.failCause(Cause.map(cause, normalizeHostError)));
776
+ return Layer.unwrap(Effect2.fail(normalizeHostError(Cause.squash(cause))));
777
+ }));
757
778
  var workflowLayer = Function.dual(2, (options, handlersLayer) => {
758
779
  const sqlite = layer(options);
759
780
  const repository = exports_workflow_definition_repository.layer.pipe(Layer.provideMerge(sqlite));
760
- return exports_definition_runtime.layer.pipe(Layer.provideMerge(handlersLayer), Layer.provideMerge(repository));
781
+ return normalizeHostLayer(exports_definition_runtime.layer.pipe(Layer.provideMerge(handlersLayer), Layer.provideMerge(repository)));
761
782
  });
762
783
  var childFanOutLayer = Function.dual(2, (options, handlersLayer) => {
763
784
  const sqlite = layer(options);
764
785
  const repository = exports_child_fan_out_repository.layer.pipe(Layer.provideMerge(sqlite));
765
786
  const events = exports_event_log_service.layerFromRepository.pipe(Layer.provide(exports_execution_event_repository.layer.pipe(Layer.provide(exports_notification_bus.inProcessLayer))), Layer.provideMerge(sqlite));
766
787
  const transitions = exports_child_fan_out_transition_service.layer.pipe(Layer.provide(repository), Layer.provide(events));
767
- return exports_child_fan_out_runtime.layer.pipe(Layer.provide(handlersLayer), Layer.provide(repository), Layer.provide(transitions));
788
+ return normalizeHostLayer(exports_child_fan_out_runtime.layer.pipe(Layer.provide(handlersLayer), Layer.provide(repository), Layer.provide(transitions)));
768
789
  });
769
790
 
770
791
  // src/sqlite.ts
@@ -2,7 +2,7 @@ import { type SqliteClientConfig } from "@effect/sql-sqlite-bun/SqliteClient";
2
2
  import { ChildFanOutRuntime, WorkflowDefinitionRuntime } from "../runtime/index";
3
3
  import { Layer } from "effect";
4
4
  import { SqlClient } from "effect/unstable/sql/SqlClient";
5
- import { RuntimeConfigurationError, RuntimeMigrationError, RuntimeTopologyError, type DatabaseLayer } from "./runtime";
5
+ import { type AcquisitionError, RuntimeConfigurationError, RuntimeMigrationError, RuntimeTopologyError, type DatabaseLayer } from "./runtime";
6
6
  export declare const clientLayer: (options: SqliteClientConfig) => Layer.Layer<SqlClient | import("@effect/sql-sqlite-bun/SqliteClient").SqliteClient, never, never>;
7
7
  export interface SQLiteRuntimeDatabaseOptions {
8
8
  readonly filename: string;
@@ -15,10 +15,10 @@ export declare const runtimeDatabaseLayer: (options: SQLiteRuntimeDatabaseOption
15
15
  export declare const migrationsLayer: Layer.Layer<never, import("@effect/sql-sqlite-bun/SqliteMigrator").MigrationError | import("effect/unstable/sql/SqlError").SqlError, SqlClient>;
16
16
  export declare const layer: (options: SqliteClientConfig) => Layer.Layer<SqlClient, import("@effect/sql-sqlite-bun/SqliteMigrator").MigrationError | import("effect/unstable/sql/SqlError").SqlError, never>;
17
17
  export declare const workflowLayer: {
18
- <E, R>(handlersLayer: Layer.Layer<WorkflowDefinitionRuntime.HandlerService, E, R>): (options: SqliteClientConfig) => ReturnType<typeof workflowLayer<E, R>>;
19
- <E, R>(options: SqliteClientConfig, handlersLayer: Layer.Layer<WorkflowDefinitionRuntime.HandlerService, E, R>): Layer.Layer<WorkflowDefinitionRuntime.Service, unknown, R>;
18
+ <E, R>(handlersLayer: Layer.Layer<WorkflowDefinitionRuntime.HandlerService, E, R>): (options: SqliteClientConfig) => Layer.Layer<WorkflowDefinitionRuntime.Service, AcquisitionError, R>;
19
+ <E, R>(options: SqliteClientConfig, handlersLayer: Layer.Layer<WorkflowDefinitionRuntime.HandlerService, E, R>): Layer.Layer<WorkflowDefinitionRuntime.Service, AcquisitionError, R>;
20
20
  };
21
21
  export declare const childFanOutLayer: {
22
- <E, R>(handlersLayer: Layer.Layer<ChildFanOutRuntime.HandlerService, E, R>): (options: SqliteClientConfig) => Layer.Layer<ChildFanOutRuntime.Service, unknown, R>;
23
- <E, R>(options: SqliteClientConfig, handlersLayer: Layer.Layer<ChildFanOutRuntime.HandlerService, E, R>): Layer.Layer<ChildFanOutRuntime.Service, unknown, R>;
22
+ <E, R>(handlersLayer: Layer.Layer<ChildFanOutRuntime.HandlerService, E, R>): (options: SqliteClientConfig) => Layer.Layer<ChildFanOutRuntime.Service, AcquisitionError, R>;
23
+ <E, R>(options: SqliteClientConfig, handlersLayer: Layer.Layer<ChildFanOutRuntime.HandlerService, E, R>): Layer.Layer<ChildFanOutRuntime.Service, AcquisitionError, R>;
24
24
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@relayfx/sdk",
4
- "version": "0.3.0",
4
+ "version": "0.3.1",
5
5
  "description": "Effect-native durable execution SDK for addressable agents and tools",
6
6
  "type": "module",
7
7
  "exports": {