@gaganref/confect-alchemy 10.6.0-fork.24 → 10.6.0-fork.26

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.
@@ -0,0 +1,154 @@
1
+ import type * as DeploymentApi from "@convex-dev/platform/deploymentApi";
2
+ import type * as Redacted from "effect/Redacted";
3
+ import * as Schema from "effect/Schema";
4
+
5
+ export type SecretField =
6
+ | "apiKey"
7
+ | "ddApiKey"
8
+ | "dsn"
9
+ | "accessKeyId"
10
+ | "secretAccessKey";
11
+ export type RedactInput<A> = A extends unknown
12
+ ? {
13
+ readonly [K in keyof A]: K extends SecretField
14
+ ? Redacted.Redacted<string> | Exclude<A[K], string>
15
+ : K extends "url"
16
+ ? A[K] | Redacted.Redacted<string>
17
+ : A[K];
18
+ }
19
+ : never;
20
+ export type ReadonlyDeep<A> = A extends object
21
+ ? { readonly [K in keyof A]: ReadonlyDeep<A[K]> }
22
+ : A;
23
+
24
+ const Status = Schema.Union([
25
+ Schema.Struct({
26
+ type: Schema.Literals(["pending", "restarting", "active", "deleting"]),
27
+ }),
28
+ Schema.Struct({ type: Schema.Literal("failed"), reason: Schema.String }),
29
+ ]);
30
+ export const Topics = [
31
+ "verification",
32
+ "console",
33
+ "function_execution",
34
+ "exception",
35
+ "audit_log",
36
+ "scheduler_stats",
37
+ "scheduled_job_lag",
38
+ "current_storage_usage",
39
+ "concurrency_stats",
40
+ "storage_api_bandwidth",
41
+ "ai_gateway_usage",
42
+ "log_stream_egress",
43
+ "custom_audit",
44
+ ] as const;
45
+ const TopicSelection = Schema.Array(Schema.Literals(Topics)).pipe(
46
+ Schema.NullOr,
47
+ Schema.optionalKey,
48
+ );
49
+ const optionalString = Schema.String.pipe(Schema.NullOr, Schema.optionalKey);
50
+ const Tags = Schema.Record(Schema.String, Schema.String).pipe(
51
+ Schema.NullOr,
52
+ Schema.optionalKey,
53
+ );
54
+ // IDs enter recovery errors, so reject response text outside this bounded alphabet.
55
+ const Id = Schema.String.check(Schema.isPattern(/^[A-Za-z0-9_+/-]{1,128}$/));
56
+ const base = { id: Id, status: Status };
57
+ const Inclusion = Schema.Literals(["included", "excluded"]);
58
+ const TableSelection = Schema.Union([
59
+ Schema.Literal("excluded"),
60
+ Schema.StructWithRest(Schema.Struct({ _other: Inclusion }), [
61
+ Schema.Record(Schema.String, Inclusion),
62
+ ]),
63
+ ]);
64
+ const ComponentSelection = Schema.Union([
65
+ Schema.Literal("excluded"),
66
+ Schema.StructWithRest(Schema.Struct({ _other: Inclusion }), [
67
+ Schema.Record(Schema.String, TableSelection),
68
+ ]),
69
+ ]);
70
+ const Selection = Schema.StructWithRest(Schema.Struct({ _other: Inclusion }), [
71
+ Schema.Record(Schema.String, ComponentSelection),
72
+ ]);
73
+
74
+ export const Config = Schema.Union([
75
+ Schema.Struct({
76
+ ...base,
77
+ logStreamType: Schema.Literal("datadog"),
78
+ siteLocation: Schema.Literals([
79
+ "US1",
80
+ "US3",
81
+ "US5",
82
+ "EU",
83
+ "US1_FED",
84
+ "AP1",
85
+ ]),
86
+ ddTags: Schema.Array(Schema.String),
87
+ service: optionalString,
88
+ topics: TopicSelection,
89
+ }),
90
+ Schema.Struct({
91
+ ...base,
92
+ logStreamType: Schema.Literal("webhook"),
93
+ url: Schema.String,
94
+ format: Schema.Literals(["json", "jsonl"]),
95
+ hmacSecret: Schema.String,
96
+ topics: TopicSelection,
97
+ }),
98
+ Schema.Struct({
99
+ ...base,
100
+ logStreamType: Schema.Literal("axiom"),
101
+ datasetName: Schema.String,
102
+ attributes: Schema.Array(
103
+ Schema.Struct({ key: Schema.String, value: Schema.String }),
104
+ ),
105
+ ingestUrl: optionalString,
106
+ topics: TopicSelection,
107
+ }),
108
+ Schema.Struct({
109
+ ...base,
110
+ logStreamType: Schema.Literal("sentry"),
111
+ tags: Tags,
112
+ }),
113
+ Schema.Struct({
114
+ ...base,
115
+ logStreamType: Schema.Literal("postHogLogs"),
116
+ host: optionalString,
117
+ serviceName: optionalString,
118
+ topics: TopicSelection,
119
+ }),
120
+ Schema.Struct({
121
+ ...base,
122
+ logStreamType: Schema.Literal("postHogErrorTracking"),
123
+ host: optionalString,
124
+ }),
125
+ Schema.Struct({
126
+ ...base,
127
+ logStreamType: Schema.Literal("s3Export"),
128
+ bucket: Schema.String,
129
+ region: Schema.String,
130
+ prefix: optionalString,
131
+ accessKeyId: Schema.String,
132
+ period: Schema.Literals(["continuous", "hourly", "daily"]),
133
+ selection: Selection,
134
+ }),
135
+ ]) satisfies Schema.Schema<ReadonlyDeep<DeploymentApi.LogStreamConfig>>;
136
+
137
+ export const Created = Schema.Union([
138
+ Schema.Struct({
139
+ logStreamType: Schema.Literal("webhook"),
140
+ id: Id,
141
+ hmacSecret: Schema.String,
142
+ }),
143
+ Schema.Struct({
144
+ logStreamType: Schema.Literals([
145
+ "datadog",
146
+ "axiom",
147
+ "sentry",
148
+ "postHogLogs",
149
+ "postHogErrorTracking",
150
+ "s3Export",
151
+ ]),
152
+ id: Id,
153
+ }),
154
+ ]) satisfies Schema.Schema<ReadonlyDeep<DeploymentApi.CreateLogStreamResponse>>;