@gaganref/confect-alchemy 10.6.0-fork.3 → 10.6.0-fork.30
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/Backend.d.ts +64 -5
- package/dist/Backend.d.ts.map +1 -1
- package/dist/Backend.js +187 -3
- package/dist/Backend.js.map +1 -1
- package/dist/Code.d.ts +14 -2
- package/dist/Code.d.ts.map +1 -1
- package/dist/Code.js +2 -2
- package/dist/Code.js.map +1 -1
- package/dist/Confect.d.ts +1 -1
- package/dist/Confect.d.ts.map +1 -1
- package/dist/Confect.js +8 -3
- package/dist/Confect.js.map +1 -1
- package/dist/Convex.d.ts +4 -1
- package/dist/Convex.d.ts.map +1 -1
- package/dist/Convex.js +10 -1
- package/dist/Convex.js.map +1 -1
- package/dist/ConvexClient.d.ts +92 -3
- package/dist/ConvexClient.d.ts.map +1 -1
- package/dist/ConvexClient.js +149 -27
- package/dist/ConvexClient.js.map +1 -1
- package/dist/CustomDomain.d.ts +156 -0
- package/dist/CustomDomain.d.ts.map +1 -0
- package/dist/CustomDomain.js +255 -0
- package/dist/CustomDomain.js.map +1 -0
- package/dist/DeployKey.js +3 -3
- package/dist/Deployment.d.ts +29 -3
- package/dist/Deployment.d.ts.map +1 -1
- package/dist/Deployment.js +39 -15
- package/dist/Deployment.js.map +1 -1
- package/dist/EnvironmentVariables.d.ts +76 -21
- package/dist/EnvironmentVariables.d.ts.map +1 -1
- package/dist/EnvironmentVariables.js +203 -19
- package/dist/EnvironmentVariables.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/Project.js +2 -2
- package/dist/Providers.d.ts.map +1 -1
- package/dist/Providers.js +30 -15
- package/dist/Providers.js.map +1 -1
- package/dist/UsageLimit.d.ts +140 -0
- package/dist/UsageLimit.d.ts.map +1 -0
- package/dist/UsageLimit.js +145 -0
- package/dist/UsageLimit.js.map +1 -0
- package/dist/internal/CodeDeployment.d.ts +28 -1
- package/dist/internal/CodeDeployment.d.ts.map +1 -1
- package/dist/internal/CodeDeployment.js +85 -2
- package/dist/internal/CodeDeployment.js.map +1 -1
- package/dist/internal/CommandRunner.d.ts +4 -0
- package/dist/internal/CommandRunner.d.ts.map +1 -1
- package/dist/internal/CommandRunner.js +92 -6
- package/dist/internal/CommandRunner.js.map +1 -1
- package/dist/internal/FileLock.js +1 -1
- package/dist/internal/FunctionsDirectory.d.ts +12 -0
- package/dist/internal/FunctionsDirectory.d.ts.map +1 -0
- package/dist/internal/FunctionsDirectory.js +22 -0
- package/dist/internal/FunctionsDirectory.js.map +1 -0
- package/dist/internal/Lifecycle.d.ts +1 -0
- package/dist/internal/Lifecycle.d.ts.map +1 -1
- package/dist/internal/Lifecycle.js +24 -2
- package/dist/internal/Lifecycle.js.map +1 -1
- package/dist/internal/LocalBackend.d.ts +9 -0
- package/dist/internal/LocalBackend.d.ts.map +1 -1
- package/dist/internal/LocalBackend.js +14 -5
- package/dist/internal/LocalBackend.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/dist/internal/MountInit.d.ts.map +1 -1
- package/dist/internal/MountInit.js +4 -6
- package/dist/internal/MountInit.js.map +1 -1
- package/dist/internal/PushLock.d.ts +1 -0
- package/dist/internal/PushLock.d.ts.map +1 -1
- package/dist/internal/PushLock.js +4 -3
- package/dist/internal/PushLock.js.map +1 -1
- package/dist/internal/ResourceIdentity.js +1 -1
- package/dist/internal/Zip.js +1 -1
- package/package.json +4 -4
- package/src/Backend.ts +422 -12
- package/src/Code.ts +13 -0
- package/src/Confect.ts +7 -1
- package/src/Convex.ts +24 -1
- package/src/ConvexClient.ts +364 -31
- package/src/CustomDomain.ts +453 -0
- package/src/Deployment.ts +74 -12
- package/src/EnvironmentVariables.ts +505 -19
- package/src/LogStream.ts +662 -0
- package/src/Providers.ts +18 -0
- package/src/UsageLimit.ts +253 -0
- package/src/internal/CodeDeployment.ts +115 -0
- package/src/internal/CommandRunner.ts +182 -1
- package/src/internal/FunctionsDirectory.ts +27 -0
- package/src/internal/Lifecycle.ts +21 -1
- package/src/internal/LocalBackend.ts +9 -0
- package/src/internal/LogStream.ts +154 -0
- package/src/internal/MountInit.ts +3 -13
- package/src/internal/PushLock.ts +4 -1
|
@@ -195,6 +195,8 @@ const readIdentity = Effect.fn("LocalBackend.readIdentity")(function* (
|
|
|
195
195
|
|
|
196
196
|
/**
|
|
197
197
|
* The admin key of a local deployment, for its deploy key resource.
|
|
198
|
+
*
|
|
199
|
+
* @stability unstable
|
|
198
200
|
*/
|
|
199
201
|
export const adminKey = Effect.fn("LocalBackend.adminKey")(function* (
|
|
200
202
|
deploymentName: string,
|
|
@@ -209,6 +211,11 @@ export const adminKey = Effect.fn("LocalBackend.adminKey")(function* (
|
|
|
209
211
|
return Redacted.make(identity.value.adminKey);
|
|
210
212
|
});
|
|
211
213
|
|
|
214
|
+
/**
|
|
215
|
+
* Remove a local deployment's retained data.
|
|
216
|
+
*
|
|
217
|
+
* @stability unstable
|
|
218
|
+
*/
|
|
212
219
|
export const remove = Effect.fn("LocalBackend.remove")(function* (
|
|
213
220
|
deploymentName: string,
|
|
214
221
|
directory: string,
|
|
@@ -272,6 +279,8 @@ const install = Effect.fn("LocalBackend.install")(function* (
|
|
|
272
279
|
* picks two free loopback ports; later boots reuse all of them, so stored
|
|
273
280
|
* credentials and URLs stay valid. A saved port that something else now holds
|
|
274
281
|
* is an error rather than a move, because resources keep the URL.
|
|
282
|
+
*
|
|
283
|
+
* @stability unstable
|
|
275
284
|
*/
|
|
276
285
|
export const boot = Effect.fn("LocalBackend.boot")(function* (
|
|
277
286
|
deploymentName: string,
|
|
@@ -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>>;
|
|
@@ -4,6 +4,7 @@ import * as Path from "effect/Path";
|
|
|
4
4
|
import type * as Redacted from "effect/Redacted";
|
|
5
5
|
import * as Schema from "effect/Schema";
|
|
6
6
|
import { ConvexClient, ConvexFunctionError } from "../ConvexClient.js";
|
|
7
|
+
import { functionsDirectory } from "./FunctionsDirectory.js";
|
|
7
8
|
|
|
8
9
|
export class MountInitFailed extends Schema.TaggedError<
|
|
9
10
|
MountInitFailed,
|
|
@@ -29,26 +30,15 @@ const Steps = Schema.Array(
|
|
|
29
30
|
|
|
30
31
|
const STEPS = "confectDeploy:steps";
|
|
31
32
|
|
|
32
|
-
const ConvexJson = Schema.fromJsonString(
|
|
33
|
-
Schema.Struct({ functions: Schema.optional(Schema.String) }),
|
|
34
|
-
);
|
|
35
|
-
|
|
36
33
|
/**
|
|
37
|
-
* Whether codegen wrote `confectDeploy.ts` into the backend's Convex directory
|
|
38
|
-
* which `convex.json` may move.
|
|
34
|
+
* Whether codegen wrote `confectDeploy.ts` into the backend's Convex directory.
|
|
39
35
|
*/
|
|
40
36
|
const hasDeployModule = Effect.fn("MountInit.hasDeployModule")(function* (
|
|
41
37
|
cwd: string,
|
|
42
38
|
) {
|
|
43
39
|
const fs = yield* FileSystem.FileSystem;
|
|
44
40
|
const path = yield* Path.Path;
|
|
45
|
-
const
|
|
46
|
-
const functions = (yield* fs.exists(config))
|
|
47
|
-
? ((yield* fs
|
|
48
|
-
.readFileString(config)
|
|
49
|
-
.pipe(Effect.flatMap(Schema.decodeEffect(ConvexJson)))).functions ??
|
|
50
|
-
"convex")
|
|
51
|
-
: "convex";
|
|
41
|
+
const functions = yield* functionsDirectory(cwd);
|
|
52
42
|
return yield* fs.exists(path.join(cwd, functions, "confectDeploy.ts"));
|
|
53
43
|
});
|
|
54
44
|
|
package/src/internal/PushLock.ts
CHANGED
|
@@ -17,11 +17,14 @@ export class PushLockError extends Schema.TaggedError<
|
|
|
17
17
|
>()("PushLockError", {
|
|
18
18
|
deploymentName: Schema.String,
|
|
19
19
|
reason: Schema.Literals(["configuration", "timeout", "filesystem"]),
|
|
20
|
+
missing: Schema.Literals(["PushLock"]).pipe(Schema.optionalKey),
|
|
20
21
|
}) {
|
|
21
22
|
override get message() {
|
|
22
23
|
switch (this.reason) {
|
|
23
24
|
case "configuration":
|
|
24
|
-
return
|
|
25
|
+
return this.missing === "PushLock"
|
|
26
|
+
? `Push lock for ${this.deploymentName} needs the PushLock service to be provided`
|
|
27
|
+
: `Push lock for ${this.deploymentName} needs a home directory to keep its lock file in`;
|
|
25
28
|
case "timeout":
|
|
26
29
|
return `Timed out waiting for another push to ${this.deploymentName} to release its push lock`;
|
|
27
30
|
case "filesystem":
|