@effect-app/infra 4.0.0-beta.258 → 4.0.0-beta.259
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 +7 -0
- package/dist/ClusterCosmos.d.ts +64 -0
- package/dist/ClusterCosmos.d.ts.map +1 -0
- package/dist/ClusterCosmos.js +487 -0
- package/docs/cluster-storage.md +26 -0
- package/docs/workflow-engine.md +262 -0
- package/package.json +2 -2
- package/run.sh +1 -0
- package/src/ClusterCosmos.ts +954 -0
- package/test/cluster-cosmos.test.ts +406 -0
- package/test/dist/cluster-cosmos.test.d.ts.map +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as Effect from "effect-app/Effect";
|
|
2
|
+
import * as Layer from "effect-app/Layer";
|
|
3
|
+
import * as Option from "effect-app/Option";
|
|
4
|
+
import * as Redacted from "effect/Redacted";
|
|
5
|
+
import { PersistenceError } from "effect/unstable/cluster/ClusterError";
|
|
6
|
+
import * as MessageStorage from "effect/unstable/cluster/MessageStorage";
|
|
7
|
+
import type * as Reply from "effect/unstable/cluster/Reply";
|
|
8
|
+
import * as RunnerStorage from "effect/unstable/cluster/RunnerStorage";
|
|
9
|
+
import * as ShardId from "effect/unstable/cluster/ShardId";
|
|
10
|
+
import * as ShardingConfig from "effect/unstable/cluster/ShardingConfig";
|
|
11
|
+
import * as Snowflake from "effect/unstable/cluster/Snowflake";
|
|
12
|
+
import { CosmosClient } from "./cosmos-client.js";
|
|
13
|
+
export interface ClusterCosmosConfig {
|
|
14
|
+
readonly url: Redacted.Redacted<string>;
|
|
15
|
+
readonly dbName: string;
|
|
16
|
+
readonly prefix?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const makeMessageStorage: (options?: {
|
|
19
|
+
readonly prefix?: string | undefined;
|
|
20
|
+
} | undefined) => Effect.Effect<{
|
|
21
|
+
readonly saveRequest: <R extends import("effect/unstable/rpc/Rpc").Any>(envelope: import("effect/unstable/cluster/Message").OutgoingRequest<R>) => Effect.Effect<MessageStorage.SaveResult<R>, PersistenceError | import("effect/unstable/cluster/ClusterError").MalformedMessage>;
|
|
22
|
+
readonly saveEnvelope: (envelope: import("effect/unstable/cluster/Message").OutgoingEnvelope) => Effect.Effect<void, PersistenceError | import("effect/unstable/cluster/ClusterError").MalformedMessage>;
|
|
23
|
+
readonly saveReply: <R extends import("effect/unstable/rpc/Rpc").Any>(reply: Reply.ReplyWithContext<R>) => Effect.Effect<void, PersistenceError | import("effect/unstable/cluster/ClusterError").MalformedMessage>;
|
|
24
|
+
readonly clearReplies: (requestId: Snowflake.Snowflake) => Effect.Effect<void, PersistenceError>;
|
|
25
|
+
readonly repliesFor: <R extends import("effect/unstable/rpc/Rpc").Any>(requests: Iterable<import("effect/unstable/cluster/Message").OutgoingRequest<R>>) => Effect.Effect<Array<Reply.Reply<R>>, PersistenceError | import("effect/unstable/cluster/ClusterError").MalformedMessage>;
|
|
26
|
+
readonly repliesForUnfiltered: (requestIds: Iterable<Snowflake.Snowflake>) => Effect.Effect<Array<Reply.Encoded>, PersistenceError | import("effect/unstable/cluster/ClusterError").MalformedMessage>;
|
|
27
|
+
readonly requestIdForPrimaryKey: (options: {
|
|
28
|
+
readonly address: import("effect/unstable/cluster/EntityAddress").EntityAddress;
|
|
29
|
+
readonly tag: string;
|
|
30
|
+
readonly id: string;
|
|
31
|
+
}) => Effect.Effect<Option.Option<Snowflake.Snowflake>, PersistenceError>;
|
|
32
|
+
readonly registerReplyHandler: <R extends import("effect/unstable/rpc/Rpc").Any>(message: import("effect/unstable/cluster/Message").OutgoingRequest<R> | import("effect/unstable/cluster/Message").IncomingRequest<R>) => Effect.Effect<void, import("effect/unstable/cluster/ClusterError").EntityNotAssignedToRunner>;
|
|
33
|
+
readonly unregisterReplyHandler: (requestId: Snowflake.Snowflake) => Effect.Effect<void>;
|
|
34
|
+
readonly unregisterShardReplyHandlers: (shardId: ShardId.ShardId) => Effect.Effect<void>;
|
|
35
|
+
readonly unprocessedMessages: (shardIds: Iterable<ShardId.ShardId>) => Effect.Effect<Array<import("effect/unstable/cluster/Message").Incoming<any>>, PersistenceError>;
|
|
36
|
+
readonly unprocessedMessagesById: <R extends import("effect/unstable/rpc/Rpc").Any>(messageIds: Iterable<Snowflake.Snowflake>) => Effect.Effect<Array<import("effect/unstable/cluster/Message").Incoming<R>>, PersistenceError>;
|
|
37
|
+
readonly resetShards: (shardIds: Iterable<ShardId.ShardId>) => Effect.Effect<void, PersistenceError>;
|
|
38
|
+
readonly resetAddress: (address: import("effect/unstable/cluster/EntityAddress").EntityAddress) => Effect.Effect<void, PersistenceError>;
|
|
39
|
+
readonly clearAddress: (address: import("effect/unstable/cluster/EntityAddress").EntityAddress) => Effect.Effect<void, PersistenceError>;
|
|
40
|
+
readonly withTransaction: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
|
41
|
+
}, never, CosmosClient | Snowflake.Generator>;
|
|
42
|
+
export declare const makeRunnerStorage: (options?: {
|
|
43
|
+
readonly prefix?: string | undefined;
|
|
44
|
+
} | undefined) => Effect.Effect<{
|
|
45
|
+
readonly register: (runner: import("effect/unstable/cluster/Runner").Runner, healthy: boolean) => Effect.Effect<import("effect/unstable/cluster/MachineId").MachineId, PersistenceError>;
|
|
46
|
+
readonly unregister: (address: import("effect/unstable/cluster/RunnerAddress").RunnerAddress) => Effect.Effect<void, PersistenceError>;
|
|
47
|
+
readonly getRunners: Effect.Effect<Array<readonly [runner: import("effect/unstable/cluster/Runner").Runner, healthy: boolean]>, PersistenceError>;
|
|
48
|
+
readonly setRunnerHealth: (address: import("effect/unstable/cluster/RunnerAddress").RunnerAddress, healthy: boolean) => Effect.Effect<void, PersistenceError>;
|
|
49
|
+
readonly acquire: (address: import("effect/unstable/cluster/RunnerAddress").RunnerAddress, shardIds: Iterable<ShardId.ShardId>) => Effect.Effect<Array<ShardId.ShardId>, PersistenceError>;
|
|
50
|
+
readonly refresh: (address: import("effect/unstable/cluster/RunnerAddress").RunnerAddress, shardIds: Iterable<ShardId.ShardId>) => Effect.Effect<Array<ShardId.ShardId>, PersistenceError>;
|
|
51
|
+
readonly release: (address: import("effect/unstable/cluster/RunnerAddress").RunnerAddress, shardId: ShardId.ShardId) => Effect.Effect<void, PersistenceError>;
|
|
52
|
+
readonly releaseAll: (address: import("effect/unstable/cluster/RunnerAddress").RunnerAddress) => Effect.Effect<void, PersistenceError>;
|
|
53
|
+
}, never, CosmosClient | ShardingConfig.ShardingConfig>;
|
|
54
|
+
export declare const layerMessageStorage: (options?: {
|
|
55
|
+
readonly prefix?: string | undefined;
|
|
56
|
+
}) => Layer.Layer<MessageStorage.MessageStorage, never, CosmosClient | ShardingConfig.ShardingConfig>;
|
|
57
|
+
export declare const layerRunnerStorage: (options?: {
|
|
58
|
+
readonly prefix?: string | undefined;
|
|
59
|
+
}) => Layer.Layer<RunnerStorage.RunnerStorage, never, CosmosClient | ShardingConfig.ShardingConfig>;
|
|
60
|
+
export declare const layerStorage: (options?: {
|
|
61
|
+
readonly prefix?: string | undefined;
|
|
62
|
+
}) => Layer.Layer<MessageStorage.MessageStorage | RunnerStorage.RunnerStorage, never, CosmosClient | ShardingConfig.ShardingConfig>;
|
|
63
|
+
export declare const layerCosmos: (config: ClusterCosmosConfig) => Layer.Layer<MessageStorage.MessageStorage | RunnerStorage.RunnerStorage, never, ShardingConfig.ShardingConfig>;
|
|
64
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ2x1c3RlckNvc21vcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL0NsdXN0ZXJDb3Ntb3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxLQUFLLE1BQU0sTUFBTSxtQkFBbUIsQ0FBQTtBQUMzQyxPQUFPLEtBQUssS0FBSyxNQUFNLGtCQUFrQixDQUFBO0FBQ3pDLE9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