@gaganref/confect-server 10.3.1-fork.77 → 10.3.1-fork.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MountInit.d.ts +31 -0
- package/dist/MountInit.d.ts.map +1 -0
- package/dist/MountInit.js +49 -0
- package/dist/MountInit.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/package.json +2 -2
- package/src/MountInit.ts +80 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as Mount from "@confect/core/Mount";
|
|
2
|
+
/**
|
|
3
|
+
* A mount the push visits: its `init`, if its component declares one, and
|
|
4
|
+
* whether its component lists mounts of its own.
|
|
5
|
+
*/
|
|
6
|
+
export interface Entry {
|
|
7
|
+
readonly mount: Mount.Any;
|
|
8
|
+
readonly nested: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* What the push does at one mount, in order. A mount whose callback handles
|
|
12
|
+
* cannot be made ends the list with its failure, so no later mount runs.
|
|
13
|
+
*/
|
|
14
|
+
export type Step = {
|
|
15
|
+
readonly componentPath: string;
|
|
16
|
+
readonly nested: boolean;
|
|
17
|
+
readonly init: {
|
|
18
|
+
readonly functionName: string;
|
|
19
|
+
readonly args: unknown;
|
|
20
|
+
} | null;
|
|
21
|
+
} | {
|
|
22
|
+
readonly componentPath: string;
|
|
23
|
+
readonly failure: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* The internal mutation codegen writes to `convex/confectDeploy.ts`. It makes
|
|
27
|
+
* each mount's callback handles and returns the steps a push runs, in
|
|
28
|
+
* declaration order.
|
|
29
|
+
*/
|
|
30
|
+
export declare const mutation: (entries: ReadonlyArray<Entry>) => import("convex/server").RegisteredMutation<"internal", {}, Promise<Step[]>>;
|
|
31
|
+
//# sourceMappingURL=MountInit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MountInit.d.ts","sourceRoot":"","sources":["../src/MountInit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,qBAAqB,CAAC;AAQ7C;;;GAGG;AACH,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED;;;GAGG;AACH,MAAM,MAAM,IAAI,GACZ;IACE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE;QACb,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;QAC9B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;KACxB,GAAG,IAAI,CAAC;CACV,GACD;IAAE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AA6BjE;;;;GAIG;AACH,eAAO,MAAM,QAAQ,YAAa,aAAa,CAAC,KAAK,CAAC,gFAelD,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { create } from "./Callback.js";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import { internalMutationGeneric } from "convex/server";
|
|
5
|
+
import * as Option from "effect/Option";
|
|
6
|
+
import * as Cause from "effect/Cause";
|
|
7
|
+
import * as Exit from "effect/Exit";
|
|
8
|
+
import * as Mount from "@confect/core/Mount";
|
|
9
|
+
//#region src/MountInit.ts
|
|
10
|
+
var MountInit_exports = /* @__PURE__ */ __exportAll({ mutation: () => mutation });
|
|
11
|
+
const failure = (cause) => {
|
|
12
|
+
const error = Cause.squash(cause);
|
|
13
|
+
return error instanceof Error ? error.message : String(error);
|
|
14
|
+
};
|
|
15
|
+
const step = (entry) => Mount.initCall(entry.mount, (contract, ref) => create(contract, ref)).pipe(Effect.exit, Effect.map((exit) => Exit.isSuccess(exit) ? {
|
|
16
|
+
componentPath: Mount.data(entry.mount).name,
|
|
17
|
+
nested: entry.nested,
|
|
18
|
+
init: Option.match(exit.value, {
|
|
19
|
+
onNone: () => null,
|
|
20
|
+
onSome: ({ functionName, args }) => ({
|
|
21
|
+
functionName,
|
|
22
|
+
args
|
|
23
|
+
})
|
|
24
|
+
})
|
|
25
|
+
} : {
|
|
26
|
+
componentPath: Mount.data(entry.mount).name,
|
|
27
|
+
failure: failure(exit.cause)
|
|
28
|
+
}));
|
|
29
|
+
/**
|
|
30
|
+
* The internal mutation codegen writes to `convex/confectDeploy.ts`. It makes
|
|
31
|
+
* each mount's callback handles and returns the steps a push runs, in
|
|
32
|
+
* declaration order.
|
|
33
|
+
*/
|
|
34
|
+
const mutation = (entries) => internalMutationGeneric({
|
|
35
|
+
args: {},
|
|
36
|
+
handler: () => Effect.runPromise(Effect.gen(function* () {
|
|
37
|
+
const steps = [];
|
|
38
|
+
for (const entry of entries) {
|
|
39
|
+
const next = yield* step(entry);
|
|
40
|
+
steps.push(next);
|
|
41
|
+
if ("failure" in next) break;
|
|
42
|
+
}
|
|
43
|
+
return steps;
|
|
44
|
+
}))
|
|
45
|
+
});
|
|
46
|
+
//#endregion
|
|
47
|
+
export { MountInit_exports, mutation };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=MountInit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MountInit.js","names":["Callback.create"],"sources":["../src/MountInit.ts"],"sourcesContent":["import * as Mount from \"@confect/core/Mount\";\nimport { internalMutationGeneric } from \"convex/server\";\nimport * as Cause from \"effect/Cause\";\nimport * as Effect from \"effect/Effect\";\nimport * as Exit from \"effect/Exit\";\nimport * as Option from \"effect/Option\";\nimport * as Callback from \"./Callback.js\";\n\n/**\n * A mount the push visits: its `init`, if its component declares one, and\n * whether its component lists mounts of its own.\n */\nexport interface Entry {\n readonly mount: Mount.Any;\n readonly nested: boolean;\n}\n\n/**\n * What the push does at one mount, in order. A mount whose callback handles\n * cannot be made ends the list with its failure, so no later mount runs.\n */\nexport type Step =\n | {\n readonly componentPath: string;\n readonly nested: boolean;\n readonly init: {\n readonly functionName: string;\n readonly args: unknown;\n } | null;\n }\n | { readonly componentPath: string; readonly failure: string };\n\nconst failure = (cause: Cause.Cause<unknown>) => {\n const error = Cause.squash(cause);\n return error instanceof Error ? error.message : String(error);\n};\n\nconst step = (entry: Entry) =>\n Mount.initCall(entry.mount, (contract, ref) =>\n Callback.create(contract, ref as never),\n ).pipe(\n Effect.exit,\n Effect.map((exit): Step =>\n Exit.isSuccess(exit)\n ? {\n componentPath: Mount.data(entry.mount).name,\n nested: entry.nested,\n init: Option.match(exit.value, {\n onNone: () => null,\n onSome: ({ functionName, args }) => ({ functionName, args }),\n }),\n }\n : {\n componentPath: Mount.data(entry.mount).name,\n failure: failure(exit.cause),\n },\n ),\n );\n\n/**\n * The internal mutation codegen writes to `convex/confectDeploy.ts`. It makes\n * each mount's callback handles and returns the steps a push runs, in\n * declaration order.\n */\nexport const mutation = (entries: ReadonlyArray<Entry>) =>\n internalMutationGeneric({\n args: {},\n handler: () =>\n Effect.runPromise(\n Effect.gen(function* () {\n const steps: Array<Step> = [];\n for (const entry of entries) {\n const next = yield* step(entry);\n steps.push(next);\n if (\"failure\" in next) break;\n }\n return steps;\n }),\n ),\n });\n"],"mappings":";;;;;;;;;;AAgCA,MAAM,WAAW,UAAgC;CAC/C,MAAM,QAAQ,MAAM,OAAO,KAAK;CAChC,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC9D;AAEA,MAAM,QAAQ,UACZ,MAAM,SAAS,MAAM,QAAQ,UAAU,QACrCA,OAAgB,UAAU,GAAY,CACxC,CAAC,CAAC,KACA,OAAO,MACP,OAAO,KAAK,SACV,KAAK,UAAU,IAAI,IACf;CACE,eAAe,MAAM,KAAK,MAAM,KAAK,CAAC,CAAC;CACvC,QAAQ,MAAM;CACd,MAAM,OAAO,MAAM,KAAK,OAAO;EAC7B,cAAc;EACd,SAAS,EAAE,cAAc,YAAY;GAAE;GAAc;EAAK;CAC5D,CAAC;AACH,IACA;CACE,eAAe,MAAM,KAAK,MAAM,KAAK,CAAC,CAAC;CACvC,SAAS,QAAQ,KAAK,KAAK;AAC7B,CACN,CACF;;;;;;AAOF,MAAa,YAAY,YACvB,wBAAwB;CACtB,MAAM,CAAC;CACP,eACE,OAAO,WACL,OAAO,IAAI,aAAa;EACtB,MAAM,QAAqB,CAAC;EAC5B,KAAK,MAAM,SAAS,SAAS;GAC3B,MAAM,OAAO,OAAO,KAAK,KAAK;GAC9B,MAAM,KAAK,IAAI;GACf,IAAI,aAAa,MAAM;EACzB;EACA,OAAO;CACT,CAAC,CACH;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export * as Handler from "./Handler.js";
|
|
|
26
26
|
export * as HttpRouter from "./HttpRouter.js";
|
|
27
27
|
export * as MiddlewareImpl from "./MiddlewareImpl.js";
|
|
28
28
|
export * as MiddlewareRegistryItem from "./MiddlewareRegistryItem.js";
|
|
29
|
+
export * as MountInit from "./MountInit.js";
|
|
29
30
|
export * as MutationCtx from "./MutationCtx.js";
|
|
30
31
|
export * as MutationRunner from "./MutationRunner.js";
|
|
31
32
|
export * as MutationTransactionContext from "./MutationTransactionContext.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,uBAAuB,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,sBAAsB,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,uBAAuB,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK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AAK,oBAAoB,MAAM,2BAA2B,CAAC;AAClE;;GAEG;AACH,OAAO,KAAK,qBAAqB,MAAM,4BAA4B,CAAC;AACpE;;GAEG;AACH,OAAO,KAAK,qBAAqB,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,wBAAwB,MAAM,+BAA+B,CAAC;AAC1E,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -57,7 +57,8 @@ import { RegistryItems_exports } from "./RegistryItems.js";
|
|
|
57
57
|
import { GroupImpl_exports } from "./GroupImpl.js";
|
|
58
58
|
import { Handler_exports } from "./Handler.js";
|
|
59
59
|
import { HttpRouter_exports } from "./HttpRouter.js";
|
|
60
|
+
import { MountInit_exports } from "./MountInit.js";
|
|
60
61
|
import { OfficialComponent_exports } from "./OfficialComponent.js";
|
|
61
62
|
import { RegisteredFunctions_exports } from "./RegisteredFunctions.js";
|
|
62
63
|
import { TableInfo_exports } from "./TableInfo.js";
|
|
63
|
-
export { ActionCall_exports as ActionCall, ActionCtx_exports as ActionCtx, ActionRunner_exports as ActionRunner, AiGatewayDecisionClient_exports as AiGatewayDecisionClient, AiGatewayDecisionModel_exports as AiGatewayDecisionModel, AiGatewayLanguageClient_exports as AiGatewayLanguageClient, AiGatewayLanguageModel_exports as AiGatewayLanguageModel, Auth_exports as Auth, BlobNotFoundError_exports as BlobNotFoundError, Callback_exports as Callback, ConvexConfigProvider_exports as ConvexConfigProvider, ConvexFunctionDefinitions_exports as ConvexFunctionDefinitions, ConvexLogger_exports as ConvexLogger, CronJob_exports as CronJob, CronJobs_exports as CronJobs, DataModel_exports as DataModel, DatabaseReader_exports as DatabaseReader, DatabaseSchema_exports as DatabaseSchema, DatabaseWriter_exports as DatabaseWriter, Document_exports as Document, ExecutionMetadata_exports as ExecutionMetadata, FunctionImpl_exports as FunctionImpl, FunctionRegistryItem_exports as FunctionRegistryItem, GroupImpl_exports as GroupImpl, Handler_exports as Handler, HttpRouter_exports as HttpRouter, MiddlewareImpl_exports as MiddlewareImpl, MiddlewareRegistryItem_exports as MiddlewareRegistryItem, MutationCtx_exports as MutationCtx, MutationRunner_exports as MutationRunner, MutationTransactionContext_exports as MutationTransactionContext, OfficialComponent_exports as OfficialComponent, OrderedQuery_exports as OrderedQuery, QueryCtx_exports as QueryCtx, QueryInitializer_exports as QueryInitializer, QueryRunner_exports as QueryRunner, QueryStream_exports as QueryStream, QueryStreamCursor_exports as QueryStreamCursor, QueryStreamIndexRange_exports as QueryStreamIndexRange, QueryStreamKeyBounds_exports as QueryStreamKeyBounds, QueryStreamKeyLabels_exports as QueryStreamKeyLabels, QueryStreamKeyLayout_exports as QueryStreamKeyLayout, QueryStreamKeyValues_exports as QueryStreamKeyValues, QueryStreamOrderDirection_exports as QueryStreamOrderDirection, QueryStreamReadBudget_exports as QueryStreamReadBudget, QueryTransactionContext_exports as QueryTransactionContext, RegisteredConvexFunction_exports as RegisteredConvexFunction, RegisteredFunction_exports as RegisteredFunction, RegisteredFunctions_exports as RegisteredFunctions, Registry_exports as Registry, RegistryItems_exports as RegistryItems, RequestMetadata_exports as RequestMetadata, ResolvedMiddleware_exports as ResolvedMiddleware, Scheduler_exports as Scheduler, Storage_exports as Storage, StorageActionWriter_exports as StorageActionWriter, StorageReader_exports as StorageReader, StorageWriter_exports as StorageWriter, Table_exports as Table, TableInfo_exports as TableInfo, TransactionMetadata_exports as TransactionMetadata, VectorSearch_exports as VectorSearch };
|
|
64
|
+
export { ActionCall_exports as ActionCall, ActionCtx_exports as ActionCtx, ActionRunner_exports as ActionRunner, AiGatewayDecisionClient_exports as AiGatewayDecisionClient, AiGatewayDecisionModel_exports as AiGatewayDecisionModel, AiGatewayLanguageClient_exports as AiGatewayLanguageClient, AiGatewayLanguageModel_exports as AiGatewayLanguageModel, Auth_exports as Auth, BlobNotFoundError_exports as BlobNotFoundError, Callback_exports as Callback, ConvexConfigProvider_exports as ConvexConfigProvider, ConvexFunctionDefinitions_exports as ConvexFunctionDefinitions, ConvexLogger_exports as ConvexLogger, CronJob_exports as CronJob, CronJobs_exports as CronJobs, DataModel_exports as DataModel, DatabaseReader_exports as DatabaseReader, DatabaseSchema_exports as DatabaseSchema, DatabaseWriter_exports as DatabaseWriter, Document_exports as Document, ExecutionMetadata_exports as ExecutionMetadata, FunctionImpl_exports as FunctionImpl, FunctionRegistryItem_exports as FunctionRegistryItem, GroupImpl_exports as GroupImpl, Handler_exports as Handler, HttpRouter_exports as HttpRouter, MiddlewareImpl_exports as MiddlewareImpl, MiddlewareRegistryItem_exports as MiddlewareRegistryItem, MountInit_exports as MountInit, MutationCtx_exports as MutationCtx, MutationRunner_exports as MutationRunner, MutationTransactionContext_exports as MutationTransactionContext, OfficialComponent_exports as OfficialComponent, OrderedQuery_exports as OrderedQuery, QueryCtx_exports as QueryCtx, QueryInitializer_exports as QueryInitializer, QueryRunner_exports as QueryRunner, QueryStream_exports as QueryStream, QueryStreamCursor_exports as QueryStreamCursor, QueryStreamIndexRange_exports as QueryStreamIndexRange, QueryStreamKeyBounds_exports as QueryStreamKeyBounds, QueryStreamKeyLabels_exports as QueryStreamKeyLabels, QueryStreamKeyLayout_exports as QueryStreamKeyLayout, QueryStreamKeyValues_exports as QueryStreamKeyValues, QueryStreamOrderDirection_exports as QueryStreamOrderDirection, QueryStreamReadBudget_exports as QueryStreamReadBudget, QueryTransactionContext_exports as QueryTransactionContext, RegisteredConvexFunction_exports as RegisteredConvexFunction, RegisteredFunction_exports as RegisteredFunction, RegisteredFunctions_exports as RegisteredFunctions, Registry_exports as Registry, RegistryItems_exports as RegistryItems, RequestMetadata_exports as RequestMetadata, ResolvedMiddleware_exports as ResolvedMiddleware, Scheduler_exports as Scheduler, Storage_exports as Storage, StorageActionWriter_exports as StorageActionWriter, StorageReader_exports as StorageReader, StorageWriter_exports as StorageWriter, Table_exports as Table, TableInfo_exports as TableInfo, TransactionMetadata_exports as TransactionMetadata, VectorSearch_exports as VectorSearch };
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gaganref/confect-server",
|
|
3
|
-
"version": "10.3.1-fork.
|
|
3
|
+
"version": "10.3.1-fork.78",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@effect/ai-openai-compat": "4.0.4",
|
|
6
6
|
"@effect/ai-openrouter": "4.0.4"
|
|
7
7
|
},
|
|
8
8
|
"peerDependencies": {
|
|
9
|
-
"@confect/core": "npm:@gaganref/confect-core@10.3.1-fork.
|
|
9
|
+
"@confect/core": "npm:@gaganref/confect-core@10.3.1-fork.78",
|
|
10
10
|
"@effect/platform-node": ">=4.0.0 <4.1.0",
|
|
11
11
|
"convex": "^1.49.0",
|
|
12
12
|
"effect": ">=4.0.4 <4.1.0"
|
package/src/MountInit.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as Mount from "@confect/core/Mount";
|
|
2
|
+
import { internalMutationGeneric } from "convex/server";
|
|
3
|
+
import * as Cause from "effect/Cause";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import * as Exit from "effect/Exit";
|
|
6
|
+
import * as Option from "effect/Option";
|
|
7
|
+
import * as Callback from "./Callback.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A mount the push visits: its `init`, if its component declares one, and
|
|
11
|
+
* whether its component lists mounts of its own.
|
|
12
|
+
*/
|
|
13
|
+
export interface Entry {
|
|
14
|
+
readonly mount: Mount.Any;
|
|
15
|
+
readonly nested: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* What the push does at one mount, in order. A mount whose callback handles
|
|
20
|
+
* cannot be made ends the list with its failure, so no later mount runs.
|
|
21
|
+
*/
|
|
22
|
+
export type Step =
|
|
23
|
+
| {
|
|
24
|
+
readonly componentPath: string;
|
|
25
|
+
readonly nested: boolean;
|
|
26
|
+
readonly init: {
|
|
27
|
+
readonly functionName: string;
|
|
28
|
+
readonly args: unknown;
|
|
29
|
+
} | null;
|
|
30
|
+
}
|
|
31
|
+
| { readonly componentPath: string; readonly failure: string };
|
|
32
|
+
|
|
33
|
+
const failure = (cause: Cause.Cause<unknown>) => {
|
|
34
|
+
const error = Cause.squash(cause);
|
|
35
|
+
return error instanceof Error ? error.message : String(error);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const step = (entry: Entry) =>
|
|
39
|
+
Mount.initCall(entry.mount, (contract, ref) =>
|
|
40
|
+
Callback.create(contract, ref as never),
|
|
41
|
+
).pipe(
|
|
42
|
+
Effect.exit,
|
|
43
|
+
Effect.map((exit): Step =>
|
|
44
|
+
Exit.isSuccess(exit)
|
|
45
|
+
? {
|
|
46
|
+
componentPath: Mount.data(entry.mount).name,
|
|
47
|
+
nested: entry.nested,
|
|
48
|
+
init: Option.match(exit.value, {
|
|
49
|
+
onNone: () => null,
|
|
50
|
+
onSome: ({ functionName, args }) => ({ functionName, args }),
|
|
51
|
+
}),
|
|
52
|
+
}
|
|
53
|
+
: {
|
|
54
|
+
componentPath: Mount.data(entry.mount).name,
|
|
55
|
+
failure: failure(exit.cause),
|
|
56
|
+
},
|
|
57
|
+
),
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The internal mutation codegen writes to `convex/confectDeploy.ts`. It makes
|
|
62
|
+
* each mount's callback handles and returns the steps a push runs, in
|
|
63
|
+
* declaration order.
|
|
64
|
+
*/
|
|
65
|
+
export const mutation = (entries: ReadonlyArray<Entry>) =>
|
|
66
|
+
internalMutationGeneric({
|
|
67
|
+
args: {},
|
|
68
|
+
handler: () =>
|
|
69
|
+
Effect.runPromise(
|
|
70
|
+
Effect.gen(function* () {
|
|
71
|
+
const steps: Array<Step> = [];
|
|
72
|
+
for (const entry of entries) {
|
|
73
|
+
const next = yield* step(entry);
|
|
74
|
+
steps.push(next);
|
|
75
|
+
if ("failure" in next) break;
|
|
76
|
+
}
|
|
77
|
+
return steps;
|
|
78
|
+
}),
|
|
79
|
+
),
|
|
80
|
+
});
|
package/src/index.ts
CHANGED
|
@@ -26,6 +26,7 @@ export * as Handler from "./Handler.js";
|
|
|
26
26
|
export * as HttpRouter from "./HttpRouter.js";
|
|
27
27
|
export * as MiddlewareImpl from "./MiddlewareImpl.js";
|
|
28
28
|
export * as MiddlewareRegistryItem from "./MiddlewareRegistryItem.js";
|
|
29
|
+
export * as MountInit from "./MountInit.js";
|
|
29
30
|
export * as MutationCtx from "./MutationCtx.js";
|
|
30
31
|
export * as MutationRunner from "./MutationRunner.js";
|
|
31
32
|
export * as MutationTransactionContext from "./MutationTransactionContext.js";
|