@gaganref/confect-alchemy 10.3.1-fork.96 → 10.6.0-fork.2
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/README.md +1 -1
- package/dist/Backend.d.ts.map +1 -1
- package/dist/Backend.js +2 -3
- package/dist/Backend.js.map +1 -1
- package/dist/Code.d.ts +16 -3
- package/dist/Code.d.ts.map +1 -1
- package/dist/Code.js +13 -3
- package/dist/Code.js.map +1 -1
- package/dist/Confect.d.ts.map +1 -1
- package/dist/Confect.js +1 -2
- package/dist/Convex.d.ts.map +1 -1
- package/dist/Convex.js +3 -4
- package/dist/ConvexClient.d.ts +14 -4
- package/dist/ConvexClient.d.ts.map +1 -1
- package/dist/ConvexClient.js +44 -36
- package/dist/ConvexClient.js.map +1 -1
- package/dist/DeployKey.d.ts +22 -12
- package/dist/DeployKey.d.ts.map +1 -1
- package/dist/DeployKey.js +41 -29
- package/dist/DeployKey.js.map +1 -1
- package/dist/Deployment.d.ts +19 -10
- package/dist/Deployment.d.ts.map +1 -1
- package/dist/Deployment.js +22 -19
- package/dist/Deployment.js.map +1 -1
- package/dist/EnvironmentVariables.d.ts +23 -31
- package/dist/EnvironmentVariables.d.ts.map +1 -1
- package/dist/EnvironmentVariables.js +21 -20
- package/dist/EnvironmentVariables.js.map +1 -1
- package/dist/Project.d.ts +15 -10
- package/dist/Project.d.ts.map +1 -1
- package/dist/Project.js +23 -22
- package/dist/Project.js.map +1 -1
- package/dist/Providers.d.ts +3 -1
- package/dist/Providers.d.ts.map +1 -1
- package/dist/Providers.js +19 -18
- package/dist/Providers.js.map +1 -1
- package/dist/_virtual/_rolldown/runtime.js +5 -6
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/CodeDeployment.d.ts +6 -1
- package/dist/internal/CodeDeployment.d.ts.map +1 -1
- package/dist/internal/CodeDeployment.js +10 -8
- package/dist/internal/CodeDeployment.js.map +1 -1
- package/dist/internal/CommandRunner.d.ts +6 -1
- package/dist/internal/CommandRunner.d.ts.map +1 -1
- package/dist/internal/CommandRunner.js +11 -9
- package/dist/internal/CommandRunner.js.map +1 -1
- package/dist/internal/FileLock.d.ts +7 -3
- package/dist/internal/FileLock.d.ts.map +1 -1
- package/dist/internal/FileLock.js +10 -8
- package/dist/internal/FileLock.js.map +1 -1
- package/dist/internal/Lifecycle.d.ts +3 -1
- package/dist/internal/Lifecycle.d.ts.map +1 -1
- package/dist/internal/Lifecycle.js +3 -4
- package/dist/internal/Lifecycle.js.map +1 -1
- package/dist/internal/LocalBackend.d.ts +7 -3
- package/dist/internal/LocalBackend.d.ts.map +1 -1
- package/dist/internal/LocalBackend.js +26 -18
- package/dist/internal/LocalBackend.js.map +1 -1
- package/dist/internal/LocalSidecar.d.ts +4 -1
- package/dist/internal/LocalSidecar.d.ts.map +1 -1
- package/dist/internal/LocalSidecar.js +4 -2
- package/dist/internal/LocalSidecar.js.map +1 -1
- package/dist/internal/Loopback.d.ts.map +1 -1
- package/dist/internal/Loopback.js +1 -2
- package/dist/internal/MountInit.d.ts +5 -1
- package/dist/internal/MountInit.d.ts.map +1 -1
- package/dist/internal/MountInit.js +5 -4
- package/dist/internal/MountInit.js.map +1 -1
- package/dist/internal/PushLock.d.ts +7 -3
- package/dist/internal/PushLock.d.ts.map +1 -1
- package/dist/internal/PushLock.js +7 -6
- package/dist/internal/PushLock.js.map +1 -1
- package/dist/internal/ResourceIdentity.d.ts.map +1 -1
- package/dist/internal/ResourceIdentity.js +5 -3
- package/dist/internal/ResourceIdentity.js.map +1 -1
- package/dist/internal/UserCache.d.ts +2 -0
- package/dist/internal/UserCache.d.ts.map +1 -1
- package/dist/internal/UserCache.js +5 -4
- package/dist/internal/UserCache.js.map +1 -1
- package/dist/internal/Zip.d.ts +5 -1
- package/dist/internal/Zip.d.ts.map +1 -1
- package/dist/internal/Zip.js +9 -8
- package/dist/internal/Zip.js.map +1 -1
- package/package.json +5 -5
- package/src/Backend.ts +7 -6
- package/src/Code.ts +11 -0
- package/src/ConvexClient.ts +87 -74
- package/src/DeployKey.ts +73 -44
- package/src/Deployment.ts +50 -37
- package/src/EnvironmentVariables.ts +30 -27
- package/src/Project.ts +42 -41
- package/src/Providers.ts +2 -0
- package/src/index.ts +3 -0
- package/src/internal/CodeDeployment.ts +17 -11
- package/src/internal/CommandRunner.ts +27 -26
- package/src/internal/FileLock.ts +15 -12
- package/src/internal/Lifecycle.ts +11 -7
- package/src/internal/LocalBackend.ts +45 -39
- package/src/internal/LocalSidecar.ts +3 -0
- package/src/internal/MountInit.ts +8 -6
- package/src/internal/PushLock.ts +13 -11
- package/src/internal/ResourceIdentity.ts +12 -5
- package/src/internal/UserCache.ts +13 -4
- package/src/internal/Zip.ts +13 -8
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Alchemy resources for Convex cloud projects, deployments, deploy keys, environme
|
|
|
6
6
|
import { Confect, Convex } from "@confect/alchemy";
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Use `Convex.providers()` in your Alchemy stack. The integration targets Alchemy `2.0.0-beta.
|
|
9
|
+
Use `Convex.providers()` in your Alchemy stack. The integration targets Alchemy `2.0.0-beta.86` and Effect v4; it does not add Alchemy dependencies to Confect's runtime packages. Plain Convex applications can use `Convex.Code` without the Confect CLI.
|
|
10
10
|
|
|
11
11
|
See the [deployment guide](https://confect.dev/guides/alchemy) for complete examples, credentials, ownership, and deletion policies.
|
|
12
12
|
|
package/dist/Backend.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Backend.d.ts","
|
|
1
|
+
{"version":3,"file":"Backend.d.ts","sources":["../src/Backend.ts"],"names":[],"mappings":"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"}
|
package/dist/Backend.js
CHANGED
|
@@ -3,7 +3,7 @@ import { EnvironmentVariables } from "./EnvironmentVariables.js";
|
|
|
3
3
|
import * as Namespace from "alchemy/Namespace";
|
|
4
4
|
import * as Output from "alchemy/Output";
|
|
5
5
|
import * as Effect from "effect/Effect";
|
|
6
|
-
|
|
6
|
+
// src/Backend.ts
|
|
7
7
|
function Backend(id, props) {
|
|
8
8
|
return backend(id, props);
|
|
9
9
|
}
|
|
@@ -16,7 +16,7 @@ const backend = (id, props) => Namespace.push(id, Effect.gen(function* () {
|
|
|
16
16
|
const code = yield* Code("Code", {
|
|
17
17
|
deployment: {
|
|
18
18
|
name: props.deployment.name,
|
|
19
|
-
url: environment ? Output.map(Output.all(environment.variables, environment.url), ([, url]) => url) : props.deployment.url
|
|
19
|
+
url: environment !== void 0 ? Output.map(Output.all(environment.variables, environment.url), ([, url]) => url) : props.deployment.url
|
|
20
20
|
},
|
|
21
21
|
deployKey: props.deployKey,
|
|
22
22
|
...props.cwd === void 0 ? {} : { cwd: props.cwd },
|
|
@@ -32,7 +32,6 @@ const backend = (id, props) => Namespace.push(id, Effect.gen(function* () {
|
|
|
32
32
|
url: code.url
|
|
33
33
|
};
|
|
34
34
|
}));
|
|
35
|
-
//#endregion
|
|
36
35
|
export { Backend };
|
|
37
36
|
|
|
38
37
|
//# sourceMappingURL=Backend.js.map
|
package/dist/Backend.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Backend.js","names":[],"sources":["../src/Backend.ts"],"sourcesContent":["import type * as Manifest from \"@confect/core/Manifest\";\nimport type { Input } from \"alchemy/Input\";\nimport * as Namespace from \"alchemy/Namespace\";\nimport * as Output from \"alchemy/Output\";\nimport * as Effect from \"effect/Effect\";\nimport type * as Redacted from \"effect/Redacted\";\nimport { Code } from \"./Code.js\";\nimport { EnvironmentVariables } from \"./EnvironmentVariables.js\";\n\ninterface CommonProps {\n readonly deployment: {\n readonly name: Input<string>;\n readonly url: Input<string>;\n };\n readonly deployKey: Input<Redacted.Redacted<string>>;\n readonly cwd?: string;\n}\n\ntype Environment<M extends Manifest.Manifest> = {\n readonly [K in keyof Manifest.Values<M>]: Input<\n Exclude<Manifest.Values<M>[K], undefined>\n >;\n};\n\nexport type BackendProps<M extends Manifest.Manifest | undefined = undefined> =\n CommonProps &\n (M extends Manifest.Manifest\n ? { readonly manifest: M } & ({} extends Manifest.Values<M>\n ? { readonly env?: Environment<NoInfer<M>> }\n : { readonly env: Environment<NoInfer<M>> })\n : {\n readonly manifest?: never;\n readonly env?: Readonly<\n Record<string, Input<string | Redacted.Redacted<string>>>\n >;\n });\n\n/**\n * Deploy a declared backend with env typed by its generated manifest.\n */\nexport function Backend<\n const M extends Manifest.Manifest,\n const E extends Environment<NoInfer<M>> = Environment<NoInfer<M>>,\n>(\n id: string,\n props: BackendProps<M> & {\n readonly env?: E &\n Readonly<Record<Exclude<keyof E, keyof M[\"env\"]>, never>>;\n },\n): ReturnType<typeof backend>;\nexport function Backend(\n id: string,\n props: BackendProps,\n): ReturnType<typeof backend>;\nexport function Backend(\n id: string,\n props: CommonProps & {\n readonly env?: Readonly<\n Record<string, Input<string | Redacted.Redacted<string>>>\n >;\n },\n): ReturnType<typeof backend> {\n return backend(id, props);\n}\n\nconst backend = (\n id: string,\n props: CommonProps & {\n readonly env?: Readonly<\n Record<string, Input<string | Redacted.Redacted<string>>>\n >;\n },\n) =>\n Namespace.push(\n id,\n Effect.gen(function* () {\n const environment =\n props.env === undefined\n ? undefined\n : yield* EnvironmentVariables(\"Environment\", {\n url: props.deployment.url,\n deployKey: props.deployKey,\n variables: props.env,\n });\n const code = yield* Code(\"Code\", {\n deployment: {\n name: props.deployment.name,\n url
|
|
1
|
+
{"version":3,"file":"Backend.js","names":[],"sources":["../src/Backend.ts"],"sourcesContent":["import type * as Manifest from \"@confect/core/Manifest\";\nimport type { Input } from \"alchemy/Input\";\nimport * as Namespace from \"alchemy/Namespace\";\nimport * as Output from \"alchemy/Output\";\nimport * as Effect from \"effect/Effect\";\nimport type * as Redacted from \"effect/Redacted\";\nimport { Code } from \"./Code.js\";\nimport { EnvironmentVariables } from \"./EnvironmentVariables.js\";\n\ninterface CommonProps {\n readonly deployment: {\n readonly name: Input<string>;\n readonly url: Input<string>;\n };\n readonly deployKey: Input<Redacted.Redacted<string>>;\n readonly cwd?: string;\n}\n\ntype Environment<M extends Manifest.Manifest> = {\n readonly [K in keyof Manifest.Values<M>]: Input<\n Exclude<Manifest.Values<M>[K], undefined>\n >;\n};\n\nexport type BackendProps<M extends Manifest.Manifest | undefined = undefined> =\n CommonProps &\n (M extends Manifest.Manifest\n ? { readonly manifest: M } & ({} extends Manifest.Values<M>\n ? { readonly env?: Environment<NoInfer<M>> }\n : { readonly env: Environment<NoInfer<M>> })\n : {\n readonly manifest?: never;\n readonly env?: Readonly<\n Record<string, Input<string | Redacted.Redacted<string>>>\n >;\n });\n\n/**\n * Deploy a declared backend with env typed by its generated manifest.\n */\nexport function Backend<\n const M extends Manifest.Manifest,\n const E extends Environment<NoInfer<M>> = Environment<NoInfer<M>>,\n>(\n id: string,\n props: BackendProps<M> & {\n readonly env?: E &\n Readonly<Record<Exclude<keyof E, keyof M[\"env\"]>, never>>;\n },\n): ReturnType<typeof backend>;\nexport function Backend(\n id: string,\n props: BackendProps,\n): ReturnType<typeof backend>;\nexport function Backend(\n id: string,\n props: CommonProps & {\n readonly env?: Readonly<\n Record<string, Input<string | Redacted.Redacted<string>>>\n >;\n },\n): ReturnType<typeof backend> {\n return backend(id, props);\n}\n\nconst backend = (\n id: string,\n props: CommonProps & {\n readonly env?: Readonly<\n Record<string, Input<string | Redacted.Redacted<string>>>\n >;\n },\n) =>\n Namespace.push(\n id,\n Effect.gen(function* () {\n const environment =\n props.env === undefined\n ? undefined\n : yield* EnvironmentVariables(\"Environment\", {\n url: props.deployment.url,\n deployKey: props.deployKey,\n variables: props.env,\n });\n const code = yield* Code(\"Code\", {\n deployment: {\n name: props.deployment.name,\n url:\n environment !== undefined\n ? Output.map(\n Output.all(environment.variables, environment.url),\n ([, url]) => url,\n )\n : props.deployment.url,\n },\n deployKey: props.deployKey,\n ...(props.cwd === undefined ? {} : { cwd: props.cwd }),\n prepare: { command: \"confect\", args: [\"codegen\"] },\n });\n return { code, environment, name: code.name, url: code.url };\n }),\n );\n"],"mappings":";;;;;;AAsDA,SAAgB,QACd,IACA,OAK4B;CAC5B,OAAO,QAAQ,IAAI,KAAK;AAC1B;AAEA,MAAM,WACJ,IACA,UAMA,UAAU,KACR,IACA,OAAO,IAAI,aAAa;CACtB,MAAM,cACJ,MAAM,QAAQ,KAAA,IACV,KAAA,IACA,OAAO,qBAAqB,eAAe;EACzC,KAAK,MAAM,WAAW;EACtB,WAAW,MAAM;EACjB,WAAW,MAAM;CACnB,CAAC;CACP,MAAM,OAAO,OAAO,KAAK,QAAQ;EAC/B,YAAY;GACV,MAAM,MAAM,WAAW;GACvB,KACE,gBAAgB,KAAA,IACZ,OAAO,IACL,OAAO,IAAI,YAAY,WAAW,YAAY,GAAG,IAChD,GAAG,SAAS,GACf,IACA,MAAM,WAAW;EACzB;EACA,WAAW,MAAM;EACjB,GAAI,MAAM,QAAQ,KAAA,IAAY,CAAC,IAAI,EAAE,KAAK,MAAM,IAAI;EACpD,SAAS;GAAE,SAAS;GAAW,MAAM,CAAC,SAAS;EAAE;CACnD,CAAC;CACD,OAAO;EAAE;EAAM;EAAa,MAAM,KAAK;EAAM,KAAK,KAAK;CAAI;AAC7D,CAAC,CACH"}
|
package/dist/Code.d.ts
CHANGED
|
@@ -23,7 +23,10 @@ export interface CodeAttributes {
|
|
|
23
23
|
readonly url: string;
|
|
24
24
|
}
|
|
25
25
|
export type Code = Resource<"Convex.Code", CodeProps, CodeAttributes, never, Providers>;
|
|
26
|
-
export declare const Code: import("alchemy
|
|
26
|
+
export declare const Code: import("alchemy").ResourceClass<Code>;
|
|
27
|
+
/**
|
|
28
|
+
* @stability unstable
|
|
29
|
+
*/
|
|
27
30
|
export declare const provider: Effect.Effect<{
|
|
28
31
|
read: ({ output }: {
|
|
29
32
|
id: string;
|
|
@@ -31,6 +34,7 @@ export declare const provider: Effect.Effect<{
|
|
|
31
34
|
instanceId: string;
|
|
32
35
|
olds: CodeProps;
|
|
33
36
|
output: CodeAttributes | undefined;
|
|
37
|
+
previous?: CodeAttributes;
|
|
34
38
|
}) => Effect.Effect<CodeAttributes | undefined, never, never>;
|
|
35
39
|
diff: () => Effect.Effect<{
|
|
36
40
|
action: "update";
|
|
@@ -43,7 +47,7 @@ export declare const provider: Effect.Effect<{
|
|
|
43
47
|
olds: CodeProps | undefined;
|
|
44
48
|
output: CodeAttributes | undefined;
|
|
45
49
|
session: import("alchemy/Report").ScopedPlanStatusSession;
|
|
46
|
-
bindings: import("alchemy
|
|
50
|
+
bindings: import("alchemy").ResourceBinding<never>[];
|
|
47
51
|
}) => Effect.Effect<{
|
|
48
52
|
name: string;
|
|
49
53
|
url: string;
|
|
@@ -52,6 +56,8 @@ export declare const provider: Effect.Effect<{
|
|
|
52
56
|
}, never, CommandRunner | ConvexClient | FileSystem.FileSystem | Path.Path | PushLock>;
|
|
53
57
|
/**
|
|
54
58
|
* Under `alchemy dev`, pushes go to the local backend's self-hosted target.
|
|
59
|
+
*
|
|
60
|
+
* @stability unstable
|
|
55
61
|
*/
|
|
56
62
|
export declare const localProvider: Effect.Effect<{
|
|
57
63
|
read: ({ output }: {
|
|
@@ -60,6 +66,7 @@ export declare const localProvider: Effect.Effect<{
|
|
|
60
66
|
instanceId: string;
|
|
61
67
|
olds: CodeProps;
|
|
62
68
|
output: CodeAttributes | undefined;
|
|
69
|
+
previous?: CodeAttributes;
|
|
63
70
|
}) => Effect.Effect<CodeAttributes | undefined, never, never>;
|
|
64
71
|
diff: () => Effect.Effect<{
|
|
65
72
|
action: "update";
|
|
@@ -72,13 +79,19 @@ export declare const localProvider: Effect.Effect<{
|
|
|
72
79
|
olds: CodeProps | undefined;
|
|
73
80
|
output: CodeAttributes | undefined;
|
|
74
81
|
session: import("alchemy/Report").ScopedPlanStatusSession;
|
|
75
|
-
bindings: import("alchemy
|
|
82
|
+
bindings: import("alchemy").ResourceBinding<never>[];
|
|
76
83
|
}) => Effect.Effect<{
|
|
77
84
|
name: string;
|
|
78
85
|
url: string;
|
|
79
86
|
}, import("./internal/CommandRunner.js").CommandError | import("./internal/CodeDeployment.js").InvalidDeploymentTarget | import("./internal/MountInit.js").MountInitFailed | import("./internal/PushLock.js").PushLockError, never>;
|
|
80
87
|
delete: () => Effect.Effect<void, never, never>;
|
|
81
88
|
}, never, CommandRunner | ConvexClient | FileSystem.FileSystem | Path.Path | PushLock>;
|
|
89
|
+
/**
|
|
90
|
+
* @stability unstable
|
|
91
|
+
*/
|
|
82
92
|
export declare const layer: Layer.Layer<Provider.Provider<Code>, never, CommandRunner | ConvexClient | FileSystem.FileSystem | Path.Path | PushLock>;
|
|
93
|
+
/**
|
|
94
|
+
* @stability unstable
|
|
95
|
+
*/
|
|
83
96
|
export declare const localLayer: Layer.Layer<Provider.Provider<Code>, never, CommandRunner | FileSystem.FileSystem | Path.Path | PushLock>;
|
|
84
97
|
//# sourceMappingURL=Code.d.ts.map
|
package/dist/Code.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Code.d.ts","
|
|
1
|
+
{"version":3,"file":"Code.d.ts","sources":["../src/Code.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AAEpC,OAAO,KAAK,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,YAAY,EAA8B,MAAM,mBAAmB,CAAC;AAC7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EACL,aAAa,EACb,KAAK,cAAc,EACpB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,UAAU,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IACrE,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC9C,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC;CACnC;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,IAAI,GAAG,QAAQ,CACzB,aAAa,EACb,SAAS,EACT,cAAc,EACd,KAAK,EACL,SAAS,CACV,CAAC;AACF,eAAO,MAAM,IAAI,uCAAgC,CAAC;AAwBlD;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;sFAAe,CAAC;AACrC;;;;GAIG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;sFAAgB,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,KAAK,0HAAkC,CAAC;AACrD;;GAEG;AACH,eAAO,MAAM,UAAU,2GAMtB,CAAC"}
|
package/dist/Code.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ConvexClient, layer as layer$1 } from "./ConvexClient.js";
|
|
2
|
+
import { deploy } from "./internal/CodeDeployment.js";
|
|
2
3
|
import { CommandRunner } from "./internal/CommandRunner.js";
|
|
3
4
|
import { PushLock } from "./internal/PushLock.js";
|
|
4
|
-
import { deploy } from "./internal/CodeDeployment.js";
|
|
5
5
|
import * as Effect from "effect/Effect";
|
|
6
6
|
import * as Provider from "alchemy/Provider";
|
|
7
7
|
import { Resource } from "alchemy/Resource";
|
|
@@ -9,7 +9,7 @@ import * as FileSystem from "effect/FileSystem";
|
|
|
9
9
|
import * as Layer from "effect/Layer";
|
|
10
10
|
import * as Path from "effect/Path";
|
|
11
11
|
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
12
|
-
|
|
12
|
+
// src/Code.ts
|
|
13
13
|
const Code = Resource("Convex.Code");
|
|
14
14
|
const make = (mode) => Effect.gen(function* () {
|
|
15
15
|
const runner = yield* CommandRunner;
|
|
@@ -24,14 +24,24 @@ const make = (mode) => Effect.gen(function* () {
|
|
|
24
24
|
delete: () => Effect.void
|
|
25
25
|
};
|
|
26
26
|
});
|
|
27
|
+
/**
|
|
28
|
+
* @stability unstable
|
|
29
|
+
*/
|
|
27
30
|
const provider = make("live");
|
|
28
31
|
/**
|
|
29
32
|
* Under `alchemy dev`, pushes go to the local backend's self-hosted target.
|
|
33
|
+
*
|
|
34
|
+
* @stability unstable
|
|
30
35
|
*/
|
|
31
36
|
const localProvider = make("local");
|
|
37
|
+
/**
|
|
38
|
+
* @stability unstable
|
|
39
|
+
*/
|
|
32
40
|
const layer = Provider.effect(Code, provider);
|
|
41
|
+
/**
|
|
42
|
+
* @stability unstable
|
|
43
|
+
*/
|
|
33
44
|
const localLayer = Provider.effect(Code, localProvider).pipe(Layer.provide(layer$1({ mode: "local" }).pipe(Layer.provide(FetchHttpClient.layer))));
|
|
34
|
-
//#endregion
|
|
35
45
|
export { Code, layer, localLayer, localProvider, provider };
|
|
36
46
|
|
|
37
47
|
//# sourceMappingURL=Code.js.map
|
package/dist/Code.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Code.js","names":["ConvexClientLayer"],"sources":["../src/Code.ts"],"sourcesContent":["import * as Provider from \"alchemy/Provider\";\nimport type { ProviderMode } from \"alchemy/ProviderMode\";\nimport { Resource } from \"alchemy/Resource\";\nimport * as Effect from \"effect/Effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport * as Layer from \"effect/Layer\";\nimport * as Path from \"effect/Path\";\nimport * as FetchHttpClient from \"effect/http/FetchHttpClient\";\nimport type * as Redacted from \"effect/Redacted\";\nimport { ConvexClient, layer as ConvexClientLayer } from \"./ConvexClient.js\";\nimport type { Providers } from \"./Providers.js\";\nimport { deploy } from \"./internal/CodeDeployment.js\";\nimport {\n CommandRunner,\n type PrepareCommand,\n} from \"./internal/CommandRunner.js\";\nimport { PushLock } from \"./internal/PushLock.js\";\n\nexport interface CodeProps {\n readonly deployment: { readonly name: string; readonly url: string };\n readonly deployKey: Redacted.Redacted<string>;\n readonly cwd?: string;\n readonly prepare?: PrepareCommand;\n}\n\nexport interface CodeAttributes {\n readonly name: string;\n readonly url: string;\n}\n\nexport type Code = Resource<\n \"Convex.Code\",\n CodeProps,\n CodeAttributes,\n never,\n Providers\n>;\nexport const Code = Resource<Code>(\"Convex.Code\");\n\nconst make = (mode: ProviderMode) =>\n Effect.gen(function* () {\n const runner = yield* CommandRunner;\n const lock = yield* PushLock;\n const client = yield* ConvexClient;\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n return {\n read: ({ output }) => Effect.succeed(output),\n diff: () => Effect.succeed({ action: \"update\" }),\n reconcile: ({ news }) =>\n deploy(news, mode).pipe(\n Effect.provideService(CommandRunner, runner),\n Effect.provideService(PushLock, lock),\n Effect.provideService(ConvexClient, client),\n Effect.provideService(FileSystem.FileSystem, fs),\n Effect.provideService(Path.Path, path),\n ),\n delete: () => Effect.void,\n } satisfies Provider.ProviderServiceInput<Code>;\n });\n\nexport const provider = make(\"live\");\n/**\n * Under `alchemy dev`, pushes go to the local backend's self-hosted target.\n */\nexport const localProvider = make(\"local\");\n\nexport const layer = Provider.effect(Code, provider);\nexport const localLayer = Provider.effect(Code, localProvider).pipe(\n Layer.provide(\n ConvexClientLayer({ mode: \"local\" }).pipe(\n Layer.provide(FetchHttpClient.layer),\n ),\n ),\n);\n"],"mappings":";;;;;;;;;;;;AAqCA,MAAa,OAAO,SAAe,aAAa;AAEhD,MAAM,QAAQ,SACZ,OAAO,IAAI,aAAa;CACtB,MAAM,SAAS,OAAO;CACtB,MAAM,OAAO,OAAO;CACpB,MAAM,SAAS,OAAO;CACtB,MAAM,KAAK,OAAO,WAAW;CAC7B,MAAM,OAAO,OAAO,KAAK;CACzB,OAAO;EACL,OAAO,EAAE,aAAa,OAAO,QAAQ,MAAM;EAC3C,YAAY,OAAO,QAAQ,EAAE,QAAQ,SAAS,CAAC;EAC/C,YAAY,EAAE,WACZ,OAAO,MAAM,IAAI,CAAC,CAAC,KACjB,OAAO,eAAe,eAAe,MAAM,GAC3C,OAAO,eAAe,UAAU,IAAI,GACpC,OAAO,eAAe,cAAc,MAAM,GAC1C,OAAO,eAAe,WAAW,YAAY,EAAE,GAC/C,OAAO,eAAe,KAAK,MAAM,IAAI,CACvC;EACF,cAAc,OAAO;CACvB;AACF,CAAC
|
|
1
|
+
{"version":3,"file":"Code.js","names":["ConvexClientLayer"],"sources":["../src/Code.ts"],"sourcesContent":["import * as Provider from \"alchemy/Provider\";\nimport type { ProviderMode } from \"alchemy/ProviderMode\";\nimport { Resource } from \"alchemy/Resource\";\nimport * as Effect from \"effect/Effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport * as Layer from \"effect/Layer\";\nimport * as Path from \"effect/Path\";\nimport * as FetchHttpClient from \"effect/http/FetchHttpClient\";\nimport type * as Redacted from \"effect/Redacted\";\nimport { ConvexClient, layer as ConvexClientLayer } from \"./ConvexClient.js\";\nimport type { Providers } from \"./Providers.js\";\nimport { deploy } from \"./internal/CodeDeployment.js\";\nimport {\n CommandRunner,\n type PrepareCommand,\n} from \"./internal/CommandRunner.js\";\nimport { PushLock } from \"./internal/PushLock.js\";\n\nexport interface CodeProps {\n readonly deployment: { readonly name: string; readonly url: string };\n readonly deployKey: Redacted.Redacted<string>;\n readonly cwd?: string;\n readonly prepare?: PrepareCommand;\n}\n\nexport interface CodeAttributes {\n readonly name: string;\n readonly url: string;\n}\n\nexport type Code = Resource<\n \"Convex.Code\",\n CodeProps,\n CodeAttributes,\n never,\n Providers\n>;\nexport const Code = Resource<Code>(\"Convex.Code\");\n\nconst make = (mode: ProviderMode) =>\n Effect.gen(function* () {\n const runner = yield* CommandRunner;\n const lock = yield* PushLock;\n const client = yield* ConvexClient;\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n return {\n read: ({ output }) => Effect.succeed(output),\n diff: () => Effect.succeed({ action: \"update\" }),\n reconcile: ({ news }) =>\n deploy(news, mode).pipe(\n Effect.provideService(CommandRunner, runner),\n Effect.provideService(PushLock, lock),\n Effect.provideService(ConvexClient, client),\n Effect.provideService(FileSystem.FileSystem, fs),\n Effect.provideService(Path.Path, path),\n ),\n delete: () => Effect.void,\n } satisfies Provider.ProviderServiceInput<Code>;\n });\n\n/**\n * @stability unstable\n */\nexport const provider = make(\"live\");\n/**\n * Under `alchemy dev`, pushes go to the local backend's self-hosted target.\n *\n * @stability unstable\n */\nexport const localProvider = make(\"local\");\n\n/**\n * @stability unstable\n */\nexport const layer = Provider.effect(Code, provider);\n/**\n * @stability unstable\n */\nexport const localLayer = Provider.effect(Code, localProvider).pipe(\n Layer.provide(\n ConvexClientLayer({ mode: \"local\" }).pipe(\n Layer.provide(FetchHttpClient.layer),\n ),\n ),\n);\n"],"mappings":";;;;;;;;;;;;AAqCA,MAAa,OAAO,SAAe,aAAa;AAEhD,MAAM,QAAQ,SACZ,OAAO,IAAI,aAAa;CACtB,MAAM,SAAS,OAAO;CACtB,MAAM,OAAO,OAAO;CACpB,MAAM,SAAS,OAAO;CACtB,MAAM,KAAK,OAAO,WAAW;CAC7B,MAAM,OAAO,OAAO,KAAK;CACzB,OAAO;EACL,OAAO,EAAE,aAAa,OAAO,QAAQ,MAAM;EAC3C,YAAY,OAAO,QAAQ,EAAE,QAAQ,SAAS,CAAC;EAC/C,YAAY,EAAE,WACZ,OAAO,MAAM,IAAI,CAAC,CAAC,KACjB,OAAO,eAAe,eAAe,MAAM,GAC3C,OAAO,eAAe,UAAU,IAAI,GACpC,OAAO,eAAe,cAAc,MAAM,GAC1C,OAAO,eAAe,WAAW,YAAY,EAAE,GAC/C,OAAO,eAAe,KAAK,MAAM,IAAI,CACvC;EACF,cAAc,OAAO;CACvB;AACF,CAAC;;;;AAKH,MAAa,WAAW,KAAK,MAAM;;;;;;AAMnC,MAAa,gBAAgB,KAAK,OAAO;;;;AAKzC,MAAa,QAAQ,SAAS,OAAO,MAAM,QAAQ;;;;AAInD,MAAa,aAAa,SAAS,OAAO,MAAM,aAAa,CAAC,CAAC,KAC7D,MAAM,QACJA,QAAkB,EAAE,MAAM,QAAQ,CAAC,CAAC,CAAC,KACnC,MAAM,QAAQ,gBAAgB,KAAK,CACrC,CACF,CACF"}
|
package/dist/Confect.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Confect.d.ts","
|
|
1
|
+
{"version":3,"file":"Confect.d.ts","sources":["../src/Confect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/Confect.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { Backend } from "./Backend.js";
|
|
3
|
-
|
|
3
|
+
// src/Confect.ts
|
|
4
4
|
var Confect_exports = /* @__PURE__ */ __exportAll({ Backend: () => Backend });
|
|
5
|
-
//#endregion
|
|
6
5
|
export { Backend, Confect_exports };
|
|
7
6
|
|
|
8
7
|
//# sourceMappingURL=Confect.js.map
|
package/dist/Convex.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Convex.d.ts","
|
|
1
|
+
{"version":3,"file":"Convex.d.ts","sources":["../src/Convex.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,YAAY,EACjB,KAAK,iBAAiB,GACvB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,oBAAoB,GAC1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,SAAS,EACT,KAAK,cAAc,EACnB,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,oBAAoB,EACpB,KAAK,yBAAyB,EAC9B,KAAK,8BAA8B,GACpC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/Convex.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { Code } from "./Code.js";
|
|
3
|
-
import { EnvironmentVariables } from "./EnvironmentVariables.js";
|
|
4
2
|
import { Project } from "./Project.js";
|
|
5
3
|
import { Deployment } from "./Deployment.js";
|
|
6
4
|
import { DeployKey } from "./DeployKey.js";
|
|
5
|
+
import { EnvironmentVariables } from "./EnvironmentVariables.js";
|
|
6
|
+
import { Code } from "./Code.js";
|
|
7
7
|
import { Providers, providers } from "./Providers.js";
|
|
8
|
-
|
|
8
|
+
// src/Convex.ts
|
|
9
9
|
var Convex_exports = /* @__PURE__ */ __exportAll({
|
|
10
10
|
Code: () => Code,
|
|
11
11
|
DeployKey: () => DeployKey,
|
|
@@ -15,7 +15,6 @@ var Convex_exports = /* @__PURE__ */ __exportAll({
|
|
|
15
15
|
Providers: () => Providers,
|
|
16
16
|
providers: () => providers
|
|
17
17
|
});
|
|
18
|
-
//#endregion
|
|
19
18
|
export { Code, Convex_exports, DeployKey, Deployment, EnvironmentVariables, Project, Providers, providers };
|
|
20
19
|
|
|
21
20
|
//# sourceMappingURL=Convex.js.map
|
package/dist/ConvexClient.d.ts
CHANGED
|
@@ -31,27 +31,35 @@ declare const ConvexApiError_base: Schema.Class<ConvexApiError, Schema.TaggedStr
|
|
|
31
31
|
operation: Schema.String;
|
|
32
32
|
status: Schema.optionalKey<Schema.Finite>;
|
|
33
33
|
code: Schema.Literals<readonly ["HttpError", "TransportError", "InvalidResponse", "InvalidRequest", "InvalidPagination", "InvalidConfiguration"]>;
|
|
34
|
-
}>, import("effect/Cause").YieldableError
|
|
34
|
+
}>, import("effect/Cause").YieldableError & {
|
|
35
|
+
readonly brand: unique symbol;
|
|
36
|
+
}>;
|
|
35
37
|
export declare class ConvexApiError extends ConvexApiError_base {
|
|
36
38
|
}
|
|
37
39
|
declare const ConvexNotFound_base: Schema.Class<ConvexNotFound, Schema.TaggedStruct<"ConvexNotFound", {
|
|
38
40
|
operation: Schema.String;
|
|
39
41
|
status: Schema.optionalKey<Schema.Finite>;
|
|
40
42
|
code: Schema.Literals<readonly ["HttpError", "TransportError", "InvalidResponse", "InvalidRequest", "InvalidPagination", "InvalidConfiguration"]>;
|
|
41
|
-
}>, import("effect/Cause").YieldableError
|
|
43
|
+
}>, import("effect/Cause").YieldableError & {
|
|
44
|
+
readonly brand: unique symbol;
|
|
45
|
+
}>;
|
|
42
46
|
export declare class ConvexNotFound extends ConvexNotFound_base {
|
|
43
47
|
}
|
|
44
48
|
declare const ConvexConflict_base: Schema.Class<ConvexConflict, Schema.TaggedStruct<"ConvexConflict", {
|
|
45
49
|
operation: Schema.String;
|
|
46
50
|
status: Schema.optionalKey<Schema.Finite>;
|
|
47
51
|
code: Schema.Literals<readonly ["HttpError", "TransportError", "InvalidResponse", "InvalidRequest", "InvalidPagination", "InvalidConfiguration"]>;
|
|
48
|
-
}>, import("effect/Cause").YieldableError
|
|
52
|
+
}>, import("effect/Cause").YieldableError & {
|
|
53
|
+
readonly brand: unique symbol;
|
|
54
|
+
}>;
|
|
49
55
|
export declare class ConvexConflict extends ConvexConflict_base {
|
|
50
56
|
}
|
|
51
57
|
declare const ConvexFunctionError_base: Schema.Class<ConvexFunctionError, Schema.TaggedStruct<"ConvexFunctionError", {
|
|
52
58
|
readonly functionPath: Schema.String;
|
|
53
59
|
readonly errorMessage: Schema.String;
|
|
54
|
-
}>, import("effect/Cause").YieldableError
|
|
60
|
+
}>, import("effect/Cause").YieldableError & {
|
|
61
|
+
readonly brand: unique symbol;
|
|
62
|
+
}>;
|
|
55
63
|
/**
|
|
56
64
|
* A function the deployment ran failed, with the message Convex reports.
|
|
57
65
|
*/
|
|
@@ -220,6 +228,8 @@ export declare class ConvexClient extends ConvexClient_base {
|
|
|
220
228
|
/**
|
|
221
229
|
* `mode: "local"` sends deployment requests only to a loopback backend over
|
|
222
230
|
* HTTP; the default accepts only Convex cloud HTTPS origins.
|
|
231
|
+
*
|
|
232
|
+
* @stability unstable
|
|
223
233
|
*/
|
|
224
234
|
export declare const layer: (options?: {
|
|
225
235
|
readonly token?: Redacted.Redacted<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConvexClient.d.ts","
|
|
1
|
+
{"version":3,"file":"ConvexClient.d.ts","sources":["../src/ConvexClient.ts"],"names":[],"mappings":"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"}
|
package/dist/ConvexClient.js
CHANGED
|
@@ -8,7 +8,11 @@ import * as Redacted from "effect/Redacted";
|
|
|
8
8
|
import * as Schema from "effect/Schema";
|
|
9
9
|
import * as HttpClient from "effect/http/HttpClient";
|
|
10
10
|
import * as HttpClientRequest from "effect/http/HttpClientRequest";
|
|
11
|
-
|
|
11
|
+
import * as String from "effect/String";
|
|
12
|
+
import { pipe } from "effect/Function";
|
|
13
|
+
import * as Array from "effect/Array";
|
|
14
|
+
import * as Rec from "effect/Record";
|
|
15
|
+
// src/ConvexClient.ts
|
|
12
16
|
const errorFields = {
|
|
13
17
|
operation: Schema.String,
|
|
14
18
|
status: Schema.optionalKey(Schema.Finite),
|
|
@@ -45,15 +49,15 @@ const ProjectSchema = Schema.Struct({
|
|
|
45
49
|
teamId: Schema.Finite,
|
|
46
50
|
teamSlug: Schema.String,
|
|
47
51
|
createTime: Schema.Finite,
|
|
48
|
-
prodDeploymentName: Schema.
|
|
49
|
-
devDeploymentName: Schema.
|
|
52
|
+
prodDeploymentName: Schema.String.pipe(Schema.NullOr, Schema.optionalKey),
|
|
53
|
+
devDeploymentName: Schema.String.pipe(Schema.NullOr, Schema.optionalKey)
|
|
50
54
|
});
|
|
51
55
|
const CreatedProjectSchema = Schema.Struct({
|
|
52
56
|
id: Schema.Finite,
|
|
53
57
|
projectId: Schema.Finite,
|
|
54
58
|
slug: Schema.String,
|
|
55
|
-
deploymentName: Schema.
|
|
56
|
-
deploymentUrl: Schema.
|
|
59
|
+
deploymentName: Schema.String.pipe(Schema.NullOr, Schema.optionalKey),
|
|
60
|
+
deploymentUrl: Schema.String.pipe(Schema.NullOr, Schema.optionalKey)
|
|
57
61
|
});
|
|
58
62
|
const deploymentFields = {
|
|
59
63
|
name: Schema.String,
|
|
@@ -65,14 +69,14 @@ const deploymentFields = {
|
|
|
65
69
|
"custom"
|
|
66
70
|
]),
|
|
67
71
|
projectId: Schema.Finite,
|
|
68
|
-
previewIdentifier: Schema.
|
|
72
|
+
previewIdentifier: Schema.String.pipe(Schema.NullOr, Schema.optionalKey)
|
|
69
73
|
};
|
|
70
74
|
const DeploymentSchema = Schema.Union([Schema.Struct({
|
|
71
75
|
...deploymentFields,
|
|
72
76
|
kind: Schema.Literal("cloud"),
|
|
73
77
|
id: Schema.Finite,
|
|
74
|
-
lastDeployTime: Schema.
|
|
75
|
-
creator: Schema.
|
|
78
|
+
lastDeployTime: Schema.Finite.pipe(Schema.NullOr, Schema.optionalKey),
|
|
79
|
+
creator: Schema.Finite.pipe(Schema.NullOr, Schema.optionalKey),
|
|
76
80
|
region: Schema.Literals([
|
|
77
81
|
"aws-us-east-1",
|
|
78
82
|
"aws-eu-west-1",
|
|
@@ -81,11 +85,11 @@ const DeploymentSchema = Schema.Union([Schema.Struct({
|
|
|
81
85
|
]),
|
|
82
86
|
isDefault: Schema.Boolean,
|
|
83
87
|
reference: Schema.String,
|
|
84
|
-
dashboardEditConfirmation: Schema.
|
|
88
|
+
dashboardEditConfirmation: Schema.Boolean.pipe(Schema.NullOr, Schema.optionalKey),
|
|
85
89
|
deploymentUrl: Schema.String,
|
|
86
|
-
expiresAt: Schema.
|
|
90
|
+
expiresAt: Schema.Finite.pipe(Schema.NullOr, Schema.optionalKey),
|
|
87
91
|
class: Schema.String,
|
|
88
|
-
sendLogsToClient: Schema.
|
|
92
|
+
sendLogsToClient: Schema.Boolean.pipe(Schema.NullOr, Schema.optionalKey)
|
|
89
93
|
}), Schema.Struct({
|
|
90
94
|
...deploymentFields,
|
|
91
95
|
kind: Schema.Literal("local"),
|
|
@@ -98,23 +102,23 @@ const DeployKeySchema = Schema.Struct({
|
|
|
98
102
|
id: Schema.Finite,
|
|
99
103
|
name: Schema.String,
|
|
100
104
|
creationTime: Schema.Finite,
|
|
101
|
-
lastUsedTime: Schema.
|
|
102
|
-
expiresAt: Schema.
|
|
103
|
-
creator: Schema.
|
|
104
|
-
managedBy: Schema.
|
|
105
|
+
lastUsedTime: Schema.Finite.pipe(Schema.NullOr, Schema.optionalKey),
|
|
106
|
+
expiresAt: Schema.Finite.pipe(Schema.NullOr, Schema.optionalKey),
|
|
107
|
+
creator: Schema.Finite.pipe(Schema.NullOr, Schema.optionalKey),
|
|
108
|
+
managedBy: Schema.Union([Schema.Literal("vercel"), Schema.Struct({ oauthApp: Schema.String })]).pipe(Schema.NullOr, Schema.optionalKey),
|
|
105
109
|
allowedActions: Schema.Array(Schema.String)
|
|
106
110
|
});
|
|
107
111
|
const ProjectsPageSchema = Schema.Struct({
|
|
108
112
|
items: Schema.Array(ProjectSchema),
|
|
109
113
|
pagination: Schema.Struct({
|
|
110
114
|
hasMore: Schema.Boolean,
|
|
111
|
-
nextCursor: Schema.
|
|
115
|
+
nextCursor: Schema.String.pipe(Schema.NullOr, Schema.optionalKey)
|
|
112
116
|
})
|
|
113
117
|
});
|
|
114
118
|
const make = Effect.fn("ConvexClient.make")(function* (options) {
|
|
115
119
|
const http = yield* HttpClient.HttpClient;
|
|
116
120
|
const managementAuthorization = Effect.gen(function* () {
|
|
117
|
-
const token = options?.token ?? (yield* Config.Redacted("CONVEX_ACCESS_TOKEN").pipe(Effect.mapError(() =>
|
|
121
|
+
const token = options?.token ?? (yield* Config.Redacted("CONVEX_ACCESS_TOKEN").pipe(Effect.mapError(() => ConvexApiError.make({
|
|
118
122
|
operation: "configure",
|
|
119
123
|
code: "InvalidConfiguration"
|
|
120
124
|
}))));
|
|
@@ -123,25 +127,25 @@ const make = Effect.fn("ConvexClient.make")(function* (options) {
|
|
|
123
127
|
const baseUrl = "https://api.convex.dev/v1";
|
|
124
128
|
const send = Effect.fn("ConvexClient.request")(function* (operation, method, url, authorization, body) {
|
|
125
129
|
let request = HttpClientRequest.make(method)(url).pipe(HttpClientRequest.setHeader("authorization", Redacted.value(authorization)), HttpClientRequest.acceptJson);
|
|
126
|
-
if (body !== void 0) request = yield* HttpClientRequest.bodyJson(request, body).pipe(Effect.mapError(() =>
|
|
130
|
+
if (body !== void 0) request = yield* HttpClientRequest.bodyJson(request, body).pipe(Effect.mapError(() => ConvexApiError.make({
|
|
127
131
|
operation,
|
|
128
132
|
code: "InvalidRequest"
|
|
129
133
|
})));
|
|
130
|
-
const response = yield* http.execute(request).pipe(Effect.provideService(FetchHttpClient.RequestInit, { redirect: "manual" }), Effect.mapError(() =>
|
|
134
|
+
const response = yield* http.execute(request).pipe(Effect.provideService(FetchHttpClient.RequestInit, { redirect: "manual" }), Effect.mapError(() => ConvexApiError.make({
|
|
131
135
|
operation,
|
|
132
136
|
code: "TransportError"
|
|
133
137
|
})));
|
|
134
|
-
if (response.status === 404) return yield*
|
|
138
|
+
if (response.status === 404) return yield* ConvexNotFound.make({
|
|
135
139
|
operation,
|
|
136
140
|
status: 404,
|
|
137
141
|
code: "HttpError"
|
|
138
142
|
});
|
|
139
|
-
if (response.status === 409) return yield*
|
|
143
|
+
if (response.status === 409) return yield* ConvexConflict.make({
|
|
140
144
|
operation,
|
|
141
145
|
status: 409,
|
|
142
146
|
code: "HttpError"
|
|
143
147
|
});
|
|
144
|
-
if (response.status < 200 || response.status >= 300) return yield*
|
|
148
|
+
if (response.status < 200 || response.status >= 300) return yield* ConvexApiError.make({
|
|
145
149
|
operation,
|
|
146
150
|
status: response.status,
|
|
147
151
|
code: "HttpError"
|
|
@@ -149,7 +153,7 @@ const make = Effect.fn("ConvexClient.make")(function* (options) {
|
|
|
149
153
|
return response;
|
|
150
154
|
});
|
|
151
155
|
const decode = Effect.fn("ConvexClient.decode")(function* (operation, response, schema) {
|
|
152
|
-
const invalidResponse = () =>
|
|
156
|
+
const invalidResponse = () => ConvexApiError.make({
|
|
153
157
|
operation,
|
|
154
158
|
status: response.status,
|
|
155
159
|
code: "InvalidResponse"
|
|
@@ -158,14 +162,16 @@ const make = Effect.fn("ConvexClient.make")(function* (options) {
|
|
|
158
162
|
return yield* Schema.decodeEffect(schema)(body).pipe(Effect.mapError(invalidResponse));
|
|
159
163
|
});
|
|
160
164
|
const management = Effect.fn("ConvexClient.management")(function* (operation, method, path, schema, body) {
|
|
161
|
-
const
|
|
165
|
+
const managementAuthorizationValue = yield* managementAuthorization;
|
|
166
|
+
const response = yield* send(operation, method, `${baseUrl}${path}`, managementAuthorizationValue, body);
|
|
162
167
|
return yield* decode(operation, response, schema);
|
|
163
168
|
});
|
|
164
169
|
const managementVoid = Effect.fn("ConvexClient.managementVoid")(function* (operation, method, path, body) {
|
|
165
|
-
|
|
170
|
+
const managementAuthorizationValue = yield* managementAuthorization;
|
|
171
|
+
yield* send(operation, method, `${baseUrl}${path}`, managementAuthorizationValue, body);
|
|
166
172
|
});
|
|
167
173
|
const deploymentUrl = Effect.fn("ConvexClient.deploymentUrl")(function* (operation, url) {
|
|
168
|
-
const invalidUrl = () =>
|
|
174
|
+
const invalidUrl = () => ConvexApiError.make({
|
|
169
175
|
operation,
|
|
170
176
|
code: "InvalidRequest"
|
|
171
177
|
});
|
|
@@ -177,7 +183,7 @@ const make = Effect.fn("ConvexClient.make")(function* (options) {
|
|
|
177
183
|
try: () => new URL(url),
|
|
178
184
|
catch: invalidUrl
|
|
179
185
|
});
|
|
180
|
-
if (parsed.protocol !== "https:" || parsed.username !== "" || parsed.password !== "" || parsed.port !== "" || parsed.search !== "" || parsed.hash !== "" || parsed.pathname !== "/" || !/^[a-z0-9-]+(?:\.(?:eu-west-1|ap-southeast-2|ca-central-1))?\.convex\.cloud$/.test(parsed.hostname) || url.replace(/\/$/, "") !== parsed.origin) return yield* invalidUrl();
|
|
186
|
+
if (parsed.protocol !== "https:" || parsed.username !== "" || parsed.password !== "" || parsed.port !== "" || parsed.search !== "" || parsed.hash !== "" || parsed.pathname !== "/" || !/^[a-z0-9-]+(?:\.(?:eu-west-1|ap-southeast-2|ca-central-1))?\.convex\.cloud$/.test(parsed.hostname) || pipe(url, String.replace(/\/$/, "")) !== parsed.origin) return yield* invalidUrl();
|
|
181
187
|
return `${parsed.origin}/api/v1`;
|
|
182
188
|
});
|
|
183
189
|
return {
|
|
@@ -187,27 +193,28 @@ const make = Effect.fn("ConvexClient.make")(function* (options) {
|
|
|
187
193
|
*/
|
|
188
194
|
runFunction: Effect.fn("ConvexClient.runFunction")(function* (url, key, functionPath, args, componentPath) {
|
|
189
195
|
const operation = "runFunction";
|
|
190
|
-
const
|
|
196
|
+
const deploymentUrlResult = yield* deploymentUrl(operation, url);
|
|
197
|
+
const origin = pipe(deploymentUrlResult, String.replace(/\/api\/v1$/, ""));
|
|
191
198
|
const request = yield* HttpClientRequest.post(`${origin}/api/function`).pipe(HttpClientRequest.setHeader("authorization", `Convex ${Redacted.value(key)}`), HttpClientRequest.acceptJson, HttpClientRequest.bodyJson({
|
|
192
199
|
path: functionPath,
|
|
193
200
|
args,
|
|
194
201
|
format: "json",
|
|
195
202
|
...componentPath === void 0 ? {} : { componentPath }
|
|
196
|
-
}), Effect.mapError(() =>
|
|
203
|
+
}), Effect.mapError(() => ConvexApiError.make({
|
|
197
204
|
operation,
|
|
198
205
|
code: "InvalidRequest"
|
|
199
206
|
})));
|
|
200
|
-
const response = yield* http.execute(request).pipe(Effect.provideService(FetchHttpClient.RequestInit, { redirect: "manual" }), Effect.mapError(() =>
|
|
207
|
+
const response = yield* http.execute(request).pipe(Effect.provideService(FetchHttpClient.RequestInit, { redirect: "manual" }), Effect.mapError(() => ConvexApiError.make({
|
|
201
208
|
operation,
|
|
202
209
|
code: "TransportError"
|
|
203
210
|
})));
|
|
204
|
-
if (response.status !== 200 && response.status !== 560) return yield*
|
|
211
|
+
if (response.status !== 200 && response.status !== 560) return yield* ConvexApiError.make({
|
|
205
212
|
operation,
|
|
206
213
|
status: response.status,
|
|
207
214
|
code: "HttpError"
|
|
208
215
|
});
|
|
209
216
|
const result = yield* decode(operation, response, FunctionResponse);
|
|
210
|
-
if (result.status === "error") return yield*
|
|
217
|
+
if (result.status === "error") return yield* ConvexFunctionError.make({
|
|
211
218
|
functionPath,
|
|
212
219
|
errorMessage: result.errorMessage
|
|
213
220
|
});
|
|
@@ -222,7 +229,7 @@ const make = Effect.fn("ConvexClient.make")(function* (options) {
|
|
|
222
229
|
projects.push(...page.items);
|
|
223
230
|
if (!page.pagination.hasMore) return projects;
|
|
224
231
|
const nextCursor = page.pagination.nextCursor;
|
|
225
|
-
if (
|
|
232
|
+
if (nextCursor === void 0 || nextCursor === null || nextCursor === "" || seenCursors.has(nextCursor)) return yield* ConvexApiError.make({
|
|
226
233
|
operation: "listProjects",
|
|
227
234
|
code: "InvalidPagination"
|
|
228
235
|
});
|
|
@@ -248,10 +255,10 @@ const make = Effect.fn("ConvexClient.make")(function* (options) {
|
|
|
248
255
|
listEnvironmentVariables: Effect.fn("ConvexClient.listEnvironmentVariables")(function* (url, key) {
|
|
249
256
|
const response = yield* send("listEnvironmentVariables", "GET", `${yield* deploymentUrl("listEnvironmentVariables", url)}/list_environment_variables`, Redacted.make(`Convex ${Redacted.value(key)}`));
|
|
250
257
|
const result = yield* decode("listEnvironmentVariables", response, Schema.Struct({ environmentVariables: Schema.Record(Schema.String, Schema.String) }));
|
|
251
|
-
return
|
|
258
|
+
return Rec.fromEntries(Array.map(Rec.toEntries(result.environmentVariables), ([name, value]) => [name, Redacted.make(value)]));
|
|
252
259
|
}),
|
|
253
260
|
updateEnvironmentVariables: Effect.fn("ConvexClient.updateEnvironmentVariables")(function* (url, key, changes) {
|
|
254
|
-
yield* send("updateEnvironmentVariables", "POST", `${yield* deploymentUrl("updateEnvironmentVariables", url)}/update_environment_variables`, Redacted.make(`Convex ${Redacted.value(key)}`), { changes:
|
|
261
|
+
yield* send("updateEnvironmentVariables", "POST", `${yield* deploymentUrl("updateEnvironmentVariables", url)}/update_environment_variables`, Redacted.make(`Convex ${Redacted.value(key)}`), { changes: Array.map(changes, ({ name, value }) => ({
|
|
255
262
|
name,
|
|
256
263
|
...value === void 0 ? {} : { value: Redacted.isRedacted(value) ? Redacted.value(value) : value }
|
|
257
264
|
})) });
|
|
@@ -262,9 +269,10 @@ var ConvexClient = class extends Context.Service()("@confect/alchemy/ConvexClien
|
|
|
262
269
|
/**
|
|
263
270
|
* `mode: "local"` sends deployment requests only to a loopback backend over
|
|
264
271
|
* HTTP; the default accepts only Convex cloud HTTPS origins.
|
|
272
|
+
*
|
|
273
|
+
* @stability unstable
|
|
265
274
|
*/
|
|
266
275
|
const layer = (options) => Layer.effect(ConvexClient, make(options).pipe(Effect.map(ConvexClient.of)));
|
|
267
|
-
//#endregion
|
|
268
276
|
export { ConvexApiError, ConvexClient, ConvexConflict, ConvexFunctionError, ConvexNotFound, layer };
|
|
269
277
|
|
|
270
278
|
//# sourceMappingURL=ConvexClient.js.map
|