forked from pingdotgg/t3code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProjectionThreadProposedPlans.ts
More file actions
63 lines (56 loc) · 2.22 KB
/
ProjectionThreadProposedPlans.ts
File metadata and controls
63 lines (56 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import {
IsoDateTime,
OrchestrationProposedPlanId,
ThreadId,
TrimmedNonEmptyString,
TurnId,
} from "@t3tools/contracts";
import { Schema, Context } from "effect";
import type { Effect } from "effect";
import type { ProjectionRepositoryError } from "../Errors.ts";
export const ProjectionThreadProposedPlan = Schema.Struct({
planId: OrchestrationProposedPlanId,
threadId: ThreadId,
turnId: Schema.NullOr(TurnId),
planMarkdown: TrimmedNonEmptyString,
implementedAt: Schema.NullOr(IsoDateTime),
implementationThreadId: Schema.NullOr(ThreadId),
createdAt: IsoDateTime,
updatedAt: IsoDateTime,
});
export type ProjectionThreadProposedPlan = typeof ProjectionThreadProposedPlan.Type;
export const ListProjectionThreadProposedPlansInput = Schema.Struct({
threadId: ThreadId,
});
export type ListProjectionThreadProposedPlansInput =
typeof ListProjectionThreadProposedPlansInput.Type;
export const DeleteProjectionThreadProposedPlansInput = Schema.Struct({
threadId: ThreadId,
});
export type DeleteProjectionThreadProposedPlansInput =
typeof DeleteProjectionThreadProposedPlansInput.Type;
export const DeleteProjectionThreadProposedPlanByIdInput = Schema.Struct({
planId: OrchestrationProposedPlanId,
});
export type DeleteProjectionThreadProposedPlanByIdInput =
typeof DeleteProjectionThreadProposedPlanByIdInput.Type;
export interface ProjectionThreadProposedPlanRepositoryShape {
readonly upsert: (
proposedPlan: ProjectionThreadProposedPlan,
) => Effect.Effect<void, ProjectionRepositoryError>;
readonly listByThreadId: (
input: ListProjectionThreadProposedPlansInput,
) => Effect.Effect<ReadonlyArray<ProjectionThreadProposedPlan>, ProjectionRepositoryError>;
readonly deleteByThreadId: (
input: DeleteProjectionThreadProposedPlansInput,
) => Effect.Effect<void, ProjectionRepositoryError>;
readonly deleteByPlanId: (
input: DeleteProjectionThreadProposedPlanByIdInput,
) => Effect.Effect<void, ProjectionRepositoryError>;
}
export class ProjectionThreadProposedPlanRepository extends Context.Service<
ProjectionThreadProposedPlanRepository,
ProjectionThreadProposedPlanRepositoryShape
>()(
"t3/persistence/Services/ProjectionThreadProposedPlans/ProjectionThreadProposedPlanRepository",
) {}