@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.
- package/dist/Convex.d.ts +1 -0
- package/dist/Convex.d.ts.map +1 -1
- package/dist/Convex.js +3 -1
- package/dist/Convex.js.map +1 -1
- package/dist/ConvexClient.d.ts +17 -0
- package/dist/ConvexClient.d.ts.map +1 -1
- package/dist/ConvexClient.js +28 -0
- package/dist/ConvexClient.js.map +1 -1
- package/dist/LogStream.d.ts +134 -0
- package/dist/LogStream.d.ts.map +1 -0
- package/dist/LogStream.js +324 -0
- package/dist/LogStream.js.map +1 -0
- package/dist/Providers.d.ts.map +1 -1
- package/dist/Providers.js +11 -6
- package/dist/Providers.js.map +1 -1
- package/dist/internal/LogStream.d.ts +115 -0
- package/dist/internal/LogStream.d.ts.map +1 -0
- package/dist/internal/LogStream.js +123 -0
- package/dist/internal/LogStream.js.map +1 -0
- package/package.json +3 -3
- package/src/Convex.ts +5 -0
- package/src/ConvexClient.ts +92 -0
- package/src/LogStream.ts +662 -0
- package/src/Providers.ts +6 -0
- package/src/internal/LogStream.ts +154 -0
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { ConvexClient, layer as layer$1 } from "./ConvexClient.js";
|
|
2
|
+
import { checkpointCreate } from "./internal/Lifecycle.js";
|
|
3
|
+
import { Topics } from "./internal/LogStream.js";
|
|
4
|
+
import * as Output from "alchemy/Output";
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
6
|
+
import * as Provider from "alchemy/Provider";
|
|
7
|
+
import { Resource } from "alchemy/Resource";
|
|
8
|
+
import * as Layer from "effect/Layer";
|
|
9
|
+
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
10
|
+
import * as Redacted from "effect/Redacted";
|
|
11
|
+
import * as Schema from "effect/Schema";
|
|
12
|
+
import * as Option from "effect/Option";
|
|
13
|
+
import * as Array from "effect/Array";
|
|
14
|
+
import * as Record from "effect/Record";
|
|
15
|
+
import * as Result from "effect/Result";
|
|
16
|
+
import { deepEqual, isResolved } from "alchemy/Diff";
|
|
17
|
+
import * as Effectable from "effect/Effectable";
|
|
18
|
+
import { Stack } from "alchemy/Stack";
|
|
19
|
+
import { State } from "alchemy/State/State";
|
|
20
|
+
// src/LogStream.ts
|
|
21
|
+
const logStream = Resource("Convex.LogStream");
|
|
22
|
+
const LogStream = Object.assign(new Proxy(logStream, { apply: (target, _this, args) => {
|
|
23
|
+
if (args.length === 1) return Object.assign(LogStream, args[0]);
|
|
24
|
+
const [id, props] = args;
|
|
25
|
+
return target(id, (Effect.isEffect(props) ? props : Effect.succeed(props)).pipe(Effect.flatMap(checkedProps)));
|
|
26
|
+
} }), Effectable.Prototype({
|
|
27
|
+
label: "Resource<Convex.LogStream>",
|
|
28
|
+
evaluate: () => Effect.succeed(LogStream)
|
|
29
|
+
}));
|
|
30
|
+
var LogStreamNotEnabled = class extends Schema.TaggedError()("LogStreamNotEnabled", {
|
|
31
|
+
kind: Schema.String,
|
|
32
|
+
message: Schema.String
|
|
33
|
+
}) {};
|
|
34
|
+
var LogStreamRecoveryRequired = class extends Schema.TaggedError()("LogStreamRecoveryRequired", {
|
|
35
|
+
kind: Schema.String,
|
|
36
|
+
ids: Schema.Array(Schema.String),
|
|
37
|
+
message: Schema.String
|
|
38
|
+
}) {};
|
|
39
|
+
var LogStreamDrift = class extends Schema.TaggedError()("LogStreamDrift", {
|
|
40
|
+
id: Schema.String,
|
|
41
|
+
kind: Schema.String,
|
|
42
|
+
message: Schema.String
|
|
43
|
+
}) {};
|
|
44
|
+
var LogStreamInvalidUrl = class extends Schema.TaggedError()("LogStreamInvalidUrl", { message: Schema.String }) {};
|
|
45
|
+
var LogStreamUrlRequiresRedacted = class extends Schema.TaggedError()("LogStreamUrlRequiresRedacted", { message: Schema.String }) {};
|
|
46
|
+
var LogStreamEmptyTopics = class extends Schema.TaggedError()("LogStreamEmptyTopics", {
|
|
47
|
+
kind: Schema.String,
|
|
48
|
+
message: Schema.String
|
|
49
|
+
}) {};
|
|
50
|
+
const validateTopics = (kind, topics) => Array.isArray(topics) && topics.length === 0 ? Result.fail(LogStreamEmptyTopics.make({
|
|
51
|
+
kind,
|
|
52
|
+
message: "Select at least one log topic or omit topics to subscribe to all topics."
|
|
53
|
+
})) : Result.succeed(void 0);
|
|
54
|
+
const parseUrl = (value) => Result.try({
|
|
55
|
+
try: () => new URL(value),
|
|
56
|
+
catch: () => LogStreamInvalidUrl.make({ message: "The log stream URL could not be parsed. Supply an absolute URL." })
|
|
57
|
+
});
|
|
58
|
+
const normalizeUrl = (value) => parseUrl(value).pipe(Result.map((url) => url.href));
|
|
59
|
+
const validateWebhookUrl = (value) => parseUrl(Redacted.isRedacted(value) ? Redacted.value(value) : value).pipe(Result.flatMap((url) => !Redacted.isRedacted(value) && (url.username !== "" || url.password !== "") ? Result.fail(LogStreamUrlRequiresRedacted.make({ message: "The webhook URL contains credentials. Pass the URL as Redacted to keep credentials out of plans and state." })) : Result.succeed(void 0)));
|
|
60
|
+
const checkedProps = (options) => Effect.gen(function* () {
|
|
61
|
+
if ((options.kind === "axiom" || options.kind === "webhook") && "topics" in options) yield* Effect.fromResult(validateTopics(options.kind, options.topics)).pipe(Effect.orDie);
|
|
62
|
+
return "url" in options && Output.isOutput(options.url) ? {
|
|
63
|
+
...options,
|
|
64
|
+
url: options.url.pipe(Output.mapEffect((value) => value === void 0 ? Effect.succeed(value) : Effect.fromResult(validateWebhookUrl(value)).pipe(Effect.orDie, Effect.as(value))))
|
|
65
|
+
} : options;
|
|
66
|
+
});
|
|
67
|
+
const normalizeTopics = (topics) => topics == null ? topics : Array.filter(Topics, (topic) => Array.contains(topics, topic));
|
|
68
|
+
const input = (props) => {
|
|
69
|
+
if ("topics" in props) {
|
|
70
|
+
const result = validateTopics(props.kind, props.topics);
|
|
71
|
+
if (Result.isFailure(result)) return Effect.fail(result.failure);
|
|
72
|
+
}
|
|
73
|
+
switch (props.kind) {
|
|
74
|
+
case "axiom": return Effect.succeed({
|
|
75
|
+
logStreamType: props.kind,
|
|
76
|
+
apiKey: props.apiKey,
|
|
77
|
+
datasetName: props.datasetName,
|
|
78
|
+
attributes: props.attributes,
|
|
79
|
+
ingestUrl: props.ingestUrl ?? null,
|
|
80
|
+
topics: props.topics ?? null
|
|
81
|
+
});
|
|
82
|
+
case "sentry": return Effect.succeed({
|
|
83
|
+
logStreamType: props.kind,
|
|
84
|
+
dsn: props.dsn,
|
|
85
|
+
tags: props.tags ?? null
|
|
86
|
+
});
|
|
87
|
+
case "webhook": return Effect.fromResult(validateWebhookUrl(props.url)).pipe(Effect.as({
|
|
88
|
+
logStreamType: props.kind,
|
|
89
|
+
url: props.url,
|
|
90
|
+
format: props.format,
|
|
91
|
+
topics: props.topics ?? null
|
|
92
|
+
}));
|
|
93
|
+
case "datadog":
|
|
94
|
+
case "postHogLogs":
|
|
95
|
+
case "postHogErrorTracking":
|
|
96
|
+
case "s3Export": return Effect.fail(LogStreamNotEnabled.make({
|
|
97
|
+
kind: props.kind,
|
|
98
|
+
message: "This log stream kind is not switched on."
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
const recover = (kind, ids, reason) => LogStreamRecoveryRequired.make({
|
|
103
|
+
kind,
|
|
104
|
+
ids,
|
|
105
|
+
message: `${reason} Fix the stream or ownership record manually before continuing.`
|
|
106
|
+
});
|
|
107
|
+
const identify = Effect.fn("LogStream.identify")(function* (output, live) {
|
|
108
|
+
const config = Redacted.value(live);
|
|
109
|
+
if (config.id !== output.id || config.logStreamType !== output.kind) return yield* recover(output.kind, [output.id], "The response identifies a different log stream.");
|
|
110
|
+
});
|
|
111
|
+
const drift = (output) => LogStreamDrift.make({
|
|
112
|
+
id: output.id,
|
|
113
|
+
kind: output.kind,
|
|
114
|
+
message: "Readable log stream fields differ from the previous and desired configuration. An earlier update may not have finished. If so, apply that same change again before changing or reverting it. If the stream was edited outside the stack, restore those fields or change the stack to match."
|
|
115
|
+
});
|
|
116
|
+
const readable = (config) => {
|
|
117
|
+
switch (config.logStreamType) {
|
|
118
|
+
case "axiom": {
|
|
119
|
+
const base = {
|
|
120
|
+
logStreamType: config.logStreamType,
|
|
121
|
+
datasetName: config.datasetName,
|
|
122
|
+
attributes: config.attributes,
|
|
123
|
+
topics: normalizeTopics(config.topics)
|
|
124
|
+
};
|
|
125
|
+
return config.ingestUrl == null ? Result.succeed({
|
|
126
|
+
...base,
|
|
127
|
+
...config.ingestUrl === void 0 ? {} : { ingestUrl: null }
|
|
128
|
+
}) : Result.map(normalizeUrl(config.ingestUrl), (ingestUrl) => ({
|
|
129
|
+
...base,
|
|
130
|
+
ingestUrl
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
133
|
+
case "sentry": return Result.succeed({
|
|
134
|
+
logStreamType: config.logStreamType,
|
|
135
|
+
...config.tags === void 0 ? {} : { tags: config.tags }
|
|
136
|
+
});
|
|
137
|
+
case "webhook": return Result.map(normalizeUrl(Redacted.isRedacted(config.url) ? Redacted.value(config.url) : config.url), (url) => ({
|
|
138
|
+
logStreamType: config.logStreamType,
|
|
139
|
+
url,
|
|
140
|
+
format: config.format,
|
|
141
|
+
topics: normalizeTopics(config.topics)
|
|
142
|
+
}));
|
|
143
|
+
default: return Result.succeed({ logStreamType: config.logStreamType });
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
const differences = Effect.fn("LogStream.differences")(function* (props, live) {
|
|
147
|
+
const desired = yield* input(props);
|
|
148
|
+
const expected = yield* Effect.fromResult(readable(desired));
|
|
149
|
+
const actual = yield* live.pipe(Redacted.value, readable, Effect.fromResult);
|
|
150
|
+
return Array.filter(Array.dedupe([...Record.keys(expected), ...Record.keys(actual)]), (key) => !deepEqual({ value: expected[key] }, { value: actual[key] }, { stripNullish: true }));
|
|
151
|
+
});
|
|
152
|
+
const validate = Effect.fn("LogStream.validate")(function* (props, output, live) {
|
|
153
|
+
yield* identify(output, live);
|
|
154
|
+
if ((yield* differences(props, live)).length > 0) return yield* drift(output);
|
|
155
|
+
});
|
|
156
|
+
const resourceState = Effect.fn("LogStream.resourceState")(function* (fqn, instanceId) {
|
|
157
|
+
const stack = yield* Effect.serviceOption(Stack);
|
|
158
|
+
const state = yield* Effect.serviceOption(State);
|
|
159
|
+
if (Option.isNone(stack) || Option.isNone(state)) return;
|
|
160
|
+
const row = yield* (yield* state.value).get({
|
|
161
|
+
stack: stack.value.name,
|
|
162
|
+
stage: stack.value.stage,
|
|
163
|
+
fqn
|
|
164
|
+
});
|
|
165
|
+
return row !== void 0 && row.kind !== "action" && row.instanceId === instanceId ? row : void 0;
|
|
166
|
+
});
|
|
167
|
+
const attributes = (live) => {
|
|
168
|
+
const config = Redacted.value(live);
|
|
169
|
+
return config.logStreamType === "webhook" ? { hmacSecret: Redacted.make(config.hmacSecret) } : {};
|
|
170
|
+
};
|
|
171
|
+
const provider = Effect.gen(function* () {
|
|
172
|
+
const client = yield* ConvexClient;
|
|
173
|
+
const get = Effect.fn("LogStream.get")(function* (props, id) {
|
|
174
|
+
return yield* client.getLogStream(props.deploymentUrl, props.deployKey, id).pipe(Effect.catchTag("ConvexNotFound", () => Effect.void));
|
|
175
|
+
});
|
|
176
|
+
const observe = Effect.fn("LogStream.observe")(function* (props, output) {
|
|
177
|
+
const live = yield* get(props, output.id);
|
|
178
|
+
if (live === void 0) return yield* recover(output.kind, [output.id], "The recorded log stream was deleted.");
|
|
179
|
+
yield* identify(output, live);
|
|
180
|
+
return live;
|
|
181
|
+
});
|
|
182
|
+
const cold = Effect.fn("LogStream.cold")(function* (props) {
|
|
183
|
+
yield* input(props);
|
|
184
|
+
const streams = yield* client.listLogStreams(props.deploymentUrl, props.deployKey);
|
|
185
|
+
const matches = Array.filter(streams, (stream) => Redacted.value(stream).logStreamType === props.kind && Redacted.value(stream).status.type !== "deleting");
|
|
186
|
+
if (matches.length > 0) return yield* recover(props.kind, Array.map(matches, (stream) => Redacted.value(stream).id), "A stream of this kind exists without an ownership record. Another resource in this stack may already manage this kind. A backend holds one stream per kind.");
|
|
187
|
+
return streams;
|
|
188
|
+
});
|
|
189
|
+
return {
|
|
190
|
+
diff: Effect.fn("LogStream.diff")(function* ({ fqn, instanceId, olds, news, output }) {
|
|
191
|
+
const kind = "kind" in news ? news.kind : void 0;
|
|
192
|
+
switch (kind) {
|
|
193
|
+
case "datadog":
|
|
194
|
+
case "postHogLogs":
|
|
195
|
+
case "postHogErrorTracking":
|
|
196
|
+
case "s3Export": return yield* LogStreamNotEnabled.make({
|
|
197
|
+
kind,
|
|
198
|
+
message: "This log stream kind is not switched on."
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
if (kind === "webhook" && "url" in news && typeof news.url === "string") yield* Effect.fromResult(validateWebhookUrl(news.url));
|
|
202
|
+
if ((kind === "axiom" || kind === "webhook") && "topics" in news) yield* Effect.fromResult(validateTopics(kind, news.topics));
|
|
203
|
+
const live = output === void 0 ? void 0 : yield* observe(olds, output);
|
|
204
|
+
const changed = live === void 0 ? [] : yield* differences(olds, live);
|
|
205
|
+
if (!isResolved(news)) {
|
|
206
|
+
if (changed.length > 0) {
|
|
207
|
+
yield* Effect.logWarning(`Log stream ${output?.id} differs in fields ${Array.join(changed, ", ")}. Apply will check for an unfinished update or an external edit.`);
|
|
208
|
+
return { action: "update" };
|
|
209
|
+
}
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
yield* input(news);
|
|
213
|
+
if (output === void 0) {
|
|
214
|
+
yield* cold(news);
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
if (news.kind !== output.kind || news.deploymentUrl !== olds.deploymentUrl) {
|
|
218
|
+
yield* cold(news);
|
|
219
|
+
return { action: "replace" };
|
|
220
|
+
}
|
|
221
|
+
const row = yield* resourceState(fqn, instanceId);
|
|
222
|
+
const clean = row?.status === "created" || row?.status === "updated";
|
|
223
|
+
if (changed.length > 0 && live !== void 0) {
|
|
224
|
+
if ((yield* differences(news, live)).length > 0 && clean) return yield* drift(output);
|
|
225
|
+
yield* Effect.logWarning(`Log stream ${output.id} differs in fields ${Array.join(changed, ", ")}. Apply will check for an unfinished update or an external edit.`);
|
|
226
|
+
return { action: "update" };
|
|
227
|
+
}
|
|
228
|
+
if (news.kind !== "webhook" && row !== void 0 && !clean || !deepEqual(news, olds) || live !== void 0 && !deepEqual(attributes(live).hmacSecret, output.hmacSecret)) return { action: "update" };
|
|
229
|
+
}),
|
|
230
|
+
read: Effect.fn("LogStream.read")(function* ({ olds, output }) {
|
|
231
|
+
if (output !== void 0) {
|
|
232
|
+
const live = yield* observe(olds, output);
|
|
233
|
+
yield* validate(olds, output, live);
|
|
234
|
+
return {
|
|
235
|
+
id: output.id,
|
|
236
|
+
kind: output.kind,
|
|
237
|
+
...attributes(live)
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
if (isResolved(olds)) yield* cold(olds);
|
|
241
|
+
}),
|
|
242
|
+
reconcile: Effect.fn("LogStream.reconcile")(function* ({ fqn, instanceId, news, olds, output }) {
|
|
243
|
+
const config = yield* input(news);
|
|
244
|
+
if (output !== void 0) {
|
|
245
|
+
if (olds === void 0) {
|
|
246
|
+
const row = yield* resourceState(fqn, instanceId);
|
|
247
|
+
if (row?.status === "creating" && row.attr?.id === output.id && row.attr?.kind === output.kind && row.props.deploymentUrl === news.deploymentUrl && news.kind === output.kind) {
|
|
248
|
+
const live = yield* observe(news, output);
|
|
249
|
+
yield* validate(news, output, live);
|
|
250
|
+
return {
|
|
251
|
+
id: output.id,
|
|
252
|
+
kind: output.kind,
|
|
253
|
+
...attributes(live)
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
return yield* recover(output.kind, [output.id], "The prior ownership props are missing.");
|
|
257
|
+
}
|
|
258
|
+
const observed = yield* observe(olds, output);
|
|
259
|
+
if (news.kind !== output.kind || news.deploymentUrl !== olds.deploymentUrl) return yield* recover(output.kind, [output.id], "A kind or deployment change needs replacement.");
|
|
260
|
+
const desiredChanges = yield* differences(news, observed);
|
|
261
|
+
if (desiredChanges.length > 0 && (yield* differences(olds, observed)).length > 0) return yield* drift(output);
|
|
262
|
+
if (news.kind === "webhook" && desiredChanges.length === 0) return {
|
|
263
|
+
id: output.id,
|
|
264
|
+
kind: output.kind,
|
|
265
|
+
...attributes(observed)
|
|
266
|
+
};
|
|
267
|
+
yield* client.updateLogStream(news.deploymentUrl, news.deployKey, output.id, config);
|
|
268
|
+
const live = yield* get(news, output.id);
|
|
269
|
+
if (live === void 0) return yield* recover(news.kind, [output.id], "Update succeeded but the stream could not be read.");
|
|
270
|
+
const updated = {
|
|
271
|
+
id: output.id,
|
|
272
|
+
kind: output.kind,
|
|
273
|
+
...attributes(live)
|
|
274
|
+
};
|
|
275
|
+
yield* validate(news, updated, live);
|
|
276
|
+
return updated;
|
|
277
|
+
}
|
|
278
|
+
yield* cold(news);
|
|
279
|
+
yield* checkpointCreate(fqn, instanceId, news);
|
|
280
|
+
const response = yield* client.createLogStream(news.deploymentUrl, news.deployKey, config).pipe(Effect.catchTag("ConvexConflict", () => Effect.gen(function* () {
|
|
281
|
+
const streams = yield* cold(news);
|
|
282
|
+
const deleting = Array.filter(streams, (stream) => {
|
|
283
|
+
const live = Redacted.value(stream);
|
|
284
|
+
return live.logStreamType === news.kind && live.status.type === "deleting";
|
|
285
|
+
});
|
|
286
|
+
if (deleting.length > 0) return yield* LogStreamRecoveryRequired.make({
|
|
287
|
+
kind: news.kind,
|
|
288
|
+
ids: Array.map(deleting, (stream) => Redacted.value(stream).id),
|
|
289
|
+
message: "A stream of this kind is still deleting. Run the deploy again once deletion finishes."
|
|
290
|
+
});
|
|
291
|
+
return yield* recover(news.kind, [], "A concurrent create conflicted with this stream.");
|
|
292
|
+
})));
|
|
293
|
+
const created = Redacted.value(response);
|
|
294
|
+
const owned = {
|
|
295
|
+
id: created.id,
|
|
296
|
+
kind: news.kind,
|
|
297
|
+
...created.logStreamType === "webhook" ? { hmacSecret: Redacted.make(created.hmacSecret) } : {}
|
|
298
|
+
};
|
|
299
|
+
yield* checkpointCreate(fqn, instanceId, news, owned);
|
|
300
|
+
if (created.logStreamType !== news.kind) return yield* recover(news.kind, [created.id], "Create returned a different stream kind.");
|
|
301
|
+
const live = yield* get(news, created.id);
|
|
302
|
+
if (live === void 0) return yield* recover(news.kind, [created.id], "Create succeeded but the stream could not be read.");
|
|
303
|
+
const createdOutput = {
|
|
304
|
+
id: created.id,
|
|
305
|
+
kind: news.kind,
|
|
306
|
+
...attributes(live)
|
|
307
|
+
};
|
|
308
|
+
yield* validate(news, createdOutput, live);
|
|
309
|
+
yield* checkpointCreate(fqn, instanceId, news, createdOutput);
|
|
310
|
+
return createdOutput;
|
|
311
|
+
}),
|
|
312
|
+
delete: Effect.fn("LogStream.delete")(function* ({ olds, output }) {
|
|
313
|
+
const live = yield* get(olds, output.id);
|
|
314
|
+
if (live === void 0) return;
|
|
315
|
+
yield* identify(output, live);
|
|
316
|
+
yield* client.deleteLogStream(olds.deploymentUrl, olds.deployKey, output.id).pipe(Effect.catchTag("ConvexNotFound", () => Effect.void));
|
|
317
|
+
})
|
|
318
|
+
};
|
|
319
|
+
});
|
|
320
|
+
const layer = Provider.effect(LogStream, provider);
|
|
321
|
+
const localLayer = Provider.effect(LogStream, provider).pipe(Layer.provide(layer$1({ mode: "local" }).pipe(Layer.provide(FetchHttpClient.layer))));
|
|
322
|
+
export { LogStream, LogStreamDrift, LogStreamEmptyTopics, LogStreamInvalidUrl, LogStreamNotEnabled, LogStreamRecoveryRequired, LogStreamUrlRequiresRedacted, layer, localLayer, provider };
|
|
323
|
+
|
|
324
|
+
//# sourceMappingURL=LogStream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogStream.js","names":["ConvexClient.ConvexClient","ConvexClient.layer"],"sources":["../src/LogStream.ts"],"sourcesContent":["import { deepEqual, isResolved } from \"alchemy/Diff\";\nimport type { InputProps } from \"alchemy/Input\";\nimport * as Output from \"alchemy/Output\";\nimport * as Array from \"effect/Array\";\nimport * as Provider from \"alchemy/Provider\";\nimport {\n Resource,\n type ResourceClass,\n type ResourceConstructor,\n} from \"alchemy/Resource\";\nimport { Stack } from \"alchemy/Stack\";\nimport { State } from \"alchemy/State/State\";\nimport * as Effect from \"effect/Effect\";\nimport * as Effectable from \"effect/Effectable\";\nimport * as Layer from \"effect/Layer\";\nimport * as Option from \"effect/Option\";\nimport * as Redacted from \"effect/Redacted\";\nimport * as Record from \"effect/Record\";\nimport * as Result from \"effect/Result\";\nimport * as Schema from \"effect/Schema\";\nimport * as FetchHttpClient from \"effect/http/FetchHttpClient\";\n\nimport * as ConvexClient from \"./ConvexClient.js\";\nimport type { Providers } from \"./Providers.js\";\nimport { checkpointCreate } from \"./internal/Lifecycle.js\";\nimport { Topics, type Config as LiveConfig } from \"./internal/LogStream.js\";\n\ntype Config<A = ConvexClient.CreateLogStreamInput> = A extends {\n readonly logStreamType: infer K;\n}\n ? { readonly kind: K } & Omit<A, \"logStreamType\">\n : never;\ntype Keys<A> = A extends unknown ? keyof A : never;\ntype StrictUnion<A, All = A> = A extends unknown\n ? A & { readonly [K in Exclude<Keys<All>, keyof A>]?: never }\n : never;\ntype NonEmptySelection<A> = A extends readonly (infer T)[]\n ? readonly [T, ...T[]]\n : A;\ntype NonEmptyTopics<A> = {\n readonly [K in keyof A]: K extends \"topics\" ? NonEmptySelection<A[K]> : A[K];\n};\n\nexport type LogStreamProps = StrictUnion<\n NonEmptyTopics<\n Extract<Config, { readonly kind: \"axiom\" | \"sentry\" | \"webhook\" }>\n >\n> & {\n readonly deploymentUrl: string;\n readonly deployKey: Redacted.Redacted<string>;\n};\n\nexport interface LogStreamAttributes {\n readonly id: string;\n readonly kind: LogStreamProps[\"kind\"];\n readonly hmacSecret?: Redacted.Redacted<string>;\n}\n\nexport type LogStream = Resource<\n \"Convex.LogStream\",\n LogStreamProps,\n LogStreamAttributes,\n never,\n Providers\n>;\nconst logStream = Resource<LogStream>(\"Convex.LogStream\");\n\n// Validate topics and computed URLs before Alchemy checkpoints props.\nexport const LogStream: ResourceClass<LogStream> = Object.assign(\n new Proxy(logStream, {\n apply: <PropsReq>(\n target: ResourceClass<LogStream>,\n _this: unknown,\n args:\n | [methods: object]\n | [\n id: string,\n props:\n | InputProps<LogStreamProps>\n | Effect.Effect<InputProps<LogStreamProps>, never, PropsReq>,\n ],\n ) => {\n if (args.length === 1) return Object.assign(LogStream, args[0]);\n const [id, props] = args;\n return target(\n id,\n (Effect.isEffect(props) ? props : Effect.succeed(props)).pipe(\n Effect.flatMap(checkedProps),\n ),\n );\n },\n }),\n Effectable.Prototype<Effect.Effect<ResourceConstructor<LogStream>>>({\n label: \"Resource<Convex.LogStream>\",\n evaluate: () => Effect.succeed(LogStream),\n }),\n);\n\nexport class LogStreamNotEnabled extends Schema.TaggedError<\n LogStreamNotEnabled,\n { readonly brand: unique symbol }\n>()(\"LogStreamNotEnabled\", {\n kind: Schema.String,\n message: Schema.String,\n}) {}\n\nexport class LogStreamRecoveryRequired extends Schema.TaggedError<\n LogStreamRecoveryRequired,\n { readonly brand: unique symbol }\n>()(\"LogStreamRecoveryRequired\", {\n kind: Schema.String,\n ids: Schema.Array(Schema.String),\n message: Schema.String,\n}) {}\n\nexport class LogStreamDrift extends Schema.TaggedError<\n LogStreamDrift,\n { readonly brand: unique symbol }\n>()(\"LogStreamDrift\", {\n id: Schema.String,\n kind: Schema.String,\n message: Schema.String,\n}) {}\n\nexport class LogStreamInvalidUrl extends Schema.TaggedError<\n LogStreamInvalidUrl,\n { readonly brand: unique symbol }\n>()(\"LogStreamInvalidUrl\", { message: Schema.String }) {}\n\nexport class LogStreamUrlRequiresRedacted extends Schema.TaggedError<\n LogStreamUrlRequiresRedacted,\n { readonly brand: unique symbol }\n>()(\"LogStreamUrlRequiresRedacted\", { message: Schema.String }) {}\n\nexport class LogStreamEmptyTopics extends Schema.TaggedError<\n LogStreamEmptyTopics,\n { readonly brand: unique symbol }\n>()(\"LogStreamEmptyTopics\", {\n kind: Schema.String,\n message: Schema.String,\n}) {}\n\nconst validateTopics = (kind: string, topics: unknown) =>\n Array.isArray(topics) && topics.length === 0\n ? Result.fail(\n LogStreamEmptyTopics.make({\n kind,\n message:\n \"Select at least one log topic or omit topics to subscribe to all topics.\",\n }),\n )\n : Result.succeed(undefined);\n\nconst parseUrl = (value: string) =>\n Result.try({\n try: () => new URL(value),\n catch: () =>\n LogStreamInvalidUrl.make({\n message:\n \"The log stream URL could not be parsed. Supply an absolute URL.\",\n }),\n });\n\nconst normalizeUrl = (value: string) =>\n parseUrl(value).pipe(Result.map((url) => url.href));\n\nconst validateWebhookUrl = (value: string | Redacted.Redacted<string>) =>\n parseUrl(Redacted.isRedacted(value) ? Redacted.value(value) : value).pipe(\n Result.flatMap((url) =>\n !Redacted.isRedacted(value) &&\n (url.username !== \"\" || url.password !== \"\")\n ? Result.fail(\n LogStreamUrlRequiresRedacted.make({\n message:\n \"The webhook URL contains credentials. Pass the URL as Redacted to keep credentials out of plans and state.\",\n }),\n )\n : Result.succeed(undefined),\n ),\n );\n\ntype WebhookUrl = Extract<LogStreamProps, { readonly kind: \"webhook\" }>[\"url\"];\nconst checkedProps = <P extends InputProps<LogStreamProps>>(\n options: P,\n): Effect.Effect<P> =>\n Effect.gen(function* () {\n if (\n (options.kind === \"axiom\" || options.kind === \"webhook\") &&\n \"topics\" in options\n )\n yield* Effect.fromResult(\n validateTopics(options.kind, options.topics),\n ).pipe(Effect.orDie);\n return \"url\" in options && Output.isOutput(options.url)\n ? {\n ...options,\n url: options.url.pipe(\n Output.mapEffect((value: WebhookUrl | undefined) =>\n value === undefined\n ? Effect.succeed(value)\n : Effect.fromResult(validateWebhookUrl(value)).pipe(\n Effect.orDie,\n Effect.as(value),\n ),\n ),\n ),\n }\n : options;\n });\n\nconst normalizeTopics = (\n topics: readonly (typeof Topics)[number][] | null | undefined,\n) =>\n topics == null\n ? topics\n : Array.filter(Topics, (topic) => Array.contains(topics, topic));\n\nconst input = (props: Config) => {\n if (\"topics\" in props) {\n const result = validateTopics(props.kind, props.topics);\n if (Result.isFailure(result)) return Effect.fail(result.failure);\n }\n switch (props.kind) {\n case \"axiom\":\n return Effect.succeed({\n logStreamType: props.kind,\n apiKey: props.apiKey,\n datasetName: props.datasetName,\n attributes: props.attributes,\n ingestUrl: props.ingestUrl ?? null,\n topics: props.topics ?? null,\n });\n case \"sentry\":\n return Effect.succeed({\n logStreamType: props.kind,\n dsn: props.dsn,\n tags: props.tags ?? null,\n });\n case \"webhook\":\n return Effect.fromResult(validateWebhookUrl(props.url)).pipe(\n Effect.as({\n logStreamType: props.kind,\n url: props.url,\n format: props.format,\n topics: props.topics ?? null,\n }),\n );\n case \"datadog\":\n case \"postHogLogs\":\n case \"postHogErrorTracking\":\n case \"s3Export\":\n return Effect.fail(\n LogStreamNotEnabled.make({\n kind: props.kind,\n message: \"This log stream kind is not switched on.\",\n }),\n );\n }\n};\n\nconst recover = (\n kind: LogStreamProps[\"kind\"],\n ids: readonly string[],\n reason: string,\n) =>\n LogStreamRecoveryRequired.make({\n kind,\n ids,\n message: `${reason} Fix the stream or ownership record manually before continuing.`,\n });\n\nconst identify = Effect.fn(\"LogStream.identify\")(function* (\n output: LogStreamAttributes,\n live: ConvexClient.LogStreamConfig,\n) {\n const config = Redacted.value(live);\n if (config.id !== output.id || config.logStreamType !== output.kind)\n return yield* recover(\n output.kind,\n [output.id],\n \"The response identifies a different log stream.\",\n );\n});\n\nconst drift = (output: LogStreamAttributes) =>\n LogStreamDrift.make({\n id: output.id,\n kind: output.kind,\n message:\n \"Readable log stream fields differ from the previous and desired configuration. An earlier update may not have finished. If so, apply that same change again before changing or reverting it. If the stream was edited outside the stack, restore those fields or change the stack to match.\",\n });\n\nconst readable = (\n config: Effect.Success<ReturnType<typeof input>> | typeof LiveConfig.Type,\n): Result.Result<Readonly<Record<string, unknown>>, LogStreamInvalidUrl> => {\n switch (config.logStreamType) {\n case \"axiom\": {\n const base = {\n logStreamType: config.logStreamType,\n datasetName: config.datasetName,\n attributes: config.attributes,\n topics: normalizeTopics(config.topics),\n };\n return config.ingestUrl == null\n ? Result.succeed({\n ...base,\n ...(config.ingestUrl === undefined ? {} : { ingestUrl: null }),\n })\n : Result.map(normalizeUrl(config.ingestUrl), (ingestUrl) => ({\n ...base,\n ingestUrl,\n }));\n }\n case \"sentry\":\n return Result.succeed({\n logStreamType: config.logStreamType,\n ...(config.tags === undefined ? {} : { tags: config.tags }),\n });\n case \"webhook\":\n return Result.map(\n normalizeUrl(\n Redacted.isRedacted(config.url)\n ? Redacted.value(config.url)\n : config.url,\n ),\n (url) => ({\n logStreamType: config.logStreamType,\n url,\n format: config.format,\n topics: normalizeTopics(config.topics),\n }),\n );\n default:\n return Result.succeed({ logStreamType: config.logStreamType });\n }\n};\n\nconst differences = Effect.fn(\"LogStream.differences\")(function* (\n props: LogStreamProps,\n live: ConvexClient.LogStreamConfig,\n) {\n const desired = yield* input(props);\n // Compare only fields Convex returns, excluding its generated webhook secret.\n const expected = yield* Effect.fromResult(readable(desired));\n const actual = yield* live.pipe(Redacted.value, readable, Effect.fromResult);\n return Array.filter(\n Array.dedupe([...Record.keys(expected), ...Record.keys(actual)]),\n (key) =>\n !deepEqual(\n { value: expected[key] },\n { value: actual[key] },\n { stripNullish: true },\n ),\n );\n});\n\nconst validate = Effect.fn(\"LogStream.validate\")(function* (\n props: LogStreamProps,\n output: LogStreamAttributes,\n live: ConvexClient.LogStreamConfig,\n) {\n yield* identify(output, live);\n if ((yield* differences(props, live)).length > 0) return yield* drift(output);\n});\n\nconst resourceState = Effect.fn(\"LogStream.resourceState\")(function* (\n fqn: string,\n instanceId: string,\n) {\n const stack = yield* Effect.serviceOption(Stack);\n const state = yield* Effect.serviceOption(State);\n if (Option.isNone(stack) || Option.isNone(state)) return;\n const store = yield* state.value;\n const row = yield* store.get({\n stack: stack.value.name,\n stage: stack.value.stage,\n fqn,\n });\n return row !== undefined &&\n row.kind !== \"action\" &&\n row.instanceId === instanceId\n ? row\n : undefined;\n});\n\nconst attributes = (\n live: ConvexClient.LogStreamConfig,\n): Pick<LogStreamAttributes, \"hmacSecret\"> => {\n const config = Redacted.value(live);\n return config.logStreamType === \"webhook\"\n ? { hmacSecret: Redacted.make(config.hmacSecret) }\n : {};\n};\n\nexport const provider = Effect.gen(function* () {\n const client = yield* ConvexClient.ConvexClient;\n const get = Effect.fn(\"LogStream.get\")(function* (\n props: LogStreamProps,\n id: string,\n ) {\n return yield* client\n .getLogStream(props.deploymentUrl, props.deployKey, id)\n .pipe(Effect.catchTag(\"ConvexNotFound\", () => Effect.void));\n });\n const observe = Effect.fn(\"LogStream.observe\")(function* (\n props: LogStreamProps,\n output: LogStreamAttributes,\n ) {\n const live = yield* get(props, output.id);\n if (live === undefined)\n return yield* recover(\n output.kind,\n [output.id],\n \"The recorded log stream was deleted.\",\n );\n yield* identify(output, live);\n return live;\n });\n const cold = Effect.fn(\"LogStream.cold\")(function* (props: LogStreamProps) {\n yield* input(props);\n const streams = yield* client.listLogStreams(\n props.deploymentUrl,\n props.deployKey,\n );\n const matches = Array.filter(\n streams,\n (stream) =>\n Redacted.value(stream).logStreamType === props.kind &&\n Redacted.value(stream).status.type !== \"deleting\",\n );\n if (matches.length > 0)\n return yield* recover(\n props.kind,\n Array.map(matches, (stream) => Redacted.value(stream).id),\n \"A stream of this kind exists without an ownership record. Another resource in this stack may already manage this kind. A backend holds one stream per kind.\",\n );\n return streams;\n });\n return {\n diff: Effect.fn(\"LogStream.diff\")(function* ({\n fqn,\n instanceId,\n olds,\n news,\n output,\n }) {\n const kind: unknown = \"kind\" in news ? news.kind : undefined;\n switch (kind) {\n case \"datadog\":\n case \"postHogLogs\":\n case \"postHogErrorTracking\":\n case \"s3Export\":\n return yield* LogStreamNotEnabled.make({\n kind,\n message: \"This log stream kind is not switched on.\",\n });\n }\n if (kind === \"webhook\" && \"url\" in news && typeof news.url === \"string\")\n yield* Effect.fromResult(validateWebhookUrl(news.url));\n if ((kind === \"axiom\" || kind === \"webhook\") && \"topics\" in news)\n yield* Effect.fromResult(validateTopics(kind, news.topics));\n const live =\n output === undefined ? undefined : yield* observe(olds, output);\n const changed = live === undefined ? [] : yield* differences(olds, live);\n if (!isResolved(news)) {\n if (changed.length > 0) {\n yield* Effect.logWarning(\n `Log stream ${output?.id} differs in fields ${Array.join(changed, \", \")}. Apply will check for an unfinished update or an external edit.`,\n );\n return { action: \"update\" };\n }\n return;\n }\n yield* input(news);\n if (output === undefined) {\n yield* cold(news);\n return;\n }\n if (\n news.kind !== output.kind ||\n news.deploymentUrl !== olds.deploymentUrl\n ) {\n yield* cold(news);\n return { action: \"replace\" };\n }\n const row = yield* resourceState(fqn, instanceId);\n const clean = row?.status === \"created\" || row?.status === \"updated\";\n if (changed.length > 0 && live !== undefined) {\n if ((yield* differences(news, live)).length > 0 && clean)\n return yield* drift(output);\n yield* Effect.logWarning(\n `Log stream ${output.id} differs in fields ${Array.join(changed, \", \")}. Apply will check for an unfinished update or an external edit.`,\n );\n return { action: \"update\" };\n }\n if (\n (news.kind !== \"webhook\" && row !== undefined && !clean) ||\n !deepEqual(news, olds) ||\n (live !== undefined &&\n !deepEqual(attributes(live).hmacSecret, output.hmacSecret))\n )\n return { action: \"update\" };\n }),\n read: Effect.fn(\"LogStream.read\")(function* ({ olds, output }) {\n if (output !== undefined) {\n const live = yield* observe(olds, output);\n yield* validate(olds, output, live);\n return { id: output.id, kind: output.kind, ...attributes(live) };\n }\n if (isResolved(olds)) yield* cold(olds);\n return undefined;\n }),\n reconcile: Effect.fn(\"LogStream.reconcile\")(function* ({\n fqn,\n instanceId,\n news,\n olds,\n output,\n }) {\n const config = yield* input(news);\n if (output !== undefined) {\n if (olds === undefined) {\n const row = yield* resourceState(fqn, instanceId);\n if (\n row?.status === \"creating\" &&\n row.attr?.id === output.id &&\n row.attr?.kind === output.kind &&\n row.props.deploymentUrl === news.deploymentUrl &&\n news.kind === output.kind\n ) {\n const live = yield* observe(news, output);\n yield* validate(news, output, live);\n return { id: output.id, kind: output.kind, ...attributes(live) };\n }\n return yield* recover(\n output.kind,\n [output.id],\n \"The prior ownership props are missing.\",\n );\n }\n const observed = yield* observe(olds, output);\n if (\n news.kind !== output.kind ||\n news.deploymentUrl !== olds.deploymentUrl\n )\n return yield* recover(\n output.kind,\n [output.id],\n \"A kind or deployment change needs replacement.\",\n );\n const desiredChanges = yield* differences(news, observed);\n if (\n desiredChanges.length > 0 &&\n (yield* differences(olds, observed)).length > 0\n )\n return yield* drift(output);\n if (news.kind === \"webhook\" && desiredChanges.length === 0)\n return { id: output.id, kind: output.kind, ...attributes(observed) };\n yield* client.updateLogStream(\n news.deploymentUrl,\n news.deployKey,\n output.id,\n config,\n );\n const live = yield* get(news, output.id);\n if (live === undefined)\n return yield* recover(\n news.kind,\n [output.id],\n \"Update succeeded but the stream could not be read.\",\n );\n const updated = {\n id: output.id,\n kind: output.kind,\n ...attributes(live),\n };\n yield* validate(news, updated, live);\n return updated;\n }\n yield* cold(news);\n yield* checkpointCreate(fqn, instanceId, news);\n const response = yield* client\n .createLogStream(news.deploymentUrl, news.deployKey, config)\n .pipe(\n Effect.catchTag(\"ConvexConflict\", () =>\n Effect.gen(function* () {\n const streams = yield* cold(news);\n const deleting = Array.filter(streams, (stream) => {\n const live = Redacted.value(stream);\n return (\n live.logStreamType === news.kind &&\n live.status.type === \"deleting\"\n );\n });\n if (deleting.length > 0)\n return yield* LogStreamRecoveryRequired.make({\n kind: news.kind,\n ids: Array.map(\n deleting,\n (stream) => Redacted.value(stream).id,\n ),\n message:\n \"A stream of this kind is still deleting. Run the deploy again once deletion finishes.\",\n });\n return yield* recover(\n news.kind,\n [],\n \"A concurrent create conflicted with this stream.\",\n );\n }),\n ),\n );\n const created = Redacted.value(response);\n const owned: LogStreamAttributes = {\n id: created.id,\n kind: news.kind,\n ...(created.logStreamType === \"webhook\"\n ? { hmacSecret: Redacted.make(created.hmacSecret) }\n : {}),\n };\n yield* checkpointCreate(fqn, instanceId, news, owned);\n if (created.logStreamType !== news.kind)\n return yield* recover(\n news.kind,\n [created.id],\n \"Create returned a different stream kind.\",\n );\n const live = yield* get(news, created.id);\n if (live === undefined)\n return yield* recover(\n news.kind,\n [created.id],\n \"Create succeeded but the stream could not be read.\",\n );\n const createdOutput: LogStreamAttributes = {\n id: created.id,\n kind: news.kind,\n ...attributes(live),\n };\n yield* validate(news, createdOutput, live);\n yield* checkpointCreate(fqn, instanceId, news, createdOutput);\n return createdOutput;\n }),\n delete: Effect.fn(\"LogStream.delete\")(function* ({ olds, output }) {\n const live = yield* get(olds, output.id);\n if (live === undefined) return;\n yield* identify(output, live);\n yield* client\n .deleteLogStream(olds.deploymentUrl, olds.deployKey, output.id)\n .pipe(Effect.catchTag(\"ConvexNotFound\", () => Effect.void));\n }),\n } satisfies Provider.ProviderServiceInput<LogStream>;\n});\n\nexport const layer = Provider.effect(LogStream, provider);\nexport const localLayer = Provider.effect(LogStream, provider).pipe(\n Layer.provide(\n ConvexClient.layer({ mode: \"local\" }).pipe(\n Layer.provide(FetchHttpClient.layer),\n ),\n ),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiEA,MAAM,YAAY,SAAoB,kBAAkB;AAGxD,MAAa,YAAsC,OAAO,OACxD,IAAI,MAAM,WAAW,EACnB,QACE,QACA,OACA,SAQG;CACH,IAAI,KAAK,WAAW,GAAG,OAAO,OAAO,OAAO,WAAW,KAAK,EAAE;CAC9D,MAAM,CAAC,IAAI,SAAS;CACpB,OAAO,OACL,KACC,OAAO,SAAS,KAAK,IAAI,QAAQ,OAAO,QAAQ,KAAK,EAAA,CAAG,KACvD,OAAO,QAAQ,YAAY,CAC7B,CACF;AACF,EACF,CAAC,GACD,WAAW,UAAyD;CAClE,OAAO;CACP,gBAAgB,OAAO,QAAQ,SAAS;AAC1C,CAAC,CACH;AAEA,IAAa,sBAAb,cAAyC,OAAO,YAG9C,CAAC,CAAC,uBAAuB;CACzB,MAAM,OAAO;CACb,SAAS,OAAO;AAClB,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,4BAAb,cA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ACpC,MAAM,QAAQ,gBAAgB,KAAK,CACrC,CACF,CACF"}
|
package/dist/Providers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Providers.d.ts","sources":["../src/Providers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;;
|
|
1
|
+
{"version":3,"file":"Providers.d.ts","sources":["../src/Providers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;;AAatC,qBAAa,SAAU,SAAQ,cAE9B;CAAG;AAEJ;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,aAAc;IAClC,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;CAC5C,qXAkDE,CAAC"}
|
package/dist/Providers.js
CHANGED
|
@@ -4,9 +4,10 @@ import { Deployment, layer as layer$2, localLayer as localLayer$1 } from "./Depl
|
|
|
4
4
|
import { DeployKey, layer as layer$3, localLayer as localLayer$2 } from "./DeployKey.js";
|
|
5
5
|
import { EnvironmentVariables, layer as layer$4, localLayer as localLayer$3 } from "./EnvironmentVariables.js";
|
|
6
6
|
import { Project, layer as layer$5, localLayer as localLayer$4 } from "./Project.js";
|
|
7
|
-
import {
|
|
8
|
-
import { layer as layer$7 } from "./
|
|
9
|
-
import { layer as layer$8 } from "./internal/
|
|
7
|
+
import { LogStream, layer as layer$6, localLayer as localLayer$5 } from "./LogStream.js";
|
|
8
|
+
import { UsageLimit, layer as layer$7, localLayer as localLayer$6 } from "./UsageLimit.js";
|
|
9
|
+
import { layer as layer$8 } from "./internal/CommandRunner.js";
|
|
10
|
+
import { layer as layer$9 } from "./internal/PushLock.js";
|
|
10
11
|
import * as Provider from "alchemy/Provider";
|
|
11
12
|
import * as Layer from "effect/Layer";
|
|
12
13
|
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
@@ -27,6 +28,7 @@ const providers = (options) => Layer.effect(Providers, Provider.collection([
|
|
|
27
28
|
DeployKey,
|
|
28
29
|
EnvironmentVariables,
|
|
29
30
|
Code,
|
|
31
|
+
LogStream,
|
|
30
32
|
UsageLimit
|
|
31
33
|
])).pipe(Layer.provide(Layer.mergeAll(ProviderLayer.dual(Project, {
|
|
32
34
|
live: () => layer$5,
|
|
@@ -41,12 +43,15 @@ const providers = (options) => Layer.effect(Providers, Provider.collection([
|
|
|
41
43
|
live: () => layer$4,
|
|
42
44
|
local: () => localLayer$3
|
|
43
45
|
}), ProviderLayer.dual(UsageLimit, {
|
|
44
|
-
live: () => layer$
|
|
45
|
-
local: () => localLayer$
|
|
46
|
+
live: () => layer$7,
|
|
47
|
+
local: () => localLayer$6
|
|
46
48
|
}), ProviderLayer.dual(Code, {
|
|
47
49
|
live: () => layer,
|
|
48
50
|
local: () => localLayer
|
|
49
|
-
})
|
|
51
|
+
}), ProviderLayer.dual(LogStream, {
|
|
52
|
+
live: () => layer$6,
|
|
53
|
+
local: () => localLayer$5
|
|
54
|
+
}))), Layer.provide(layer$1(options).pipe(Layer.provide(FetchHttpClient.layer))), Layer.provide(layer$8), Layer.provide(layer$9()));
|
|
50
55
|
export { Providers, providers };
|
|
51
56
|
|
|
52
57
|
//# sourceMappingURL=Providers.js.map
|
package/dist/Providers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Providers.js","names":["Project.Project","Deployment.Deployment","DeployKey.DeployKey","EnvironmentVariables.EnvironmentVariables","Code.Code","UsageLimit.UsageLimit","Project.layer","Project.localLayer","Deployment.layer","Deployment.localLayer","DeployKey.layer","DeployKey.localLayer","EnvironmentVariables.layer","EnvironmentVariables.localLayer","UsageLimit.layer","UsageLimit.localLayer","Code.layer","Code.localLayer","ConvexClient.layer","CommandRunner.layer","PushLock.layer"],"sources":["../src/Providers.ts"],"sourcesContent":["import * as ProviderLayer from \"alchemy/Local/ProviderLayer\";\nimport * as Provider from \"alchemy/Provider\";\nimport type * as Redacted from \"effect/Redacted\";\nimport * as Layer from \"effect/Layer\";\nimport * as FetchHttpClient from \"effect/http/FetchHttpClient\";\nimport * as Code from \"./Code.js\";\nimport * as ConvexClient from \"./ConvexClient.js\";\nimport * as Deployment from \"./Deployment.js\";\nimport * as DeployKey from \"./DeployKey.js\";\nimport * as EnvironmentVariables from \"./EnvironmentVariables.js\";\nimport * as Project from \"./Project.js\";\nimport * as UsageLimit from \"./UsageLimit.js\";\nimport * as CommandRunner from \"./internal/CommandRunner.js\";\nimport * as PushLock from \"./internal/PushLock.js\";\n\nexport class Providers extends Provider.ProviderCollection<Providers>()(\n \"@confect/alchemy/Providers\",\n) {}\n\n/**\n * Register Convex resources without eagerly resolving management credentials.\n * `alchemy deploy` resolves each resource to its cloud provider; `alchemy dev`\n * resolves the same resources to local providers backed by a local Convex\n * backend, so one stack definition serves both.\n *\n * @stability unstable\n */\nexport const providers = (options?: {\n readonly token?: Redacted.Redacted<string>;\n}) =>\n Layer.effect(\n Providers,\n Provider.collection([\n Project.Project,\n Deployment.Deployment,\n DeployKey.DeployKey,\n EnvironmentVariables.EnvironmentVariables,\n Code.Code,\n UsageLimit.UsageLimit,\n ]),\n ).pipe(\n Layer.provide(\n Layer.mergeAll(\n ProviderLayer.dual(Project.Project, {\n live: () => Project.layer,\n local: () => Project.localLayer,\n }),\n ProviderLayer.dual(Deployment.Deployment, {\n live: () => Deployment.layer,\n local: () => Deployment.localLayer,\n }),\n ProviderLayer.dual(DeployKey.DeployKey, {\n live: () => DeployKey.layer,\n local: () => DeployKey.localLayer,\n }),\n ProviderLayer.dual(EnvironmentVariables.EnvironmentVariables, {\n live: () => EnvironmentVariables.layer,\n local: () => EnvironmentVariables.localLayer,\n }),\n ProviderLayer.dual(UsageLimit.UsageLimit, {\n live: () => UsageLimit.layer,\n local: () => UsageLimit.localLayer,\n }),\n ProviderLayer.dual(Code.Code, {\n live: () => Code.layer,\n local: () => Code.localLayer,\n }),\n ),\n ),\n Layer.provide(\n ConvexClient.layer(options).pipe(Layer.provide(FetchHttpClient.layer)),\n ),\n Layer.provide(CommandRunner.layer),\n Layer.provide(PushLock.layer()),\n );\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Providers.js","names":["Project.Project","Deployment.Deployment","DeployKey.DeployKey","EnvironmentVariables.EnvironmentVariables","Code.Code","LogStream.LogStream","UsageLimit.UsageLimit","Project.layer","Project.localLayer","Deployment.layer","Deployment.localLayer","DeployKey.layer","DeployKey.localLayer","EnvironmentVariables.layer","EnvironmentVariables.localLayer","UsageLimit.layer","UsageLimit.localLayer","Code.layer","Code.localLayer","LogStream.layer","LogStream.localLayer","ConvexClient.layer","CommandRunner.layer","PushLock.layer"],"sources":["../src/Providers.ts"],"sourcesContent":["import * as ProviderLayer from \"alchemy/Local/ProviderLayer\";\nimport * as Provider from \"alchemy/Provider\";\nimport type * as Redacted from \"effect/Redacted\";\nimport * as Layer from \"effect/Layer\";\nimport * as FetchHttpClient from \"effect/http/FetchHttpClient\";\nimport * as Code from \"./Code.js\";\nimport * as ConvexClient from \"./ConvexClient.js\";\nimport * as Deployment from \"./Deployment.js\";\nimport * as DeployKey from \"./DeployKey.js\";\nimport * as EnvironmentVariables from \"./EnvironmentVariables.js\";\nimport * as Project from \"./Project.js\";\nimport * as LogStream from \"./LogStream.js\";\nimport * as UsageLimit from \"./UsageLimit.js\";\nimport * as CommandRunner from \"./internal/CommandRunner.js\";\nimport * as PushLock from \"./internal/PushLock.js\";\n\nexport class Providers extends Provider.ProviderCollection<Providers>()(\n \"@confect/alchemy/Providers\",\n) {}\n\n/**\n * Register Convex resources without eagerly resolving management credentials.\n * `alchemy deploy` resolves each resource to its cloud provider; `alchemy dev`\n * resolves the same resources to local providers backed by a local Convex\n * backend, so one stack definition serves both.\n *\n * @stability unstable\n */\nexport const providers = (options?: {\n readonly token?: Redacted.Redacted<string>;\n}) =>\n Layer.effect(\n Providers,\n Provider.collection([\n Project.Project,\n Deployment.Deployment,\n DeployKey.DeployKey,\n EnvironmentVariables.EnvironmentVariables,\n Code.Code,\n LogStream.LogStream,\n UsageLimit.UsageLimit,\n ]),\n ).pipe(\n Layer.provide(\n Layer.mergeAll(\n ProviderLayer.dual(Project.Project, {\n live: () => Project.layer,\n local: () => Project.localLayer,\n }),\n ProviderLayer.dual(Deployment.Deployment, {\n live: () => Deployment.layer,\n local: () => Deployment.localLayer,\n }),\n ProviderLayer.dual(DeployKey.DeployKey, {\n live: () => DeployKey.layer,\n local: () => DeployKey.localLayer,\n }),\n ProviderLayer.dual(EnvironmentVariables.EnvironmentVariables, {\n live: () => EnvironmentVariables.layer,\n local: () => EnvironmentVariables.localLayer,\n }),\n ProviderLayer.dual(UsageLimit.UsageLimit, {\n live: () => UsageLimit.layer,\n local: () => UsageLimit.localLayer,\n }),\n ProviderLayer.dual(Code.Code, {\n live: () => Code.layer,\n local: () => Code.localLayer,\n }),\n ProviderLayer.dual(LogStream.LogStream, {\n live: () => LogStream.layer,\n local: () => LogStream.localLayer,\n }),\n ),\n ),\n Layer.provide(\n ConvexClient.layer(options).pipe(Layer.provide(FetchHttpClient.layer)),\n ),\n Layer.provide(CommandRunner.layer),\n Layer.provide(PushLock.layer()),\n );\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,IAAa,YAAb,cAA+B,SAAS,mBAA8B,CAAC,CACrE,4BACF,CAAC,CAAC,CAAC;;;;;;;;;AAUH,MAAa,aAAa,YAGxB,MAAM,OACJ,WACA,SAAS,WAAW;CAClBA;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;AACF,CAAC,CACH,CAAC,CAAC,KACA,MAAM,QACJ,MAAM,SACJ,cAAc,KAAKN,SAAiB;CAClC,YAAYO;CACZ,aAAaC;AACf,CAAC,GACD,cAAc,KAAKP,YAAuB;CACxC,YAAYQ;CACZ,aAAaC;AACf,CAAC,GACD,cAAc,KAAKR,WAAqB;CACtC,YAAYS;CACZ,aAAaC;AACf,CAAC,GACD,cAAc,KAAKT,sBAA2C;CAC5D,YAAYU;CACZ,aAAaC;AACf,CAAC,GACD,cAAc,KAAKR,YAAuB;CACxC,YAAYS;CACZ,aAAaC;AACf,CAAC,GACD,cAAc,KAAKZ,MAAW;CAC5B,YAAYa;CACZ,aAAaC;AACf,CAAC,GACD,cAAc,KAAKb,WAAqB;CACtC,YAAYc;CACZ,aAAaC;AACf,CAAC,CACH,CACF,GACA,MAAM,QACJC,QAAmB,OAAO,CAAC,CAAC,KAAK,MAAM,QAAQ,gBAAgB,KAAK,CAAC,CACvE,GACA,MAAM,QAAQC,OAAmB,GACjC,MAAM,QAAQC,QAAe,CAAC,CAChC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type * as Redacted from "effect/Redacted";
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
export type SecretField = "apiKey" | "ddApiKey" | "dsn" | "accessKeyId" | "secretAccessKey";
|
|
4
|
+
export type RedactInput<A> = A extends unknown ? {
|
|
5
|
+
readonly [K in keyof A]: K extends SecretField ? Redacted.Redacted<string> | Exclude<A[K], string> : K extends "url" ? A[K] | Redacted.Redacted<string> : A[K];
|
|
6
|
+
} : never;
|
|
7
|
+
export type ReadonlyDeep<A> = A extends object ? {
|
|
8
|
+
readonly [K in keyof A]: ReadonlyDeep<A[K]>;
|
|
9
|
+
} : A;
|
|
10
|
+
export declare const Topics: readonly ["verification", "console", "function_execution", "exception", "audit_log", "scheduler_stats", "scheduled_job_lag", "current_storage_usage", "concurrency_stats", "storage_api_bandwidth", "ai_gateway_usage", "log_stream_egress", "custom_audit"];
|
|
11
|
+
export declare const Config: Schema.Union<readonly [Schema.Struct<{
|
|
12
|
+
readonly id: Schema.String;
|
|
13
|
+
readonly status: Schema.Union<readonly [Schema.Struct<{
|
|
14
|
+
readonly type: Schema.Literals<readonly ["pending", "restarting", "active", "deleting"]>;
|
|
15
|
+
}>, Schema.Struct<{
|
|
16
|
+
readonly type: Schema.Literal<"failed">;
|
|
17
|
+
readonly reason: Schema.String;
|
|
18
|
+
}>]>;
|
|
19
|
+
readonly logStreamType: Schema.Literal<"datadog">;
|
|
20
|
+
readonly siteLocation: Schema.Literals<readonly ["US1", "US3", "US5", "EU", "US1_FED", "AP1"]>;
|
|
21
|
+
readonly ddTags: Schema.$Array<Schema.String>;
|
|
22
|
+
readonly service: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
23
|
+
readonly topics: Schema.optionalKey<Schema.NullOr<Schema.$Array<Schema.Literals<readonly ["verification", "console", "function_execution", "exception", "audit_log", "scheduler_stats", "scheduled_job_lag", "current_storage_usage", "concurrency_stats", "storage_api_bandwidth", "ai_gateway_usage", "log_stream_egress", "custom_audit"]>>>>;
|
|
24
|
+
}>, Schema.Struct<{
|
|
25
|
+
readonly id: Schema.String;
|
|
26
|
+
readonly status: Schema.Union<readonly [Schema.Struct<{
|
|
27
|
+
readonly type: Schema.Literals<readonly ["pending", "restarting", "active", "deleting"]>;
|
|
28
|
+
}>, Schema.Struct<{
|
|
29
|
+
readonly type: Schema.Literal<"failed">;
|
|
30
|
+
readonly reason: Schema.String;
|
|
31
|
+
}>]>;
|
|
32
|
+
readonly logStreamType: Schema.Literal<"webhook">;
|
|
33
|
+
readonly url: Schema.String;
|
|
34
|
+
readonly format: Schema.Literals<readonly ["json", "jsonl"]>;
|
|
35
|
+
readonly hmacSecret: Schema.String;
|
|
36
|
+
readonly topics: Schema.optionalKey<Schema.NullOr<Schema.$Array<Schema.Literals<readonly ["verification", "console", "function_execution", "exception", "audit_log", "scheduler_stats", "scheduled_job_lag", "current_storage_usage", "concurrency_stats", "storage_api_bandwidth", "ai_gateway_usage", "log_stream_egress", "custom_audit"]>>>>;
|
|
37
|
+
}>, Schema.Struct<{
|
|
38
|
+
readonly id: Schema.String;
|
|
39
|
+
readonly status: Schema.Union<readonly [Schema.Struct<{
|
|
40
|
+
readonly type: Schema.Literals<readonly ["pending", "restarting", "active", "deleting"]>;
|
|
41
|
+
}>, Schema.Struct<{
|
|
42
|
+
readonly type: Schema.Literal<"failed">;
|
|
43
|
+
readonly reason: Schema.String;
|
|
44
|
+
}>]>;
|
|
45
|
+
readonly logStreamType: Schema.Literal<"axiom">;
|
|
46
|
+
readonly datasetName: Schema.String;
|
|
47
|
+
readonly attributes: Schema.$Array<Schema.Struct<{
|
|
48
|
+
readonly key: Schema.String;
|
|
49
|
+
readonly value: Schema.String;
|
|
50
|
+
}>>;
|
|
51
|
+
readonly ingestUrl: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
52
|
+
readonly topics: Schema.optionalKey<Schema.NullOr<Schema.$Array<Schema.Literals<readonly ["verification", "console", "function_execution", "exception", "audit_log", "scheduler_stats", "scheduled_job_lag", "current_storage_usage", "concurrency_stats", "storage_api_bandwidth", "ai_gateway_usage", "log_stream_egress", "custom_audit"]>>>>;
|
|
53
|
+
}>, Schema.Struct<{
|
|
54
|
+
readonly id: Schema.String;
|
|
55
|
+
readonly status: Schema.Union<readonly [Schema.Struct<{
|
|
56
|
+
readonly type: Schema.Literals<readonly ["pending", "restarting", "active", "deleting"]>;
|
|
57
|
+
}>, Schema.Struct<{
|
|
58
|
+
readonly type: Schema.Literal<"failed">;
|
|
59
|
+
readonly reason: Schema.String;
|
|
60
|
+
}>]>;
|
|
61
|
+
readonly logStreamType: Schema.Literal<"sentry">;
|
|
62
|
+
readonly tags: Schema.optionalKey<Schema.NullOr<Schema.$Record<Schema.String, Schema.String>>>;
|
|
63
|
+
}>, Schema.Struct<{
|
|
64
|
+
readonly id: Schema.String;
|
|
65
|
+
readonly status: Schema.Union<readonly [Schema.Struct<{
|
|
66
|
+
readonly type: Schema.Literals<readonly ["pending", "restarting", "active", "deleting"]>;
|
|
67
|
+
}>, Schema.Struct<{
|
|
68
|
+
readonly type: Schema.Literal<"failed">;
|
|
69
|
+
readonly reason: Schema.String;
|
|
70
|
+
}>]>;
|
|
71
|
+
readonly logStreamType: Schema.Literal<"postHogLogs">;
|
|
72
|
+
readonly host: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
73
|
+
readonly serviceName: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
74
|
+
readonly topics: Schema.optionalKey<Schema.NullOr<Schema.$Array<Schema.Literals<readonly ["verification", "console", "function_execution", "exception", "audit_log", "scheduler_stats", "scheduled_job_lag", "current_storage_usage", "concurrency_stats", "storage_api_bandwidth", "ai_gateway_usage", "log_stream_egress", "custom_audit"]>>>>;
|
|
75
|
+
}>, Schema.Struct<{
|
|
76
|
+
readonly id: Schema.String;
|
|
77
|
+
readonly status: Schema.Union<readonly [Schema.Struct<{
|
|
78
|
+
readonly type: Schema.Literals<readonly ["pending", "restarting", "active", "deleting"]>;
|
|
79
|
+
}>, Schema.Struct<{
|
|
80
|
+
readonly type: Schema.Literal<"failed">;
|
|
81
|
+
readonly reason: Schema.String;
|
|
82
|
+
}>]>;
|
|
83
|
+
readonly logStreamType: Schema.Literal<"postHogErrorTracking">;
|
|
84
|
+
readonly host: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
85
|
+
}>, Schema.Struct<{
|
|
86
|
+
readonly id: Schema.String;
|
|
87
|
+
readonly status: Schema.Union<readonly [Schema.Struct<{
|
|
88
|
+
readonly type: Schema.Literals<readonly ["pending", "restarting", "active", "deleting"]>;
|
|
89
|
+
}>, Schema.Struct<{
|
|
90
|
+
readonly type: Schema.Literal<"failed">;
|
|
91
|
+
readonly reason: Schema.String;
|
|
92
|
+
}>]>;
|
|
93
|
+
readonly logStreamType: Schema.Literal<"s3Export">;
|
|
94
|
+
readonly bucket: Schema.String;
|
|
95
|
+
readonly region: Schema.String;
|
|
96
|
+
readonly prefix: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
97
|
+
readonly accessKeyId: Schema.String;
|
|
98
|
+
readonly period: Schema.Literals<readonly ["continuous", "hourly", "daily"]>;
|
|
99
|
+
readonly selection: Schema.StructWithRest<Schema.Struct<{
|
|
100
|
+
readonly _other: Schema.Literals<readonly ["included", "excluded"]>;
|
|
101
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Literal<"excluded">, Schema.StructWithRest<Schema.Struct<{
|
|
102
|
+
readonly _other: Schema.Literals<readonly ["included", "excluded"]>;
|
|
103
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Literal<"excluded">, Schema.StructWithRest<Schema.Struct<{
|
|
104
|
+
readonly _other: Schema.Literals<readonly ["included", "excluded"]>;
|
|
105
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Literals<readonly ["included", "excluded"]>>]>]>>]>]>>]>;
|
|
106
|
+
}>]>;
|
|
107
|
+
export declare const Created: Schema.Union<readonly [Schema.Struct<{
|
|
108
|
+
readonly logStreamType: Schema.Literal<"webhook">;
|
|
109
|
+
readonly id: Schema.String;
|
|
110
|
+
readonly hmacSecret: Schema.String;
|
|
111
|
+
}>, Schema.Struct<{
|
|
112
|
+
readonly logStreamType: Schema.Literals<readonly ["datadog", "axiom", "sentry", "postHogLogs", "postHogErrorTracking", "s3Export"]>;
|
|
113
|
+
readonly id: Schema.String;
|
|
114
|
+
}>]>;
|
|
115
|
+
//# sourceMappingURL=LogStream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogStream.d.ts","sources":["../../src/internal/LogStream.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,MAAM,MAAM,WAAW,GACnB,QAAQ,GACR,UAAU,GACV,KAAK,GACL,aAAa,GACb,iBAAiB,CAAC;AACtB,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,GAC1C;IACE,QAAQ,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