@samebase/alchemy-convex 0.3.0 → 0.4.0
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/NOTICE +24 -0
- package/README.md +128 -280
- package/lib/index.d.ts +159 -327
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +754 -905
- package/lib/index.js.map +1 -1
- package/package.json +4 -3
- package/src/Credentials.ts +85 -27
- package/src/Deployment.ts +461 -122
- package/src/ManagementApi.ts +84 -64
- package/src/Project.ts +133 -16
- package/src/Providers.ts +5 -41
- package/src/Push.ts +646 -0
- package/src/index.ts +15 -47
- package/src/Code.ts +0 -463
- package/src/DefaultEnvironmentVariable.ts +0 -263
- package/src/Deploy.ts +0 -183
- package/src/DeployKey.ts +0 -332
- package/src/EnvironmentVariable.ts +0 -289
- package/src/PreviewDeployKey.ts +0 -153
package/lib/index.d.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as Provider from "alchemy/Provider";
|
|
1
|
+
import * as Context from "effect/Context";
|
|
3
2
|
import * as Effect from "effect/Effect";
|
|
4
|
-
import "effect/
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
5
4
|
import * as Redacted from "effect/Redacted";
|
|
6
5
|
import * as Schema from "effect/Schema";
|
|
6
|
+
import { Resource } from "alchemy";
|
|
7
|
+
import * as Provider from "alchemy/Provider";
|
|
8
|
+
import "effect/process/ChildProcessSpawner";
|
|
7
9
|
import { createDeploymentClient, createManagementClient } from "@convex-dev/platform";
|
|
8
|
-
import * as Context from "effect/Context";
|
|
9
|
-
import * as Layer from "effect/Layer";
|
|
10
|
-
import { CommandExecutor, CommandRunProps } from "alchemy/Command";
|
|
11
|
-
import { MemoOptions } from "alchemy/Command/Memo";
|
|
12
10
|
import { components } from "@convex-dev/platform/managementApi";
|
|
13
11
|
//#region src/Credentials.d.ts
|
|
14
12
|
interface ResolvedCredentials {
|
|
@@ -17,23 +15,38 @@ interface ResolvedCredentials {
|
|
|
17
15
|
/** Where the token came from, for error messages only. */
|
|
18
16
|
readonly source: "env" | "explicit" | "convex-cli-login";
|
|
19
17
|
}
|
|
20
|
-
|
|
18
|
+
interface CredentialsService {
|
|
19
|
+
/** The Management API token. Dies when there is none. */
|
|
20
|
+
readonly accessToken: Effect.Effect<ResolvedCredentials>;
|
|
21
|
+
/** True when there is a Management API token. */
|
|
22
|
+
readonly hasAccessToken: Effect.Effect<boolean>;
|
|
23
|
+
/** A deploy key or a preview deploy key, or undefined. */
|
|
24
|
+
readonly deployKey: Effect.Effect<Redacted.Redacted<string> | undefined>;
|
|
25
|
+
}
|
|
26
|
+
declare const Credentials_base: Context.ServiceClass<Credentials, "@samebase/alchemy-convex/Credentials", CredentialsService>;
|
|
21
27
|
declare class Credentials extends Credentials_base {}
|
|
22
|
-
/** Environment variable read by {@link fromConfig}. */
|
|
28
|
+
/** Environment variable for the access token, read by {@link fromConfig}. */
|
|
23
29
|
declare const ACCESS_TOKEN_ENV = "CONVEX_ACCESS_TOKEN";
|
|
30
|
+
/** Environment variable for the deploy key, read by {@link fromConfig}. The Convex CLI reads the same name. */
|
|
31
|
+
declare const DEPLOY_KEY_ENV = "CONVEX_DEPLOY_KEY";
|
|
24
32
|
declare const CredentialsError_base: Schema.Class<CredentialsError, Schema.TaggedStruct<"CredentialsError", {
|
|
25
33
|
readonly reason: Schema.String;
|
|
26
34
|
}>, import("effect/Cause").YieldableError>;
|
|
27
35
|
declare class CredentialsError extends CredentialsError_base {}
|
|
28
36
|
/**
|
|
29
|
-
* Default resolution
|
|
30
|
-
*
|
|
31
|
-
* machine
|
|
32
|
-
* nothing.
|
|
37
|
+
* Default resolution through the stack ConfigProvider (process env, `.env`,
|
|
38
|
+
* stack secrets): `CONVEX_ACCESS_TOKEN`, then the Convex CLI login on this
|
|
39
|
+
* machine, for the access token; `CONVEX_DEPLOY_KEY` for the deploy key. A
|
|
40
|
+
* developer who ran `npx convex login` needs nothing. CI sets only the
|
|
41
|
+
* deploy key when the stack pushes to deployments that exist, and the access
|
|
42
|
+
* token when the stack also creates projects or deployments.
|
|
33
43
|
*/
|
|
34
44
|
declare const fromConfig: () => Layer.Layer<Credentials>;
|
|
35
|
-
/** Explicit
|
|
36
|
-
declare const
|
|
45
|
+
/** Explicit values, for tests or callers that already hold them. */
|
|
46
|
+
declare const fromValues: (values: {
|
|
47
|
+
readonly accessToken?: Redacted.Redacted<string>;
|
|
48
|
+
readonly deployKey?: Redacted.Redacted<string>;
|
|
49
|
+
}) => Layer.Layer<Credentials>;
|
|
37
50
|
//#endregion
|
|
38
51
|
//#region src/ManagementApi.d.ts
|
|
39
52
|
type ManagementClient = ReturnType<typeof createManagementClient>;
|
|
@@ -73,6 +86,11 @@ interface ManagementApiService {
|
|
|
73
86
|
* that key would revoke the credential.
|
|
74
87
|
*/
|
|
75
88
|
readonly isCredentialToken: (secret: string) => Effect.Effect<boolean>;
|
|
89
|
+
/**
|
|
90
|
+
* The same calls with another bearer token, such as a preview deploy key,
|
|
91
|
+
* which the Management API takes for the preview deployments of its project.
|
|
92
|
+
*/
|
|
93
|
+
readonly withToken: (token: Redacted.Redacted<string>) => ManagementApiService;
|
|
76
94
|
}
|
|
77
95
|
declare const ManagementApi_base: Context.ServiceClass<ManagementApi, "@samebase/alchemy-convex/ManagementApi", ManagementApiService>;
|
|
78
96
|
declare class ManagementApi extends ManagementApi_base {}
|
|
@@ -81,29 +99,121 @@ declare class ManagementApi extends ManagementApi_base {}
|
|
|
81
99
|
declare const Providers_base: Provider.ProviderCollection<Providers, "Convex">;
|
|
82
100
|
declare class Providers extends Providers_base {}
|
|
83
101
|
/**
|
|
84
|
-
*
|
|
85
|
-
* default lookup (`CONVEX_ACCESS_TOKEN`, then the Convex CLI login
|
|
102
|
+
* The Convex resource providers. Pass a credentials layer to override the
|
|
103
|
+
* default lookup (`CONVEX_ACCESS_TOKEN`, then the Convex CLI login, and
|
|
104
|
+
* `CONVEX_DEPLOY_KEY`).
|
|
86
105
|
*/
|
|
87
106
|
declare const providers: (credentials?: Layer.Layer<Credentials>) => Layer.Layer<Providers, never, import("effect/process/ChildProcessSpawner").ChildProcessSpawner | import("effect/FileSystem").FileSystem | import("effect/Path").Path>;
|
|
88
107
|
//#endregion
|
|
108
|
+
//#region src/Push.d.ts
|
|
109
|
+
/** A value of the `env` prop: a string, or a secret such as `Config.Redacted("AUTH_SECRET")`. */
|
|
110
|
+
type EnvValue = string | Redacted.Redacted<string>;
|
|
111
|
+
/**
|
|
112
|
+
* The `source` prop: the Convex functions directory, such as `./convex`, or
|
|
113
|
+
* that directory with a push command and more files for the content identity.
|
|
114
|
+
*/
|
|
115
|
+
type Source = string | {
|
|
116
|
+
/** The Convex functions directory, such as `./convex`. */
|
|
117
|
+
readonly path: string;
|
|
118
|
+
/**
|
|
119
|
+
* Replaces `convex deploy`: a program and its arguments, run in the app
|
|
120
|
+
* directory with CONVEX_DEPLOY_KEY in its environment, such as
|
|
121
|
+
* `["pnpm", "exec", "convex-hosting", "deploy", "--build", "pnpm run build", "--dist", "dist"]`.
|
|
122
|
+
* It must push with `convex deploy`, such as through `--cmd`, so that
|
|
123
|
+
* its output has the CLI's "Deployed Convex functions to" line.
|
|
124
|
+
*/
|
|
125
|
+
readonly command?: readonly [string, ...string[]];
|
|
126
|
+
/**
|
|
127
|
+
* The files of the content identity, as globs relative to the app
|
|
128
|
+
* directory, next to `path`, package.json, convex.json, and the
|
|
129
|
+
* lockfile, such as the build inputs `["src/**", "vite.config.ts"]`.
|
|
130
|
+
* By default, every file of the app that git does not ignore.
|
|
131
|
+
*/
|
|
132
|
+
readonly include?: readonly string[];
|
|
133
|
+
};
|
|
134
|
+
declare const ConvexCliNotFound_base: Schema.Class<ConvexCliNotFound, Schema.TaggedStruct<"ConvexCliNotFound", {
|
|
135
|
+
readonly cwd: Schema.String;
|
|
136
|
+
}>, import("effect/Cause").YieldableError>;
|
|
137
|
+
/** No `convex` package resolves from the app directory. */
|
|
138
|
+
declare class ConvexCliNotFound extends ConvexCliNotFound_base {
|
|
139
|
+
get message(): string;
|
|
140
|
+
}
|
|
141
|
+
declare const ConvexAppNotFound_base: Schema.Class<ConvexAppNotFound, Schema.TaggedStruct<"ConvexAppNotFound", {
|
|
142
|
+
readonly source: Schema.String;
|
|
143
|
+
}>, import("effect/Cause").YieldableError>;
|
|
144
|
+
/** No directory at or above the parent of `source` has a package.json. */
|
|
145
|
+
declare class ConvexAppNotFound extends ConvexAppNotFound_base {
|
|
146
|
+
get message(): string;
|
|
147
|
+
}
|
|
148
|
+
declare const CodePushFailed_base: Schema.Class<CodePushFailed, Schema.TaggedStruct<"CodePushFailed", {
|
|
149
|
+
/** Exit code of the CLI. Undefined when it did not start or a signal stopped it. */
|
|
150
|
+
readonly exitCode: Schema.UndefinedOr<Schema.Number>;
|
|
151
|
+
/** The last lines of the CLI output, with the deploy key removed. */
|
|
152
|
+
readonly outputTail: Schema.String;
|
|
153
|
+
}>, import("effect/Cause").YieldableError>;
|
|
154
|
+
/** The Convex CLI failed, or exited 0 without the deployment URL. The output tail never contains the key. */
|
|
155
|
+
declare class CodePushFailed extends CodePushFailed_base {
|
|
156
|
+
get message(): string;
|
|
157
|
+
}
|
|
158
|
+
declare const PushTargetMismatch_base: Schema.Class<PushTargetMismatch, Schema.TaggedStruct<"PushTargetMismatch", {
|
|
159
|
+
readonly expected: Schema.String;
|
|
160
|
+
readonly actual: Schema.String;
|
|
161
|
+
}>, import("effect/Cause").YieldableError>;
|
|
162
|
+
/** The CLI pushed to another deployment than the one of the resource. Checked after the push. */
|
|
163
|
+
declare class PushTargetMismatch extends PushTargetMismatch_base {
|
|
164
|
+
get message(): string;
|
|
165
|
+
}
|
|
166
|
+
declare const VariablesOwnedBySomeoneElse_base: Schema.Class<VariablesOwnedBySomeoneElse, Schema.TaggedStruct<"VariablesOwnedBySomeoneElse", {
|
|
167
|
+
readonly deployment: Schema.String;
|
|
168
|
+
readonly names: Schema.$Array<Schema.String>;
|
|
169
|
+
}>, import("effect/Cause").YieldableError>;
|
|
170
|
+
/** Variables in `env` exist on the deployment with other values, and adoption is off. */
|
|
171
|
+
declare class VariablesOwnedBySomeoneElse extends VariablesOwnedBySomeoneElse_base {
|
|
172
|
+
get message(): string;
|
|
173
|
+
}
|
|
174
|
+
declare const EnvironmentNeedsDeployKey_base: Schema.Class<EnvironmentNeedsDeployKey, Schema.TaggedStruct<"EnvironmentNeedsDeployKey", {
|
|
175
|
+
readonly deployment: Schema.String;
|
|
176
|
+
}>, import("effect/Cause").YieldableError>;
|
|
177
|
+
/** A preview deploy key cannot set variables: the deployment API takes only a deploy key of the deployment. */
|
|
178
|
+
declare class EnvironmentNeedsDeployKey extends EnvironmentNeedsDeployKey_base {
|
|
179
|
+
get message(): string;
|
|
180
|
+
}
|
|
181
|
+
/** Reads the deployment URL from `convex deploy` output. ANSI escape codes are removed first. */
|
|
182
|
+
declare const parseDeployOutput: (text: string) => {
|
|
183
|
+
url: string;
|
|
184
|
+
deploymentName: string;
|
|
185
|
+
} | undefined;
|
|
186
|
+
//#endregion
|
|
89
187
|
//#region src/Deployment.d.ts
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
readonly
|
|
188
|
+
interface DeploymentInputs {
|
|
189
|
+
/** The project: a Convex.Project resource, or `{ projectId }`. Cannot change. */
|
|
190
|
+
readonly project: {
|
|
191
|
+
readonly projectId: number;
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* The Convex functions directory, such as `./convex`, or that directory
|
|
195
|
+
* with a push command and more hashed files. The push runs in the nearest
|
|
196
|
+
* directory above it with a package.json. Without `source`, the resource
|
|
197
|
+
* pushes nothing.
|
|
198
|
+
*/
|
|
199
|
+
readonly source?: Source;
|
|
200
|
+
/** Environment variables to set on the deployment before the push. */
|
|
201
|
+
readonly env?: Readonly<Record<string, EnvValue>>;
|
|
202
|
+
}
|
|
203
|
+
type DeploymentProps = (DeploymentInputs & {
|
|
93
204
|
/** The project's default production deployment. Cannot change. */
|
|
94
205
|
readonly type: "prod";
|
|
95
|
-
} | {
|
|
96
|
-
/** Numeric project id, such as `project.projectId`. Cannot change. */
|
|
97
|
-
readonly projectId: number;
|
|
206
|
+
}) | (DeploymentInputs & {
|
|
98
207
|
/** A dev deployment or a preview deployment that this resource creates. Cannot change. */
|
|
99
208
|
readonly type: "dev" | "preview";
|
|
100
209
|
/**
|
|
101
|
-
* The dev reference, such as `staging`, or the preview name, such as
|
|
102
|
-
*
|
|
210
|
+
* The dev reference, such as `staging`, or the preview name, such as
|
|
211
|
+
* the stage name. Unique in the project. Cannot change.
|
|
103
212
|
*/
|
|
104
213
|
readonly name: string;
|
|
105
|
-
};
|
|
106
|
-
|
|
214
|
+
});
|
|
215
|
+
/** The deployment itself, without the state of the push. */
|
|
216
|
+
interface DeploymentTarget {
|
|
107
217
|
readonly projectId: number;
|
|
108
218
|
readonly type: DeploymentProps["type"];
|
|
109
219
|
/** Deployment name, such as `happy-animal-123`. */
|
|
@@ -117,6 +227,12 @@ interface DeploymentAttributes {
|
|
|
117
227
|
/** HTTP actions URL, such as `https://happy-animal-123.convex.site`. */
|
|
118
228
|
readonly siteUrl: string;
|
|
119
229
|
}
|
|
230
|
+
interface DeploymentAttributes extends DeploymentTarget {
|
|
231
|
+
/** Content identity of the last push and `env`. Undefined when the resource pushed nothing. */
|
|
232
|
+
readonly hash: string | undefined;
|
|
233
|
+
/** The names of the `env` variables that this resource set on the deployment, sorted. */
|
|
234
|
+
readonly envNames: readonly string[];
|
|
235
|
+
}
|
|
120
236
|
type Deployment = Resource<"Convex.Deployment", DeploymentProps, DeploymentAttributes, never, Providers>;
|
|
121
237
|
declare const Deployment: import("alchemy").ResourceClass<Deployment>;
|
|
122
238
|
declare const DeploymentIdentityChange_base: Schema.Class<DeploymentIdentityChange, Schema.TaggedStruct<"DeploymentIdentityChange", {
|
|
@@ -148,307 +264,10 @@ declare class AmbiguousDeployment extends AmbiguousDeployment_base {
|
|
|
148
264
|
get message(): string;
|
|
149
265
|
}
|
|
150
266
|
//#endregion
|
|
151
|
-
//#region src/Code.d.ts
|
|
152
|
-
/** The attributes of a Convex.Deployment that a push needs. Pass the resource itself. */
|
|
153
|
-
type CodeDeployment = Pick<DeploymentAttributes, "name" | "type" | "url" | "previewName">;
|
|
154
|
-
interface CodeProps {
|
|
155
|
-
/**
|
|
156
|
-
* The deployment that receives the push: a Convex.Deployment resource, or a
|
|
157
|
-
* deployment name such as `happy-animal-123`. A preview deploy key needs the
|
|
158
|
-
* resource. For `env` on a deployment outside US East, pass the resource.
|
|
159
|
-
*/
|
|
160
|
-
readonly deployment: string | CodeDeployment;
|
|
161
|
-
/**
|
|
162
|
-
* A deploy key of `deployment` (Convex.DeployKey), or, for a preview
|
|
163
|
-
* deployment, a preview deploy key of its project (Convex.PreviewDeployKey).
|
|
164
|
-
*/
|
|
165
|
-
readonly deployKey: Redacted.Redacted<string>;
|
|
166
|
-
/** The Convex app directory: the one with `convex/` and the `convex` package installed. */
|
|
167
|
-
readonly cwd: string;
|
|
168
|
-
/**
|
|
169
|
-
* The program and first arguments that run the Convex CLI, such as
|
|
170
|
-
* `["pnpm", "exec", "convex"]`. Code adds `deploy` and its flags. By
|
|
171
|
-
* default, the `convex` package that `cwd` resolves, run with this Node.js.
|
|
172
|
-
*/
|
|
173
|
-
readonly command?: readonly [string, ...string[]];
|
|
174
|
-
/** Environment variables to set on the deployment before the push. Needs a deploy key of the deployment. */
|
|
175
|
-
readonly env?: Readonly<Record<string, string | Redacted.Redacted<string>>>;
|
|
176
|
-
/** `convex deploy --typecheck`. The CLI default is `try`. */
|
|
177
|
-
readonly typecheck?: "enable" | "try" | "disable";
|
|
178
|
-
/** `convex deploy --codegen`. The CLI default is `enable`. */
|
|
179
|
-
readonly codegen?: "enable" | "disable";
|
|
180
|
-
}
|
|
181
|
-
interface CodeAttributes {
|
|
182
|
-
/** The deployment that received the push, such as `happy-animal-123`. */
|
|
183
|
-
readonly deploymentName: string;
|
|
184
|
-
/** Client URL, such as `https://happy-animal-123.convex.cloud`. */
|
|
185
|
-
readonly url: string;
|
|
186
|
-
/** HTTP actions URL, such as `https://happy-animal-123.convex.site`. */
|
|
187
|
-
readonly siteUrl: string;
|
|
188
|
-
/** When the push finished, in milliseconds since the Unix epoch. */
|
|
189
|
-
readonly deployedAt: number;
|
|
190
|
-
/** The names of the `env` variables that this resource set on the deployment, sorted. */
|
|
191
|
-
readonly envNames: readonly string[];
|
|
192
|
-
}
|
|
193
|
-
type Code = Resource<"Convex.Code", CodeProps, CodeAttributes, never, Providers>;
|
|
194
|
-
declare const Code: import("alchemy").ResourceClass<Code>;
|
|
195
|
-
/** Reads the deployment URL from `convex deploy` output. ANSI escape codes are removed first. */
|
|
196
|
-
declare const parseDeployOutput: (text: string) => {
|
|
197
|
-
url: string;
|
|
198
|
-
deploymentName: string;
|
|
199
|
-
} | undefined;
|
|
200
|
-
declare const DeployKeyMismatch_base: Schema.Class<DeployKeyMismatch, Schema.TaggedStruct<"DeployKeyMismatch", {
|
|
201
|
-
/** The deployment that should receive the push. */
|
|
202
|
-
readonly deployment: Schema.String;
|
|
203
|
-
/** What the key targets. */
|
|
204
|
-
readonly key: Schema.Literals<readonly ["deployment", "preview", "project", "unknown"]>;
|
|
205
|
-
/** For a deployment key: the deployment in the key prefix. Never the secret. */
|
|
206
|
-
readonly keyDeployment: Schema.UndefinedOr<Schema.String>;
|
|
207
|
-
}>, import("effect/Cause").YieldableError>;
|
|
208
|
-
/** The deploy key does not fit the deployment. Checked before the push. */
|
|
209
|
-
declare class DeployKeyMismatch extends DeployKeyMismatch_base {
|
|
210
|
-
get message(): string;
|
|
211
|
-
}
|
|
212
|
-
declare const EnvironmentNeedsDeployKey_base: Schema.Class<EnvironmentNeedsDeployKey, Schema.TaggedStruct<"EnvironmentNeedsDeployKey", {
|
|
213
|
-
readonly deployment: Schema.String;
|
|
214
|
-
}>, import("effect/Cause").YieldableError>;
|
|
215
|
-
/** `env` needs the deployment API, which takes only a deploy key of the deployment. */
|
|
216
|
-
declare class EnvironmentNeedsDeployKey extends EnvironmentNeedsDeployKey_base {
|
|
217
|
-
get message(): string;
|
|
218
|
-
}
|
|
219
|
-
declare const ConvexCliNotFound_base: Schema.Class<ConvexCliNotFound, Schema.TaggedStruct<"ConvexCliNotFound", {
|
|
220
|
-
readonly cwd: Schema.String;
|
|
221
|
-
}>, import("effect/Cause").YieldableError>;
|
|
222
|
-
/** No `convex` package resolves from `cwd`. */
|
|
223
|
-
declare class ConvexCliNotFound extends ConvexCliNotFound_base {
|
|
224
|
-
get message(): string;
|
|
225
|
-
}
|
|
226
|
-
declare const CodePushFailed_base: Schema.Class<CodePushFailed, Schema.TaggedStruct<"CodePushFailed", {
|
|
227
|
-
/** Exit code of the CLI. Undefined when it did not start or a signal stopped it. */
|
|
228
|
-
readonly exitCode: Schema.UndefinedOr<Schema.Number>;
|
|
229
|
-
/** The last lines of the CLI output, with the deploy key removed. */
|
|
230
|
-
readonly outputTail: Schema.String;
|
|
231
|
-
}>, import("effect/Cause").YieldableError>;
|
|
232
|
-
/** The Convex CLI failed, or exited 0 without the deployment URL. The output tail never contains the key. */
|
|
233
|
-
declare class CodePushFailed extends CodePushFailed_base {
|
|
234
|
-
get message(): string;
|
|
235
|
-
}
|
|
236
|
-
declare const PushTargetMismatch_base: Schema.Class<PushTargetMismatch, Schema.TaggedStruct<"PushTargetMismatch", {
|
|
237
|
-
readonly expected: Schema.String;
|
|
238
|
-
readonly actual: Schema.String;
|
|
239
|
-
}>, import("effect/Cause").YieldableError>;
|
|
240
|
-
/** The CLI pushed to another deployment than the one in the props. Checked after the push. */
|
|
241
|
-
declare class PushTargetMismatch extends PushTargetMismatch_base {
|
|
242
|
-
get message(): string;
|
|
243
|
-
}
|
|
244
|
-
//#endregion
|
|
245
|
-
//#region src/DefaultEnvironmentVariable.d.ts
|
|
246
|
-
/** Deployment types a default can target, from the generated schema. */
|
|
247
|
-
type DeploymentType = components["schemas"]["DeploymentType"];
|
|
248
|
-
interface DefaultEnvironmentVariableProps {
|
|
249
|
-
/** Numeric project id, such as `project.projectId`. */
|
|
250
|
-
readonly projectId: number;
|
|
251
|
-
readonly name: string;
|
|
252
|
-
readonly value: string | Redacted.Redacted<string>;
|
|
253
|
-
/** Deployments of this type that Convex creates from now on get the variable. */
|
|
254
|
-
readonly deploymentType: DeploymentType;
|
|
255
|
-
}
|
|
256
|
-
interface DefaultEnvironmentVariableAttributes {
|
|
257
|
-
readonly projectId: number;
|
|
258
|
-
readonly name: string;
|
|
259
|
-
readonly deploymentType: DeploymentType;
|
|
260
|
-
}
|
|
261
|
-
type DefaultEnvironmentVariable = Resource<"Convex.DefaultEnvironmentVariable", DefaultEnvironmentVariableProps, DefaultEnvironmentVariableAttributes, never, Providers>;
|
|
262
|
-
declare const DefaultEnvironmentVariable: import("alchemy").ResourceClass<DefaultEnvironmentVariable>;
|
|
263
|
-
//#endregion
|
|
264
|
-
//#region src/Deploy.d.ts
|
|
265
|
-
interface DeployProps extends Pick<CommandRunProps, "cwd" | "env" | "timeout"> {
|
|
266
|
-
/**
|
|
267
|
-
* Deploy key that selects the target deployment: a production, development,
|
|
268
|
-
* project, or preview deploy key. The CLI receives it as `CONVEX_DEPLOY_KEY`,
|
|
269
|
-
* and Alchemy removes its value from the logged output.
|
|
270
|
-
*/
|
|
271
|
-
readonly deployKey: Redacted.Redacted<string>;
|
|
272
|
-
/**
|
|
273
|
-
* Preview deployment name for a preview deploy key. The CLI reuses an
|
|
274
|
-
* existing preview deployment with this name.
|
|
275
|
-
*/
|
|
276
|
-
readonly previewName?: string;
|
|
277
|
-
/**
|
|
278
|
-
* Like {@link previewName}, but the CLI deletes and recreates an existing
|
|
279
|
-
* preview deployment with this name, so every run gets a new URL.
|
|
280
|
-
*/
|
|
281
|
-
readonly previewCreate?: string;
|
|
282
|
-
/**
|
|
283
|
-
* Function to run after the push, such as `init:seed`. The CLI runs it only
|
|
284
|
-
* when the push created a new preview deployment.
|
|
285
|
-
*/
|
|
286
|
-
readonly previewRun?: string;
|
|
287
|
-
/**
|
|
288
|
-
* More `convex deploy` flags, added after the preview flags. Alchemy splits
|
|
289
|
-
* the command on whitespace, so an argument cannot contain whitespace: use
|
|
290
|
-
* `--typecheck=disable`, not `--typecheck disable` as one argument.
|
|
291
|
-
*/
|
|
292
|
-
readonly extraArgs?: readonly string[];
|
|
293
|
-
/**
|
|
294
|
-
* Files hashed to skip an unchanged push. By default every non-gitignored
|
|
295
|
-
* file under `cwd` and the nearest lockfile. Use
|
|
296
|
-
* `{ include: ["convex/**"], lockfile: true }` to ignore frontend changes,
|
|
297
|
-
* or `false` to push on every deploy. A preview deploy (`previewName` or
|
|
298
|
-
* `previewCreate`) pushes on every deploy: Convex can delete an expired
|
|
299
|
-
* preview deployment, and the hash cannot show that.
|
|
300
|
-
* @default true
|
|
301
|
-
*/
|
|
302
|
-
readonly memo?: MemoOptions | boolean;
|
|
303
|
-
}
|
|
304
|
-
interface DeployAttributes {
|
|
305
|
-
/** Client URL of the deployment that received the push, such as `https://happy-otter-123.convex.cloud`. */
|
|
306
|
-
readonly url: string;
|
|
307
|
-
/** First label of the URL host, such as `happy-otter-123`. */
|
|
308
|
-
readonly deploymentName: string;
|
|
309
|
-
/** Hash of the memoized input files after the push, or `undefined` when `memo` is `false`. */
|
|
310
|
-
readonly hash: string | undefined;
|
|
311
|
-
}
|
|
312
|
-
type Deploy = Resource<"Convex.Deploy", DeployProps, DeployAttributes, never, Providers>;
|
|
313
|
-
/**
|
|
314
|
-
* @deprecated Since 0.3.0. Use Convex.Code with a Convex.Deployment: it
|
|
315
|
-
* runs the installed Convex CLI, keeps the deploy key out of the process
|
|
316
|
-
* environment, checks that the key fits the deployment, and outputs the site
|
|
317
|
-
* URL. Removing a Deploy resource changes nothing in Convex.
|
|
318
|
-
*/
|
|
319
|
-
declare const Deploy: import("alchemy").ResourceClass<Deploy>;
|
|
320
|
-
/** The `convex deploy` argv, starting with `npx`. */
|
|
321
|
-
declare const deployArgs: (props: Pick<DeployProps, "previewName" | "previewCreate" | "previewRun" | "extraArgs">) => readonly string[];
|
|
322
|
-
declare const DeployArgumentError_base: Schema.Class<DeployArgumentError, Schema.TaggedStruct<"DeployArgumentError", {
|
|
323
|
-
readonly argument: Schema.String;
|
|
324
|
-
}>, import("effect/Cause").YieldableError>;
|
|
325
|
-
/** A `convex deploy` argument contains whitespace, which Alchemy's command runner splits on. */
|
|
326
|
-
declare class DeployArgumentError extends DeployArgumentError_base {
|
|
327
|
-
get message(): string;
|
|
328
|
-
}
|
|
329
|
-
declare const DeployOutputError_base: Schema.Class<DeployOutputError, Schema.TaggedStruct<"DeployOutputError", {
|
|
330
|
-
readonly outputTail: Schema.String;
|
|
331
|
-
}>, import("effect/Cause").YieldableError>;
|
|
332
|
-
/** `npx convex deploy` exited 0 but did not print the deployment URL. */
|
|
333
|
-
declare class DeployOutputError extends DeployOutputError_base {
|
|
334
|
-
get message(): string;
|
|
335
|
-
}
|
|
336
|
-
//#endregion
|
|
337
|
-
//#region src/DeployKey.d.ts
|
|
338
|
-
/** Actions a deploy key can be limited to, from the generated schema. */
|
|
339
|
-
type DeployKeyAction = NonNullable<components["schemas"]["PlatformCreateDeployKeyArgs"]["allowedActions"]>[number];
|
|
340
|
-
declare const DeployKeyRecoveryRequired_base: Schema.Class<DeployKeyRecoveryRequired, Schema.TaggedStruct<"DeployKeyRecoveryRequired", {
|
|
341
|
-
/** Where the keys live, such as `deployment happy-otter-123` or `project 3145389`. */
|
|
342
|
-
readonly target: Schema.String;
|
|
343
|
-
/** The requested name. */
|
|
344
|
-
readonly name: Schema.String;
|
|
345
|
-
/** The listed keys with the requested name. */
|
|
346
|
-
readonly keys: Schema.$Array<Schema.Struct<{
|
|
347
|
-
readonly id: Schema.Number;
|
|
348
|
-
readonly name: Schema.String;
|
|
349
|
-
}>>;
|
|
350
|
-
/** True when this run created a key before the listing check failed. */
|
|
351
|
-
readonly afterCreate: Schema.Boolean;
|
|
352
|
-
}>, import("effect/Cause").YieldableError>;
|
|
353
|
-
/**
|
|
354
|
-
* A key cannot be tied to one resource: before the create, listed keys
|
|
355
|
-
* already have the requested name, or after the create, not exactly one has it.
|
|
356
|
-
*/
|
|
357
|
-
declare class DeployKeyRecoveryRequired extends DeployKeyRecoveryRequired_base {
|
|
358
|
-
get message(): string;
|
|
359
|
-
}
|
|
360
|
-
declare const DeployKeyIsCredential_base: Schema.Class<DeployKeyIsCredential, Schema.TaggedStruct<"DeployKeyIsCredential", {
|
|
361
|
-
readonly target: Schema.String;
|
|
362
|
-
readonly name: Schema.String;
|
|
363
|
-
}>, import("effect/Cause").YieldableError>;
|
|
364
|
-
/**
|
|
365
|
-
* Convex returned the Management API credential itself as the new key. This
|
|
366
|
-
* happens with an OAuth token: Convex creates no key. A delete of the
|
|
367
|
-
* returned secret would revoke the credential, so the resource does not keep it.
|
|
368
|
-
*/
|
|
369
|
-
declare class DeployKeyIsCredential extends DeployKeyIsCredential_base {
|
|
370
|
-
get message(): string;
|
|
371
|
-
}
|
|
372
|
-
interface DeployKeyProps {
|
|
373
|
-
/** Deployment name, such as `project.prodDeploymentName`. */
|
|
374
|
-
readonly deployment: string;
|
|
375
|
-
/**
|
|
376
|
-
* Key name. The provider requests this name, a dash, and a hash of the
|
|
377
|
-
* resource identity, so two resources with one `name` get different keys.
|
|
378
|
-
*/
|
|
379
|
-
readonly name: string;
|
|
380
|
-
/** Limits the key to these actions. Convex grants every deployment action when omitted. */
|
|
381
|
-
readonly allowedActions?: readonly DeployKeyAction[];
|
|
382
|
-
}
|
|
383
|
-
interface DeployKeyAttributes {
|
|
384
|
-
/** The name Convex lists the key under, such as "ci-3f2a1b0c9d8e". */
|
|
385
|
-
readonly uniqueName: string;
|
|
386
|
-
/** Numeric id of the key in the listing. Undefined in state written by 0.1.x. */
|
|
387
|
-
readonly keyId: number | undefined;
|
|
388
|
-
readonly deployment: string;
|
|
389
|
-
/** The secret, such as `prod:<deployment>|<token>`. Convex returns it only at creation. */
|
|
390
|
-
readonly deployKey: Redacted.Redacted<string>;
|
|
391
|
-
}
|
|
392
|
-
type DeployKey = Resource<"Convex.DeployKey", DeployKeyProps, DeployKeyAttributes, never, Providers>;
|
|
393
|
-
declare const DeployKey: import("alchemy").ResourceClass<DeployKey>;
|
|
394
|
-
//#endregion
|
|
395
|
-
//#region src/EnvironmentVariable.d.ts
|
|
396
|
-
interface EnvironmentVariableProps {
|
|
397
|
-
/** Deployment name, or its URL for deployments outside US East. */
|
|
398
|
-
readonly deployment: string;
|
|
399
|
-
/** Deploy key for `deployment`, such as `deployKey.deployKey`. */
|
|
400
|
-
readonly deployKey: Redacted.Redacted<string>;
|
|
401
|
-
readonly name: string;
|
|
402
|
-
readonly value: string | Redacted.Redacted<string>;
|
|
403
|
-
}
|
|
404
|
-
interface EnvironmentVariableAttributes {
|
|
405
|
-
readonly deployment: string;
|
|
406
|
-
readonly name: string;
|
|
407
|
-
/** Deploy key for `deployment`, for read and delete. Undefined in state from 0.1.x. */
|
|
408
|
-
readonly deployKey: Redacted.Redacted<string> | undefined;
|
|
409
|
-
}
|
|
410
|
-
type EnvironmentVariable = Resource<"Convex.EnvironmentVariable", EnvironmentVariableProps, EnvironmentVariableAttributes, never, Providers>;
|
|
411
|
-
declare const EnvironmentVariable: import("alchemy").ResourceClass<EnvironmentVariable>;
|
|
412
|
-
declare const VariableIdentityChange_base: Schema.Class<VariableIdentityChange, Schema.TaggedStruct<"VariableIdentityChange", {
|
|
413
|
-
readonly resourceType: Schema.String;
|
|
414
|
-
readonly field: Schema.Literals<readonly ["name", "deployment", "projectId", "deploymentType"]>;
|
|
415
|
-
readonly current: Schema.String;
|
|
416
|
-
readonly requested: Schema.String;
|
|
417
|
-
}>, import("effect/Cause").YieldableError>;
|
|
418
|
-
/**
|
|
419
|
-
* The props name another variable than the one in state. Used by
|
|
420
|
-
* Convex.EnvironmentVariable and Convex.DefaultEnvironmentVariable.
|
|
421
|
-
*/
|
|
422
|
-
declare class VariableIdentityChange extends VariableIdentityChange_base {
|
|
423
|
-
get message(): string;
|
|
424
|
-
}
|
|
425
|
-
//#endregion
|
|
426
|
-
//#region src/PreviewDeployKey.d.ts
|
|
427
|
-
interface PreviewDeployKeyProps {
|
|
428
|
-
/** Numeric project id, such as `project.projectId`. */
|
|
429
|
-
readonly projectId: number;
|
|
430
|
-
/**
|
|
431
|
-
* Key name. The provider requests this name, a dash, and a hash of the
|
|
432
|
-
* resource identity, so two resources with one `name` get different keys.
|
|
433
|
-
*/
|
|
434
|
-
readonly name: string;
|
|
435
|
-
}
|
|
436
|
-
interface PreviewDeployKeyAttributes {
|
|
437
|
-
/** The name Convex lists the key under, such as "ci-3f2a1b0c9d8e". */
|
|
438
|
-
readonly uniqueName: string;
|
|
439
|
-
/** Numeric id of the key in the listing. Undefined in state written by 0.1.x. */
|
|
440
|
-
readonly keyId: number | undefined;
|
|
441
|
-
readonly projectId: number;
|
|
442
|
-
/** The secret, such as `preview:<team>:<project>|<token>`. Convex returns it only at creation. */
|
|
443
|
-
readonly previewDeployKey: Redacted.Redacted<string>;
|
|
444
|
-
}
|
|
445
|
-
type PreviewDeployKey = Resource<"Convex.PreviewDeployKey", PreviewDeployKeyProps, PreviewDeployKeyAttributes, never, Providers>;
|
|
446
|
-
declare const PreviewDeployKey: import("alchemy").ResourceClass<PreviewDeployKey>;
|
|
447
|
-
//#endregion
|
|
448
267
|
//#region src/Project.d.ts
|
|
449
268
|
/** Region names the Management API accepts, from the generated schema. */
|
|
450
269
|
type DeploymentRegion = components["schemas"]["RegionName"];
|
|
451
|
-
|
|
270
|
+
type ProjectProps = {
|
|
452
271
|
/** Team slug or numeric team id. A slug costs one extra lookup per run. Cannot change. */
|
|
453
272
|
readonly team: string | number;
|
|
454
273
|
/** Display name. Convex derives the slug from it at creation. A change renames the project. */
|
|
@@ -457,7 +276,12 @@ interface ProjectProps {
|
|
|
457
276
|
readonly deploymentRegion?: DeploymentRegion;
|
|
458
277
|
/** Deployment created with the project. Defaults to `prod`. Cannot change. */
|
|
459
278
|
readonly deploymentType?: "prod" | "dev";
|
|
460
|
-
}
|
|
279
|
+
} | {
|
|
280
|
+
/** Team slug or numeric team id. Cannot change. */
|
|
281
|
+
readonly team: string | number;
|
|
282
|
+
/** Slug of an existing project, such as `score-four`. The resource never creates a project. Cannot change. */
|
|
283
|
+
readonly slug: string;
|
|
284
|
+
};
|
|
461
285
|
interface ProjectAttributes {
|
|
462
286
|
readonly projectId: number;
|
|
463
287
|
readonly slug: string;
|
|
@@ -506,6 +330,14 @@ declare const CreatedProjectNotFound_base: Schema.Class<CreatedProjectNotFound,
|
|
|
506
330
|
declare class CreatedProjectNotFound extends CreatedProjectNotFound_base {
|
|
507
331
|
get message(): string;
|
|
508
332
|
}
|
|
333
|
+
declare const ProjectNotFound_base: Schema.Class<ProjectNotFound, Schema.TaggedStruct<"ProjectNotFound", {
|
|
334
|
+
readonly team: Schema.String;
|
|
335
|
+
readonly slug: Schema.String;
|
|
336
|
+
}>, import("effect/Cause").YieldableError>;
|
|
337
|
+
/** No project in the team has the slug. A `slug` resource never creates one. */
|
|
338
|
+
declare class ProjectNotFound extends ProjectNotFound_base {
|
|
339
|
+
get message(): string;
|
|
340
|
+
}
|
|
509
341
|
//#endregion
|
|
510
|
-
export { ACCESS_TOKEN_ENV, AmbiguousDeployment, AmbiguousProject,
|
|
342
|
+
export { ACCESS_TOKEN_ENV, AmbiguousDeployment, AmbiguousProject, CodePushFailed, ConvexApiError, ConvexAppNotFound, ConvexCliNotFound, CreatedProjectNotFound, Credentials, CredentialsError, DEPLOY_KEY_ENV, Deployment, type DeploymentAttributes, DeploymentIdentityChange, type DeploymentProps, type DeploymentRegion, type EnvValue, EnvironmentNeedsDeployKey, ManagementApi, ProductionDeploymentNotFound, Project, type ProjectAttributes, ProjectDeploymentChange, ProjectNotFound, type ProjectProps, ProjectTeamChange, Providers, PushTargetMismatch, type Source, VariablesOwnedBySomeoneElse, fromConfig, fromValues, parseDeployOutput, providers };
|
|
511
343
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/Credentials.ts","../src/ManagementApi.ts","../src/Providers.ts","../src/
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/Credentials.ts","../src/ManagementApi.ts","../src/Providers.ts","../src/Push.ts","../src/Deployment.ts","../src/Project.ts"],"mappings":";;;;;;;;;;;UA6BiB;;WAEN,aAAa,SAAS;;WAEtB;;UAGM;;WAEN,aAAa,OAAO,OAAO;;WAE3B,gBAAgB,OAAO;;WAEvB,WAAW,OAAO,OAAO,SAAS;;;cAGhC,oBAAoB;;cAKpB;;cAGA;;;;cAOA,yBAAyB;;;;;;;;;cAiCzB,kBAAiB,MAAM,MAAM;;cA0B7B,aAAc;WAChB,cAAc,SAAS;WACvB,YAAY,SAAS;MAC5B,MAAM,MAAM;;;KC3GJ,mBAAmB,kBAAkB;KACrC,mBAAmB,kBAAkB;;UAGhC,YAAY;WAClB,OAAO;WACP;WACA,UAAU;;;;;;;;;;;;;cAQR,uBAAuB;UAuBnB;;WAEN,UAAU,GACjB,mBACA,MAAM,QAAQ,qBAAqB,QAAQ,YAAY,QACpD,OAAO,OAAO,GAAG;;WAEb,cACP,mBACA,MAAM,QAAQ,qBAAqB,QAAQ,0BACxC,OAAO,aAAa;;WAEhB,oBAAoB,GAC3B,mBACA,6BACA,WAAW,SAAS,kBACpB,MAAM,QAAQ,qBAAqB,QAAQ,YAAY,QACpD,OAAO,OAAO,GAAG;;WAEb,gBAAgB,0BAA0B,OAAO,eAAe;;;;;;;;WAQhE,oBAAoB,mBAAmB,OAAO;;;;;WAK9C,YAAY,OAAO,SAAS,qBAAqB;;;cAM/C,sBAAsB;;;;cClFtB,kBAAkB;;;;;;cAOlB,YAAa,cAAa,MAAM,MAAM,iBAA2B,MAAA,MAAA,+DAAA,kDAAA,mCAAA;;;;KC8BlE,oBAAoB,SAAS;;;;;KAM7B;;WAIG;;;;;;;;WAQA;;;;;;;WAOA;;;;;;cA2BF,0BAA0B;MAIxB;;;;;;cAMF,0BAA0B;MAIxB;;;;;;;;;cAMF,uBAAuB;MAMrB;;;;;;;cAQF,2BAA2B;MAIzB;;;;;;;cAMF,oCAAoC;MAIlC;;;;;;cAMF,kCAAkC;MAIhC;;;cAuCF,oBACX;EACG;EAAa;;;;UCzHR;;WAEC;aAAoB;;;;;;;;WAOpB,SAAS;;WAET,MAAM,SAAS,eAAe;;KAG7B,mBACP;;WAEU;MAEV;;WAEU;;;;;WAKA;;;UAIL;WACC;WACA,MAAM;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;UAGM,6BAA6B;;WAEnC;;WAEA;;KAGC,aAAa,8BAEvB,iBACA,6BAEA;cAEW,8BAAU,cAAA;;;;;;;;;cAKV,iCAAiC;MAU/B;;;;;;cAMF,qCAAqC;MAInC;;;;;;;;;cAMF,4BAA4B;MAS1B;;;;;KChJH,mBAAmB;KAEnB;;WAGG;;WAEA;;WAEA,mBAAmB;;WAEnB;;;WAIA;;WAEA;;UAGE;WACN;WACA;WACA;WACA;WACA;WACA;;KAGC,UAAU,2BAA2B,cAAc,0BAA0B;cAC5E,2BAAO,cAAA;;;;;;;cAGP,0BAA0B;MAIxB;;;;;;;;;;;;cASF,gCAAgC;MAS9B;;;;;;;;cAOF,yBAAyB;MAKvB;;;;;;cAMF,+BAA+B;MAI7B;;;;;;;cAMF,wBAAwB;MAItB"}
|