@samebase/alchemy-convex 0.1.0 → 0.3.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.
Files changed (54) hide show
  1. package/README.md +246 -55
  2. package/lib/index.d.ts +510 -9
  3. package/lib/index.d.ts.map +1 -1
  4. package/lib/index.js +1411 -10
  5. package/lib/index.js.map +1 -1
  6. package/package.json +8 -5
  7. package/src/Adoption.ts +30 -0
  8. package/src/Code.ts +463 -0
  9. package/src/DefaultEnvironmentVariable.ts +127 -29
  10. package/src/Deploy.ts +47 -35
  11. package/src/DeployKey.ts +221 -60
  12. package/src/Deployment.ts +409 -0
  13. package/src/EnvironmentVariable.ts +204 -44
  14. package/src/ManagementApi.ts +57 -1
  15. package/src/PreviewDeployKey.ts +65 -38
  16. package/src/Project.ts +236 -52
  17. package/src/Providers.ts +9 -1
  18. package/src/index.ts +29 -1
  19. package/lib/Credentials.d.ts +0 -39
  20. package/lib/Credentials.d.ts.map +0 -1
  21. package/lib/Credentials.js +0 -49
  22. package/lib/Credentials.js.map +0 -1
  23. package/lib/DefaultEnvironmentVariable.d.ts +0 -58
  24. package/lib/DefaultEnvironmentVariable.d.ts.map +0 -1
  25. package/lib/DefaultEnvironmentVariable.js +0 -93
  26. package/lib/DefaultEnvironmentVariable.js.map +0 -1
  27. package/lib/Deploy.d.ts +0 -62
  28. package/lib/Deploy.d.ts.map +0 -1
  29. package/lib/Deploy.js +0 -92
  30. package/lib/Deploy.js.map +0 -1
  31. package/lib/DeployKey.d.ts +0 -48
  32. package/lib/DeployKey.d.ts.map +0 -1
  33. package/lib/DeployKey.js +0 -104
  34. package/lib/DeployKey.js.map +0 -1
  35. package/lib/EnvironmentVariable.d.ts +0 -37
  36. package/lib/EnvironmentVariable.d.ts.map +0 -1
  37. package/lib/EnvironmentVariable.js +0 -65
  38. package/lib/EnvironmentVariable.js.map +0 -1
  39. package/lib/ManagementApi.d.ts +0 -50
  40. package/lib/ManagementApi.d.ts.map +0 -1
  41. package/lib/ManagementApi.js +0 -103
  42. package/lib/ManagementApi.js.map +0 -1
  43. package/lib/PreviewDeployKey.d.ts +0 -34
  44. package/lib/PreviewDeployKey.d.ts.map +0 -1
  45. package/lib/PreviewDeployKey.js +0 -78
  46. package/lib/PreviewDeployKey.js.map +0 -1
  47. package/lib/Project.d.ts +0 -29
  48. package/lib/Project.d.ts.map +0 -1
  49. package/lib/Project.js +0 -114
  50. package/lib/Project.js.map +0 -1
  51. package/lib/Providers.d.ts +0 -13
  52. package/lib/Providers.d.ts.map +0 -1
  53. package/lib/Providers.js +0 -30
  54. package/lib/Providers.js.map +0 -1
package/lib/index.d.ts CHANGED
@@ -1,10 +1,511 @@
1
- export { ACCESS_TOKEN_ENV, Credentials, CredentialsError, fromConfig, fromToken, } from "./Credentials.ts";
2
- export { DefaultEnvironmentVariable, type DefaultEnvironmentVariableAttributes, type DefaultEnvironmentVariableProps, type DeploymentType, } from "./DefaultEnvironmentVariable.ts";
3
- export { Deploy, type DeployAttributes, deployArgs, type DeployProps, parseDeployOutput, } from "./Deploy.ts";
4
- export { DeployKey, type DeployKeyAction, type DeployKeyAttributes, type DeployKeyProps, } from "./DeployKey.ts";
5
- export { EnvironmentVariable, type EnvironmentVariableAttributes, type EnvironmentVariableProps, } from "./EnvironmentVariable.ts";
6
- export { ConvexApiError, ManagementApi } from "./ManagementApi.ts";
7
- export { PreviewDeployKey, type PreviewDeployKeyAttributes, type PreviewDeployKeyProps, } from "./PreviewDeployKey.ts";
8
- export { type DeploymentRegion, Project, type ProjectAttributes, type ProjectProps, } from "./Project.ts";
9
- export { Providers, providers } from "./Providers.ts";
1
+ import { Resource } from "alchemy";
2
+ import * as Provider from "alchemy/Provider";
3
+ import * as Effect from "effect/Effect";
4
+ import "effect/process/ChildProcessSpawner";
5
+ import * as Redacted from "effect/Redacted";
6
+ import * as Schema from "effect/Schema";
7
+ 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
+ import { components } from "@convex-dev/platform/managementApi";
13
+ //#region src/Credentials.d.ts
14
+ interface ResolvedCredentials {
15
+ /** Bearer token accepted by https://api.convex.dev/v1: a team access token, an OAuth token, or the Convex CLI login. */
16
+ readonly accessToken: Redacted.Redacted<string>;
17
+ /** Where the token came from, for error messages only. */
18
+ readonly source: "env" | "explicit" | "convex-cli-login";
19
+ }
20
+ declare const Credentials_base: Context.ServiceClass<Credentials, "@samebase/alchemy-convex/Credentials", Effect.Effect<ResolvedCredentials, never, never>>;
21
+ declare class Credentials extends Credentials_base {}
22
+ /** Environment variable read by {@link fromConfig}. */
23
+ declare const ACCESS_TOKEN_ENV = "CONVEX_ACCESS_TOKEN";
24
+ declare const CredentialsError_base: Schema.Class<CredentialsError, Schema.TaggedStruct<"CredentialsError", {
25
+ readonly reason: Schema.String;
26
+ }>, import("effect/Cause").YieldableError>;
27
+ declare class CredentialsError extends CredentialsError_base {}
28
+ /**
29
+ * Default resolution: `CONVEX_ACCESS_TOKEN` from the stack ConfigProvider
30
+ * (process env, `.env`, stack secrets), then the Convex CLI login on this
31
+ * machine. CI sets the variable; a developer who ran `npx convex login` needs
32
+ * nothing.
33
+ */
34
+ declare const fromConfig: () => Layer.Layer<Credentials>;
35
+ /** Explicit token, for tests or callers that already hold a value. */
36
+ declare const fromToken: (accessToken: Redacted.Redacted<string>) => Layer.Layer<Credentials>;
37
+ //#endregion
38
+ //#region src/ManagementApi.d.ts
39
+ type ManagementClient = ReturnType<typeof createManagementClient>;
40
+ type DeploymentClient = ReturnType<typeof createDeploymentClient>;
41
+ /** Shape of every openapi-fetch result we consume. */
42
+ interface FetchResult<T> {
43
+ readonly data?: T;
44
+ readonly error?: unknown;
45
+ readonly response: Response;
46
+ }
47
+ declare const ConvexApiError_base: Schema.Class<ConvexApiError, Schema.TaggedStruct<"ConvexApiError", {
48
+ readonly operation: Schema.String;
49
+ readonly status: Schema.Number;
50
+ readonly code: Schema.optionalKey<Schema.String>;
51
+ readonly message: Schema.String;
52
+ }>, import("effect/Cause").YieldableError>;
53
+ /**
54
+ * One error for every control-plane and deployment call. Resources branch on
55
+ * `status` (404 means absent for read and delete), so the class is load
56
+ * bearing, not decorative.
57
+ */
58
+ declare class ConvexApiError extends ConvexApiError_base {}
59
+ interface ManagementApiService {
60
+ /** Run one management call with the resolved credentials. */
61
+ readonly request: <T>(operation: string, run: (client: ManagementClient) => Promise<FetchResult<T>>) => Effect.Effect<T, ConvexApiError>;
62
+ /** Run one management call whose success response has no body. */
63
+ readonly requestVoid: (operation: string, run: (client: ManagementClient) => Promise<FetchResult<unknown>>) => Effect.Effect<void, ConvexApiError>;
64
+ /** Run one deployment-scoped call authenticated with a deploy key. */
65
+ readonly deploymentRequest: <T>(operation: string, deploymentUrlOrName: string, deployKey: Redacted.Redacted<string>, run: (client: DeploymentClient) => Promise<FetchResult<T>>) => Effect.Effect<T, ConvexApiError>;
66
+ /** Team id for a slug or numeric id. */
67
+ readonly resolveTeamId: (team: string | number) => Effect.Effect<number, ConvexApiError>;
68
+ /**
69
+ * True when a deploy key that Convex returned carries the token of the
70
+ * Management API credential itself. With an OAuth token, create_deploy_key
71
+ * and create_preview_deploy_key create no new key: they return the OAuth
72
+ * token with a new prefix, and the part after "|" is the same. A delete of
73
+ * that key would revoke the credential.
74
+ */
75
+ readonly isCredentialToken: (secret: string) => Effect.Effect<boolean>;
76
+ }
77
+ declare const ManagementApi_base: Context.ServiceClass<ManagementApi, "@samebase/alchemy-convex/ManagementApi", ManagementApiService>;
78
+ declare class ManagementApi extends ManagementApi_base {}
79
+ //#endregion
80
+ //#region src/Providers.d.ts
81
+ declare const Providers_base: Provider.ProviderCollection<Providers, "Convex">;
82
+ declare class Providers extends Providers_base {}
83
+ /**
84
+ * All Convex resource providers. Pass a credentials layer to override the
85
+ * default lookup (`CONVEX_ACCESS_TOKEN`, then the Convex CLI login).
86
+ */
87
+ 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
+ //#endregion
89
+ //#region src/Deployment.d.ts
90
+ type DeploymentProps = {
91
+ /** Numeric project id, such as `project.projectId`. Cannot change. */
92
+ readonly projectId: number;
93
+ /** The project's default production deployment. Cannot change. */
94
+ readonly type: "prod";
95
+ } | {
96
+ /** Numeric project id, such as `project.projectId`. Cannot change. */
97
+ readonly projectId: number;
98
+ /** A dev deployment or a preview deployment that this resource creates. Cannot change. */
99
+ readonly type: "dev" | "preview";
100
+ /**
101
+ * The dev reference, such as `staging`, or the preview name, such as a
102
+ * pull request or stage name. Unique in the project. Cannot change.
103
+ */
104
+ readonly name: string;
105
+ };
106
+ interface DeploymentAttributes {
107
+ readonly projectId: number;
108
+ readonly type: DeploymentProps["type"];
109
+ /** Deployment name, such as `happy-animal-123`. */
110
+ readonly name: string;
111
+ /** The reference that Convex lists, such as `production`, `staging`, or `preview/pr-42`. */
112
+ readonly reference: string;
113
+ /** The preview name of a preview deployment. Undefined for prod and dev. */
114
+ readonly previewName: string | undefined;
115
+ /** Client URL, such as `https://happy-animal-123.convex.cloud`. */
116
+ readonly url: string;
117
+ /** HTTP actions URL, such as `https://happy-animal-123.convex.site`. */
118
+ readonly siteUrl: string;
119
+ }
120
+ type Deployment = Resource<"Convex.Deployment", DeploymentProps, DeploymentAttributes, never, Providers>;
121
+ declare const Deployment: import("alchemy").ResourceClass<Deployment>;
122
+ declare const DeploymentIdentityChange_base: Schema.Class<DeploymentIdentityChange, Schema.TaggedStruct<"DeploymentIdentityChange", {
123
+ /** Name of the deployment in state, such as `happy-animal-123`. */
124
+ readonly deployment: Schema.String;
125
+ readonly field: Schema.Literals<readonly ["projectId", "type", "name"]>;
126
+ readonly current: Schema.String;
127
+ readonly requested: Schema.String;
128
+ }>, import("effect/Cause").YieldableError>;
129
+ /** The props name another deployment than the one in state. */
130
+ declare class DeploymentIdentityChange extends DeploymentIdentityChange_base {
131
+ get message(): string;
132
+ }
133
+ declare const ProductionDeploymentNotFound_base: Schema.Class<ProductionDeploymentNotFound, Schema.TaggedStruct<"ProductionDeploymentNotFound", {
134
+ readonly projectId: Schema.Number;
135
+ }>, import("effect/Cause").YieldableError>;
136
+ /** The project has no default production deployment for a `prod` resource to take over. */
137
+ declare class ProductionDeploymentNotFound extends ProductionDeploymentNotFound_base {
138
+ get message(): string;
139
+ }
140
+ declare const AmbiguousDeployment_base: Schema.Class<AmbiguousDeployment, Schema.TaggedStruct<"AmbiguousDeployment", {
141
+ readonly projectId: Schema.Number;
142
+ readonly type: Schema.Literals<readonly ["dev", "preview"]>;
143
+ readonly name: Schema.String;
144
+ readonly deployments: Schema.$Array<Schema.String>;
145
+ }>, import("effect/Cause").YieldableError>;
146
+ /** More than one deployment of the project has the name, so the lookup cannot choose one. */
147
+ declare class AmbiguousDeployment extends AmbiguousDeployment_base {
148
+ get message(): string;
149
+ }
150
+ //#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
+ //#region src/Project.d.ts
449
+ /** Region names the Management API accepts, from the generated schema. */
450
+ type DeploymentRegion = components["schemas"]["RegionName"];
451
+ interface ProjectProps {
452
+ /** Team slug or numeric team id. A slug costs one extra lookup per run. Cannot change. */
453
+ readonly team: string | number;
454
+ /** Display name. Convex derives the slug from it at creation. A change renames the project. */
455
+ readonly name: string;
456
+ /** Region of the deployment created with the project. Defaults to the team default. Cannot change. */
457
+ readonly deploymentRegion?: DeploymentRegion;
458
+ /** Deployment created with the project. Defaults to `prod`. Cannot change. */
459
+ readonly deploymentType?: "prod" | "dev";
460
+ }
461
+ interface ProjectAttributes {
462
+ readonly projectId: number;
463
+ readonly slug: string;
464
+ readonly name: string;
465
+ readonly teamId: number;
466
+ readonly prodDeploymentName: string | undefined;
467
+ readonly prodDeploymentUrl: string | undefined;
468
+ }
469
+ type Project = Resource<"Convex.Project", ProjectProps, ProjectAttributes, never, Providers>;
470
+ declare const Project: import("alchemy").ResourceClass<Project>;
471
+ declare const ProjectTeamChange_base: Schema.Class<ProjectTeamChange, Schema.TaggedStruct<"ProjectTeamChange", {
472
+ readonly projectId: Schema.Number;
473
+ readonly teamId: Schema.Number;
474
+ readonly requestedTeamId: Schema.Number;
475
+ }>, import("effect/Cause").YieldableError>;
476
+ /** The props change the team of an existing project. Convex cannot move a project. */
477
+ declare class ProjectTeamChange extends ProjectTeamChange_base {
478
+ get message(): string;
479
+ }
480
+ declare const ProjectDeploymentChange_base: Schema.Class<ProjectDeploymentChange, Schema.TaggedStruct<"ProjectDeploymentChange", {
481
+ readonly projectId: Schema.Number;
482
+ readonly field: Schema.Literals<readonly ["deploymentType", "deploymentRegion"]>;
483
+ readonly current: Schema.UndefinedOr<Schema.String>;
484
+ readonly requested: Schema.UndefinedOr<Schema.String>;
485
+ }>, import("effect/Cause").YieldableError>;
486
+ /**
487
+ * The props change `deploymentType` or `deploymentRegion` of an existing
488
+ * project. Convex uses them only when it creates the project.
489
+ */
490
+ declare class ProjectDeploymentChange extends ProjectDeploymentChange_base {
491
+ get message(): string;
492
+ }
493
+ declare const AmbiguousProject_base: Schema.Class<AmbiguousProject, Schema.TaggedStruct<"AmbiguousProject", {
494
+ readonly teamId: Schema.Number;
495
+ readonly name: Schema.String;
496
+ readonly projectIds: Schema.$Array<Schema.Number>;
497
+ }>, import("effect/Cause").YieldableError>;
498
+ /** More than one project in the team has the name, so the lookup cannot choose one. */
499
+ declare class AmbiguousProject extends AmbiguousProject_base {
500
+ get message(): string;
501
+ }
502
+ declare const CreatedProjectNotFound_base: Schema.Class<CreatedProjectNotFound, Schema.TaggedStruct<"CreatedProjectNotFound", {
503
+ readonly projectId: Schema.Number;
504
+ }>, import("effect/Cause").YieldableError>;
505
+ /** Convex answered a create call but then did not return the project. */
506
+ declare class CreatedProjectNotFound extends CreatedProjectNotFound_base {
507
+ get message(): string;
508
+ }
509
+ //#endregion
510
+ export { ACCESS_TOKEN_ENV, AmbiguousDeployment, AmbiguousProject, Code, type CodeAttributes, type CodeDeployment, type CodeProps, CodePushFailed, ConvexApiError, ConvexCliNotFound, CreatedProjectNotFound, Credentials, CredentialsError, DefaultEnvironmentVariable, type DefaultEnvironmentVariableAttributes, type DefaultEnvironmentVariableProps, Deploy, DeployArgumentError, type DeployAttributes, DeployKey, type DeployKeyAction, type DeployKeyAttributes, DeployKeyIsCredential, DeployKeyMismatch, type DeployKeyProps, DeployKeyRecoveryRequired, DeployOutputError, type DeployProps, Deployment, type DeploymentAttributes, DeploymentIdentityChange, type DeploymentProps, type DeploymentRegion, type DeploymentType, EnvironmentNeedsDeployKey, EnvironmentVariable, type EnvironmentVariableAttributes, type EnvironmentVariableProps, ManagementApi, PreviewDeployKey, type PreviewDeployKeyAttributes, type PreviewDeployKeyProps, ProductionDeploymentNotFound, Project, type ProjectAttributes, ProjectDeploymentChange, type ProjectProps, ProjectTeamChange, Providers, PushTargetMismatch, VariableIdentityChange, deployArgs, fromConfig, fromToken, parseDeployOutput, providers };
10
511
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,SAAS,GACV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,0BAA0B,EAC1B,KAAK,oCAAoC,EACzC,KAAK,+BAA+B,EACpC,KAAK,cAAc,GACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,MAAM,EACN,KAAK,gBAAgB,EACrB,UAAU,EACV,KAAK,WAAW,EAChB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,SAAS,EACT,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,cAAc,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,mBAAmB,EACnB,KAAK,6BAA6B,EAClC,KAAK,wBAAwB,GAC9B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EACL,gBAAgB,EAChB,KAAK,0BAA0B,EAC/B,KAAK,qBAAqB,GAC3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,KAAK,gBAAgB,EACrB,OAAO,EACP,KAAK,iBAAiB,EACtB,KAAK,YAAY,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/Credentials.ts","../src/ManagementApi.ts","../src/Providers.ts","../src/Deployment.ts","../src/Code.ts","../src/DefaultEnvironmentVariable.ts","../src/Deploy.ts","../src/DeployKey.ts","../src/EnvironmentVariable.ts","../src/PreviewDeployKey.ts","../src/Project.ts"],"mappings":"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"}