@gaganref/confect-alchemy 10.6.0-fork.30 → 10.6.0-fork.31
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.
|
@@ -14,11 +14,10 @@ export declare class MountInitFailed extends MountInitFailed_base {
|
|
|
14
14
|
get message(): string;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* Run every mount's `init` against a pushed deployment
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* transaction, so earlier mounts stay applied and a rerun converges.
|
|
17
|
+
* Run every mount's `init` against a pushed deployment, in the order
|
|
18
|
+
* `MountSteps.run` walks them, the order the test backend uses too. The first
|
|
19
|
+
* failing mount stops the run. Each `init` is its own transaction, so earlier
|
|
20
|
+
* mounts stay applied and a rerun converges.
|
|
22
21
|
*
|
|
23
22
|
* @internal
|
|
24
23
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MountInit.d.ts","sources":["../../src/internal/MountInit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MountInit.d.ts","sources":["../../src/internal/MountInit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,YAAY,EAAuB,MAAM,oBAAoB,CAAC;;;;;oBAKnD,OAAO,MAAM;;AAFjC,qBAAa,eAAgB,SAAQ,oBAGkC;IACrE,IAAa,OAAO,WAEnB;CACF;AAcD;;;;;;;GAOG;AACH,eAAO,MAAM,GAAG,sJAgCd,CAAC"}
|
|
@@ -4,6 +4,7 @@ import * as Effect from "effect/Effect";
|
|
|
4
4
|
import * as Schema from "effect/Schema";
|
|
5
5
|
import * as FileSystem from "effect/FileSystem";
|
|
6
6
|
import * as Path from "effect/Path";
|
|
7
|
+
import * as MountSteps from "@confect/core/MountSteps";
|
|
7
8
|
// src/internal/MountInit.ts
|
|
8
9
|
var MountInitFailed = class extends Schema.TaggedError()("MountInitFailed", {
|
|
9
10
|
mount: Schema.String,
|
|
@@ -13,18 +14,6 @@ var MountInitFailed = class extends Schema.TaggedError()("MountInitFailed", {
|
|
|
13
14
|
return `${this.mount}: init failed; earlier mounts are applied, and the next push retries`;
|
|
14
15
|
}
|
|
15
16
|
};
|
|
16
|
-
const Steps = Schema.Array(Schema.Union([Schema.Struct({
|
|
17
|
-
componentPath: Schema.String,
|
|
18
|
-
nested: Schema.Boolean,
|
|
19
|
-
init: Schema.NullOr(Schema.Struct({
|
|
20
|
-
functionName: Schema.String,
|
|
21
|
-
args: Schema.Unknown
|
|
22
|
-
}))
|
|
23
|
-
}), Schema.Struct({
|
|
24
|
-
componentPath: Schema.String,
|
|
25
|
-
failure: Schema.String
|
|
26
|
-
})]));
|
|
27
|
-
const STEPS = "confectDeploy:steps";
|
|
28
17
|
/**
|
|
29
18
|
* Whether codegen wrote `confectDeploy.ts` into the backend's Convex directory.
|
|
30
19
|
*/
|
|
@@ -35,11 +24,10 @@ const hasDeployModule = Effect.fn("MountInit.hasDeployModule")(function* (cwd) {
|
|
|
35
24
|
return yield* fs.exists(path.join(cwd, functions, "confectDeploy.ts"));
|
|
36
25
|
});
|
|
37
26
|
/**
|
|
38
|
-
* Run every mount's `init` against a pushed deployment
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* transaction, so earlier mounts stay applied and a rerun converges.
|
|
27
|
+
* Run every mount's `init` against a pushed deployment, in the order
|
|
28
|
+
* `MountSteps.run` walks them, the order the test backend uses too. The first
|
|
29
|
+
* failing mount stops the run. Each `init` is its own transaction, so earlier
|
|
30
|
+
* mounts stay applied and a rerun converges.
|
|
43
31
|
*
|
|
44
32
|
* @internal
|
|
45
33
|
*/
|
|
@@ -48,21 +36,16 @@ const run = Effect.fn("MountInit.run")(function* (url, key, cwd) {
|
|
|
48
36
|
mount,
|
|
49
37
|
detail: Schema.is(ConvexFunctionError)(error) ? error.errorMessage : error._tag
|
|
50
38
|
});
|
|
51
|
-
if (!(yield* hasDeployModule(cwd).pipe(Effect.mapError(failed(STEPS))))) return;
|
|
39
|
+
if (!(yield* hasDeployModule(cwd).pipe(Effect.mapError(failed(MountSteps.STEPS))))) return;
|
|
52
40
|
const client = yield* ConvexClient;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
});
|
|
61
|
-
if (step.init !== null) yield* client.runFunction(url, key, step.init.functionName, step.init.args, mount).pipe(Effect.mapError(failed(mount)));
|
|
62
|
-
if (step.nested) yield* visit(mount);
|
|
63
|
-
}
|
|
41
|
+
yield* MountSteps.run({
|
|
42
|
+
steps: (prefix) => client.runFunction(url, key, MountSteps.STEPS, {}, prefix).pipe(Effect.mapError(failed(prefix ?? MountSteps.STEPS))),
|
|
43
|
+
init: (mount, functionName, args) => client.runFunction(url, key, functionName, args, mount).pipe(Effect.mapError(failed(mount))),
|
|
44
|
+
failed: (mount, detail) => MountInitFailed.make({
|
|
45
|
+
mount,
|
|
46
|
+
detail
|
|
47
|
+
})
|
|
64
48
|
});
|
|
65
|
-
yield* visit(void 0);
|
|
66
49
|
});
|
|
67
50
|
export { MountInitFailed, run };
|
|
68
51
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MountInit.js","names":[],"sources":["../../src/internal/MountInit.ts"],"sourcesContent":["import * as Effect from \"effect/Effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport * as Path from \"effect/Path\";\nimport type * as Redacted from \"effect/Redacted\";\nimport * as Schema from \"effect/Schema\";\nimport { ConvexClient, ConvexFunctionError } from \"../ConvexClient.js\";\nimport { functionsDirectory } from \"./FunctionsDirectory.js\";\n\nexport class MountInitFailed extends Schema.TaggedError<\n MountInitFailed,\n { readonly brand: unique symbol }\n>()(\"MountInitFailed\", { mount: Schema.String, detail: Schema.String }) {\n override get message() {\n return `${this.mount}: init failed; earlier mounts are applied, and the next push retries`;\n }\n}\n\
|
|
1
|
+
{"version":3,"file":"MountInit.js","names":[],"sources":["../../src/internal/MountInit.ts"],"sourcesContent":["import * as MountSteps from \"@confect/core/MountSteps\";\nimport * as Effect from \"effect/Effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport * as Path from \"effect/Path\";\nimport type * as Redacted from \"effect/Redacted\";\nimport * as Schema from \"effect/Schema\";\nimport { ConvexClient, ConvexFunctionError } from \"../ConvexClient.js\";\nimport { functionsDirectory } from \"./FunctionsDirectory.js\";\n\nexport class MountInitFailed extends Schema.TaggedError<\n MountInitFailed,\n { readonly brand: unique symbol }\n>()(\"MountInitFailed\", { mount: Schema.String, detail: Schema.String }) {\n override get message() {\n return `${this.mount}: init failed; earlier mounts are applied, and the next push retries`;\n }\n}\n\n/**\n * Whether codegen wrote `confectDeploy.ts` into the backend's Convex directory.\n */\nconst hasDeployModule = Effect.fn(\"MountInit.hasDeployModule\")(function* (\n cwd: string,\n) {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const functions = yield* functionsDirectory(cwd);\n return yield* fs.exists(path.join(cwd, functions, \"confectDeploy.ts\"));\n});\n\n/**\n * Run every mount's `init` against a pushed deployment, in the order\n * `MountSteps.run` walks them, the order the test backend uses too. The first\n * failing mount stops the run. Each `init` is its own transaction, so earlier\n * mounts stay applied and a rerun converges.\n *\n * @internal\n */\nexport const run = Effect.fn(\"MountInit.run\")(function* (\n url: string,\n key: Redacted.Redacted<string>,\n cwd: string,\n) {\n const failed =\n (mount: string) =>\n (error: { readonly _tag: string }): MountInitFailed =>\n MountInitFailed.make({\n mount,\n detail: Schema.is(ConvexFunctionError)(error)\n ? error.errorMessage\n : error._tag,\n });\n if (\n !(yield* hasDeployModule(cwd).pipe(\n Effect.mapError(failed(MountSteps.STEPS)),\n ))\n )\n return;\n const client = yield* ConvexClient;\n yield* MountSteps.run({\n steps: (prefix) =>\n client\n .runFunction(url, key, MountSteps.STEPS, {}, prefix)\n .pipe(Effect.mapError(failed(prefix ?? MountSteps.STEPS))),\n init: (mount, functionName, args) =>\n client\n .runFunction(url, key, functionName, args, mount)\n .pipe(Effect.mapError(failed(mount))),\n failed: (mount, detail) => MountInitFailed.make({ mount, detail }),\n });\n});\n"],"mappings":";;;;;;;;AASA,IAAa,kBAAb,cAAqC,OAAO,YAG1C,CAAC,CAAC,mBAAmB;CAAE,OAAO,OAAO;CAAQ,QAAQ,OAAO;AAAO,CAAC,CAAC,CAAC;CACtE,IAAa,UAAU;EACrB,OAAO,GAAG,KAAK,MAAM;CACvB;AACF;;;;AAKA,MAAM,kBAAkB,OAAO,GAAG,2BAA2B,CAAC,CAAC,WAC7D,KACA;CACA,MAAM,KAAK,OAAO,WAAW;CAC7B,MAAM,OAAO,OAAO,KAAK;CACzB,MAAM,YAAY,OAAO,mBAAmB,GAAG;CAC/C,OAAO,OAAO,GAAG,OAAO,KAAK,KAAK,KAAK,WAAW,kBAAkB,CAAC;AACvE,CAAC;;;;;;;;;AAUD,MAAa,MAAM,OAAO,GAAG,eAAe,CAAC,CAAC,WAC5C,KACA,KACA,KACA;CACA,MAAM,UACH,WACA,UACC,gBAAgB,KAAK;EACnB;EACA,QAAQ,OAAO,GAAG,mBAAmB,CAAC,CAAC,KAAK,IACxC,MAAM,eACN,MAAM;CACZ,CAAC;CACL,IACE,EAAE,OAAO,gBAAgB,GAAG,CAAC,CAAC,KAC5B,OAAO,SAAS,OAAO,WAAW,KAAK,CAAC,CAC1C,IAEA;CACF,MAAM,SAAS,OAAO;CACtB,OAAO,WAAW,IAAI;EACpB,QAAQ,WACN,OACG,YAAY,KAAK,KAAK,WAAW,OAAO,CAAC,GAAG,MAAM,CAAC,CACnD,KAAK,OAAO,SAAS,OAAO,UAAU,WAAW,KAAK,CAAC,CAAC;EAC7D,OAAO,OAAO,cAAc,SAC1B,OACG,YAAY,KAAK,KAAK,cAAc,MAAM,KAAK,CAAC,CAChD,KAAK,OAAO,SAAS,OAAO,KAAK,CAAC,CAAC;EACxC,SAAS,OAAO,WAAW,gBAAgB,KAAK;GAAE;GAAO;EAAO,CAAC;CACnE,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gaganref/confect-alchemy",
|
|
3
|
-
"version": "10.6.0-fork.
|
|
3
|
+
"version": "10.6.0-fork.31",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@convex-dev/platform": "^0.1.10"
|
|
6
6
|
},
|
|
7
7
|
"peerDependencies": {
|
|
8
|
-
"@confect/cli": "npm:@gaganref/confect-cli@10.6.0-fork.
|
|
9
|
-
"@confect/core": "npm:@gaganref/confect-core@10.6.0-fork.
|
|
8
|
+
"@confect/cli": "npm:@gaganref/confect-cli@10.6.0-fork.31",
|
|
9
|
+
"@confect/core": "npm:@gaganref/confect-core@10.6.0-fork.31",
|
|
10
10
|
"alchemy": ">=2.0.0-beta.85 <2.0.0",
|
|
11
11
|
"convex": "^1.32.0",
|
|
12
12
|
"effect": "~4.1.4"
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as MountSteps from "@confect/core/MountSteps";
|
|
1
2
|
import * as Effect from "effect/Effect";
|
|
2
3
|
import * as FileSystem from "effect/FileSystem";
|
|
3
4
|
import * as Path from "effect/Path";
|
|
@@ -15,21 +16,6 @@ export class MountInitFailed extends Schema.TaggedError<
|
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
const Steps = Schema.Array(
|
|
19
|
-
Schema.Union([
|
|
20
|
-
Schema.Struct({
|
|
21
|
-
componentPath: Schema.String,
|
|
22
|
-
nested: Schema.Boolean,
|
|
23
|
-
init: Schema.NullOr(
|
|
24
|
-
Schema.Struct({ functionName: Schema.String, args: Schema.Unknown }),
|
|
25
|
-
),
|
|
26
|
-
}),
|
|
27
|
-
Schema.Struct({ componentPath: Schema.String, failure: Schema.String }),
|
|
28
|
-
]),
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
const STEPS = "confectDeploy:steps";
|
|
32
|
-
|
|
33
19
|
/**
|
|
34
20
|
* Whether codegen wrote `confectDeploy.ts` into the backend's Convex directory.
|
|
35
21
|
*/
|
|
@@ -43,11 +29,10 @@ const hasDeployModule = Effect.fn("MountInit.hasDeployModule")(function* (
|
|
|
43
29
|
});
|
|
44
30
|
|
|
45
31
|
/**
|
|
46
|
-
* Run every mount's `init` against a pushed deployment
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* transaction, so earlier mounts stay applied and a rerun converges.
|
|
32
|
+
* Run every mount's `init` against a pushed deployment, in the order
|
|
33
|
+
* `MountSteps.run` walks them, the order the test backend uses too. The first
|
|
34
|
+
* failing mount stops the run. Each `init` is its own transaction, so earlier
|
|
35
|
+
* mounts stay applied and a rerun converges.
|
|
51
36
|
*
|
|
52
37
|
* @internal
|
|
53
38
|
*/
|
|
@@ -65,38 +50,22 @@ export const run = Effect.fn("MountInit.run")(function* (
|
|
|
65
50
|
? error.errorMessage
|
|
66
51
|
: error._tag,
|
|
67
52
|
});
|
|
68
|
-
if (
|
|
53
|
+
if (
|
|
54
|
+
!(yield* hasDeployModule(cwd).pipe(
|
|
55
|
+
Effect.mapError(failed(MountSteps.STEPS)),
|
|
56
|
+
))
|
|
57
|
+
)
|
|
69
58
|
return;
|
|
70
59
|
const client = yield* ConvexClient;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const mount =
|
|
83
|
-
prefix === undefined
|
|
84
|
-
? step.componentPath
|
|
85
|
-
: `${prefix}/${step.componentPath}`;
|
|
86
|
-
if ("failure" in step)
|
|
87
|
-
return yield* MountInitFailed.make({ mount, detail: step.failure });
|
|
88
|
-
if (step.init !== null)
|
|
89
|
-
yield* client
|
|
90
|
-
.runFunction(
|
|
91
|
-
url,
|
|
92
|
-
key,
|
|
93
|
-
step.init.functionName,
|
|
94
|
-
step.init.args,
|
|
95
|
-
mount,
|
|
96
|
-
)
|
|
97
|
-
.pipe(Effect.mapError(failed(mount)));
|
|
98
|
-
if (step.nested) yield* visit(mount);
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
yield* visit(undefined);
|
|
60
|
+
yield* MountSteps.run({
|
|
61
|
+
steps: (prefix) =>
|
|
62
|
+
client
|
|
63
|
+
.runFunction(url, key, MountSteps.STEPS, {}, prefix)
|
|
64
|
+
.pipe(Effect.mapError(failed(prefix ?? MountSteps.STEPS))),
|
|
65
|
+
init: (mount, functionName, args) =>
|
|
66
|
+
client
|
|
67
|
+
.runFunction(url, key, functionName, args, mount)
|
|
68
|
+
.pipe(Effect.mapError(failed(mount))),
|
|
69
|
+
failed: (mount, detail) => MountInitFailed.make({ mount, detail }),
|
|
70
|
+
});
|
|
102
71
|
});
|