@convex-dev/workpool 0.2.20-alpha.0 → 0.3.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +77 -68
- package/dist/client/index.d.ts +3 -3
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/utils.d.ts +1 -8
- package/dist/client/utils.d.ts.map +1 -1
- package/dist/client/utils.js.map +1 -1
- package/dist/component/_generated/api.d.ts +27 -124
- package/dist/component/_generated/api.d.ts.map +1 -1
- package/dist/component/_generated/api.js +10 -1
- package/dist/component/_generated/api.js.map +1 -1
- package/dist/component/_generated/component.d.ts +98 -0
- package/dist/component/_generated/component.d.ts.map +1 -0
- package/dist/component/_generated/component.js +11 -0
- package/dist/component/_generated/component.js.map +1 -0
- package/dist/component/_generated/dataModel.d.ts +4 -18
- package/dist/component/_generated/dataModel.d.ts.map +1 -0
- package/dist/component/_generated/dataModel.js +11 -0
- package/dist/component/_generated/dataModel.js.map +1 -0
- package/dist/component/_generated/server.d.ts +10 -38
- package/dist/component/_generated/server.d.ts.map +1 -1
- package/dist/component/_generated/server.js +9 -5
- package/dist/component/_generated/server.js.map +1 -1
- package/dist/component/danger.d.ts +2 -2
- package/dist/component/lib.d.ts +9 -9
- package/dist/component/lib.js +2 -2
- package/dist/component/lib.js.map +1 -1
- package/dist/component/schema.d.ts +15 -15
- package/dist/component/shared.d.ts +3 -3
- package/dist/component/stats.d.ts +2 -2
- package/dist/component/worker.d.ts +3 -3
- package/package.json +30 -29
- package/src/client/index.ts +19 -20
- package/src/client/utils.ts +3 -30
- package/src/component/README.md +6 -6
- package/src/component/_generated/api.ts +70 -0
- package/src/component/_generated/component.ts +117 -0
- package/src/component/_generated/{server.d.ts → server.ts} +33 -21
- package/src/component/complete.test.ts +1 -1
- package/src/component/complete.ts +6 -6
- package/src/component/danger.ts +3 -3
- package/src/component/kick.test.ts +5 -5
- package/src/component/kick.ts +6 -6
- package/src/component/lib.test.ts +5 -5
- package/src/component/lib.ts +10 -10
- package/src/component/logging.ts +2 -2
- package/src/component/loop.test.ts +9 -9
- package/src/component/loop.ts +33 -33
- package/src/component/recovery.test.ts +7 -7
- package/src/component/recovery.ts +2 -2
- package/src/component/schema.ts +2 -2
- package/src/component/shared.ts +5 -5
- package/src/component/stats.test.ts +3 -3
- package/src/component/stats.ts +6 -6
- package/src/test.ts +10 -3
- package/src/component/_generated/api.d.ts +0 -151
- package/src/component/_generated/api.js +0 -23
- package/src/component/_generated/server.js +0 -90
- /package/src/component/_generated/{dataModel.d.ts → dataModel.ts} +0 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated `ComponentApi` utility.
|
|
3
|
+
*
|
|
4
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
5
|
+
*
|
|
6
|
+
* To regenerate, run `npx convex dev`.
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type { FunctionReference } from "convex/server";
|
|
10
|
+
/**
|
|
11
|
+
* A utility for referencing a Convex component's exposed API.
|
|
12
|
+
*
|
|
13
|
+
* Useful when expecting a parameter like `components.myComponent`.
|
|
14
|
+
* Usage:
|
|
15
|
+
* ```ts
|
|
16
|
+
* async function myFunction(ctx: QueryCtx, component: ComponentApi) {
|
|
17
|
+
* return ctx.runQuery(component.someFile.someQuery, { ...args });
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export type ComponentApi<Name extends string | undefined = string | undefined> = {
|
|
22
|
+
lib: {
|
|
23
|
+
cancel: FunctionReference<"mutation", "internal", {
|
|
24
|
+
id: string;
|
|
25
|
+
logLevel: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
|
|
26
|
+
}, any, Name>;
|
|
27
|
+
cancelAll: FunctionReference<"mutation", "internal", {
|
|
28
|
+
before?: number;
|
|
29
|
+
limit?: number;
|
|
30
|
+
logLevel: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
|
|
31
|
+
}, any, Name>;
|
|
32
|
+
enqueue: FunctionReference<"mutation", "internal", {
|
|
33
|
+
config: {
|
|
34
|
+
logLevel: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
|
|
35
|
+
maxParallelism: number;
|
|
36
|
+
};
|
|
37
|
+
fnArgs: any;
|
|
38
|
+
fnHandle: string;
|
|
39
|
+
fnName: string;
|
|
40
|
+
fnType: "action" | "mutation" | "query";
|
|
41
|
+
onComplete?: {
|
|
42
|
+
context?: any;
|
|
43
|
+
fnHandle: string;
|
|
44
|
+
};
|
|
45
|
+
retryBehavior?: {
|
|
46
|
+
base: number;
|
|
47
|
+
initialBackoffMs: number;
|
|
48
|
+
maxAttempts: number;
|
|
49
|
+
};
|
|
50
|
+
runAt: number;
|
|
51
|
+
}, string, Name>;
|
|
52
|
+
enqueueBatch: FunctionReference<"mutation", "internal", {
|
|
53
|
+
config: {
|
|
54
|
+
logLevel: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
|
|
55
|
+
maxParallelism: number;
|
|
56
|
+
};
|
|
57
|
+
items: Array<{
|
|
58
|
+
fnArgs: any;
|
|
59
|
+
fnHandle: string;
|
|
60
|
+
fnName: string;
|
|
61
|
+
fnType: "action" | "mutation" | "query";
|
|
62
|
+
onComplete?: {
|
|
63
|
+
context?: any;
|
|
64
|
+
fnHandle: string;
|
|
65
|
+
};
|
|
66
|
+
retryBehavior?: {
|
|
67
|
+
base: number;
|
|
68
|
+
initialBackoffMs: number;
|
|
69
|
+
maxAttempts: number;
|
|
70
|
+
};
|
|
71
|
+
runAt: number;
|
|
72
|
+
}>;
|
|
73
|
+
}, Array<string>, Name>;
|
|
74
|
+
status: FunctionReference<"query", "internal", {
|
|
75
|
+
id: string;
|
|
76
|
+
}, {
|
|
77
|
+
previousAttempts: number;
|
|
78
|
+
state: "pending";
|
|
79
|
+
} | {
|
|
80
|
+
previousAttempts: number;
|
|
81
|
+
state: "running";
|
|
82
|
+
} | {
|
|
83
|
+
state: "finished";
|
|
84
|
+
}, Name>;
|
|
85
|
+
statusBatch: FunctionReference<"query", "internal", {
|
|
86
|
+
ids: Array<string>;
|
|
87
|
+
}, Array<{
|
|
88
|
+
previousAttempts: number;
|
|
89
|
+
state: "pending";
|
|
90
|
+
} | {
|
|
91
|
+
previousAttempts: number;
|
|
92
|
+
state: "running";
|
|
93
|
+
} | {
|
|
94
|
+
state: "finished";
|
|
95
|
+
}>, Name>;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/component.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,YAAY,CAAC,IAAI,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,IAC3E;IACE,GAAG,EAAE;QACH,MAAM,EAAE,iBAAiB,CACvB,UAAU,EACV,UAAU,EACV;YACE,EAAE,EAAE,MAAM,CAAC;YACX,QAAQ,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;SACpE,EACD,GAAG,EACH,IAAI,CACL,CAAC;QACF,SAAS,EAAE,iBAAiB,CAC1B,UAAU,EACV,UAAU,EACV;YACE,MAAM,CAAC,EAAE,MAAM,CAAC;YAChB,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,QAAQ,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;SACpE,EACD,GAAG,EACH,IAAI,CACL,CAAC;QACF,OAAO,EAAE,iBAAiB,CACxB,UAAU,EACV,UAAU,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ACF,KAAK,EAAE,MAAM,CAAC;aACf,CAAC,CAAC;SACJ,EACD,KAAK,CAAC,MAAM,CAAC,EACb,IAAI,CACL,CAAC;QACF,MAAM,EAAE,iBAAiB,CACvB,OAAO,EACP,UAAU,EACV;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,EACZ;YAAE,gBAAgB,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,SAAS,CAAA;SAAE,GAC9C;YAAE,gBAAgB,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,SAAS,CAAA;SAAE,GAC9C;YAAE,KAAK,EAAE,UAAU,CAAA;SAAE,EACvB,IAAI,CACL,CAAC;QACF,WAAW,EAAE,iBAAiB,CAC5B,OAAO,EACP,UAAU,EACV;YAAE,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;SAAE,EACtB,KAAK,CACD;YAAE,gBAAgB,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,SAAS,CAAA;SAAE,GAC9C;YAAE,gBAAgB,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,SAAS,CAAA;SAAE,GAC9C;YAAE,KAAK,EAAE,UAAU,CAAA;SAAE,CACxB,EACD,IAAI,CACL,CAAC;KACH,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/component/_generated/component.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
1
|
/**
|
|
3
2
|
* Generated data model types.
|
|
4
3
|
*
|
|
@@ -7,31 +6,19 @@
|
|
|
7
6
|
* To regenerate, run `npx convex dev`.
|
|
8
7
|
* @module
|
|
9
8
|
*/
|
|
10
|
-
|
|
11
|
-
import type {
|
|
12
|
-
DataModelFromSchemaDefinition,
|
|
13
|
-
DocumentByName,
|
|
14
|
-
TableNamesInDataModel,
|
|
15
|
-
SystemTableNames,
|
|
16
|
-
} from "convex/server";
|
|
9
|
+
import type { DataModelFromSchemaDefinition, DocumentByName, TableNamesInDataModel, SystemTableNames } from "convex/server";
|
|
17
10
|
import type { GenericId } from "convex/values";
|
|
18
11
|
import schema from "../schema.js";
|
|
19
|
-
|
|
20
12
|
/**
|
|
21
13
|
* The names of all of your Convex tables.
|
|
22
14
|
*/
|
|
23
15
|
export type TableNames = TableNamesInDataModel<DataModel>;
|
|
24
|
-
|
|
25
16
|
/**
|
|
26
17
|
* The type of a document stored in Convex.
|
|
27
18
|
*
|
|
28
19
|
* @typeParam TableName - A string literal type of the table name (like "users").
|
|
29
20
|
*/
|
|
30
|
-
export type Doc<TableName extends TableNames> = DocumentByName<
|
|
31
|
-
DataModel,
|
|
32
|
-
TableName
|
|
33
|
-
>;
|
|
34
|
-
|
|
21
|
+
export type Doc<TableName extends TableNames> = DocumentByName<DataModel, TableName>;
|
|
35
22
|
/**
|
|
36
23
|
* An identifier for a document in Convex.
|
|
37
24
|
*
|
|
@@ -45,9 +32,7 @@ export type Doc<TableName extends TableNames> = DocumentByName<
|
|
|
45
32
|
*
|
|
46
33
|
* @typeParam TableName - A string literal type of the table name (like "users").
|
|
47
34
|
*/
|
|
48
|
-
export type Id<TableName extends TableNames | SystemTableNames> =
|
|
49
|
-
GenericId<TableName>;
|
|
50
|
-
|
|
35
|
+
export type Id<TableName extends TableNames | SystemTableNames> = GenericId<TableName>;
|
|
51
36
|
/**
|
|
52
37
|
* A type describing your Convex data model.
|
|
53
38
|
*
|
|
@@ -58,3 +43,4 @@ export type Id<TableName extends TableNames | SystemTableNames> =
|
|
|
58
43
|
* `mutationGeneric` to make them type-safe.
|
|
59
44
|
*/
|
|
60
45
|
export type DataModel = DataModelFromSchemaDefinition<typeof schema>;
|
|
46
|
+
//# sourceMappingURL=dataModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataModel.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/dataModel.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,6BAA6B,EAC7B,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;AAE1D;;;;GAIG;AACH,MAAM,MAAM,GAAG,CAAC,SAAS,SAAS,UAAU,IAAI,cAAc,CAC5D,SAAS,EACT,SAAS,CACV,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,EAAE,CAAC,SAAS,SAAS,UAAU,GAAG,gBAAgB,IAC5D,SAAS,CAAC,SAAS,CAAC,CAAC;AAEvB;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,GAAG,6BAA6B,CAAC,OAAO,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataModel.js","sourceRoot":"","sources":["../../../src/component/_generated/dataModel.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG;AASH,OAAO,MAAM,MAAM,cAAc,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
1
|
/**
|
|
3
2
|
* Generated utilities for implementing server-side Convex query and mutation functions.
|
|
4
3
|
*
|
|
@@ -7,27 +6,8 @@
|
|
|
7
6
|
* To regenerate, run `npx convex dev`.
|
|
8
7
|
* @module
|
|
9
8
|
*/
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
ActionBuilder,
|
|
13
|
-
AnyComponents,
|
|
14
|
-
HttpActionBuilder,
|
|
15
|
-
MutationBuilder,
|
|
16
|
-
QueryBuilder,
|
|
17
|
-
GenericActionCtx,
|
|
18
|
-
GenericMutationCtx,
|
|
19
|
-
GenericQueryCtx,
|
|
20
|
-
GenericDatabaseReader,
|
|
21
|
-
GenericDatabaseWriter,
|
|
22
|
-
FunctionReference,
|
|
23
|
-
} from "convex/server";
|
|
9
|
+
import type { ActionBuilder, HttpActionBuilder, MutationBuilder, QueryBuilder, GenericActionCtx, GenericMutationCtx, GenericQueryCtx, GenericDatabaseReader, GenericDatabaseWriter } from "convex/server";
|
|
24
10
|
import type { DataModel } from "./dataModel.js";
|
|
25
|
-
|
|
26
|
-
type GenericCtx =
|
|
27
|
-
| GenericActionCtx<DataModel>
|
|
28
|
-
| GenericMutationCtx<DataModel>
|
|
29
|
-
| GenericQueryCtx<DataModel>;
|
|
30
|
-
|
|
31
11
|
/**
|
|
32
12
|
* Define a query in this Convex app's public API.
|
|
33
13
|
*
|
|
@@ -37,7 +17,6 @@ type GenericCtx =
|
|
|
37
17
|
* @returns The wrapped query. Include this as an `export` to name it and make it accessible.
|
|
38
18
|
*/
|
|
39
19
|
export declare const query: QueryBuilder<DataModel, "public">;
|
|
40
|
-
|
|
41
20
|
/**
|
|
42
21
|
* Define a query that is only accessible from other Convex functions (but not from the client).
|
|
43
22
|
*
|
|
@@ -47,7 +26,6 @@ export declare const query: QueryBuilder<DataModel, "public">;
|
|
|
47
26
|
* @returns The wrapped query. Include this as an `export` to name it and make it accessible.
|
|
48
27
|
*/
|
|
49
28
|
export declare const internalQuery: QueryBuilder<DataModel, "internal">;
|
|
50
|
-
|
|
51
29
|
/**
|
|
52
30
|
* Define a mutation in this Convex app's public API.
|
|
53
31
|
*
|
|
@@ -57,7 +35,6 @@ export declare const internalQuery: QueryBuilder<DataModel, "internal">;
|
|
|
57
35
|
* @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
|
|
58
36
|
*/
|
|
59
37
|
export declare const mutation: MutationBuilder<DataModel, "public">;
|
|
60
|
-
|
|
61
38
|
/**
|
|
62
39
|
* Define a mutation that is only accessible from other Convex functions (but not from the client).
|
|
63
40
|
*
|
|
@@ -67,7 +44,6 @@ export declare const mutation: MutationBuilder<DataModel, "public">;
|
|
|
67
44
|
* @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
|
|
68
45
|
*/
|
|
69
46
|
export declare const internalMutation: MutationBuilder<DataModel, "internal">;
|
|
70
|
-
|
|
71
47
|
/**
|
|
72
48
|
* Define an action in this Convex app's public API.
|
|
73
49
|
*
|
|
@@ -80,7 +56,6 @@ export declare const internalMutation: MutationBuilder<DataModel, "internal">;
|
|
|
80
56
|
* @returns The wrapped action. Include this as an `export` to name it and make it accessible.
|
|
81
57
|
*/
|
|
82
58
|
export declare const action: ActionBuilder<DataModel, "public">;
|
|
83
|
-
|
|
84
59
|
/**
|
|
85
60
|
* Define an action that is only accessible from other Convex functions (but not from the client).
|
|
86
61
|
*
|
|
@@ -88,38 +63,36 @@ export declare const action: ActionBuilder<DataModel, "public">;
|
|
|
88
63
|
* @returns The wrapped function. Include this as an `export` to name it and make it accessible.
|
|
89
64
|
*/
|
|
90
65
|
export declare const internalAction: ActionBuilder<DataModel, "internal">;
|
|
91
|
-
|
|
92
66
|
/**
|
|
93
67
|
* Define an HTTP action.
|
|
94
68
|
*
|
|
95
|
-
*
|
|
96
|
-
* deployment if the requests matches the path and method where
|
|
97
|
-
* is routed. Be sure to route your
|
|
69
|
+
* The wrapped function will be used to respond to HTTP requests received
|
|
70
|
+
* by a Convex deployment if the requests matches the path and method where
|
|
71
|
+
* this action is routed. Be sure to route your httpAction in `convex/http.js`.
|
|
98
72
|
*
|
|
99
|
-
* @param func - The function. It receives an {@link ActionCtx} as its first argument
|
|
73
|
+
* @param func - The function. It receives an {@link ActionCtx} as its first argument
|
|
74
|
+
* and a Fetch API `Request` object as its second.
|
|
100
75
|
* @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
|
|
101
76
|
*/
|
|
102
77
|
export declare const httpAction: HttpActionBuilder;
|
|
103
|
-
|
|
104
78
|
/**
|
|
105
79
|
* A set of services for use within Convex query functions.
|
|
106
80
|
*
|
|
107
81
|
* The query context is passed as the first argument to any Convex query
|
|
108
82
|
* function run on the server.
|
|
109
83
|
*
|
|
110
|
-
*
|
|
111
|
-
* read-only.
|
|
84
|
+
* If you're using code generation, use the `QueryCtx` type in `convex/_generated/server.d.ts` instead.
|
|
112
85
|
*/
|
|
113
86
|
export type QueryCtx = GenericQueryCtx<DataModel>;
|
|
114
|
-
|
|
115
87
|
/**
|
|
116
88
|
* A set of services for use within Convex mutation functions.
|
|
117
89
|
*
|
|
118
90
|
* The mutation context is passed as the first argument to any Convex mutation
|
|
119
91
|
* function run on the server.
|
|
92
|
+
*
|
|
93
|
+
* If you're using code generation, use the `MutationCtx` type in `convex/_generated/server.d.ts` instead.
|
|
120
94
|
*/
|
|
121
95
|
export type MutationCtx = GenericMutationCtx<DataModel>;
|
|
122
|
-
|
|
123
96
|
/**
|
|
124
97
|
* A set of services for use within Convex action functions.
|
|
125
98
|
*
|
|
@@ -127,7 +100,6 @@ export type MutationCtx = GenericMutationCtx<DataModel>;
|
|
|
127
100
|
* function run on the server.
|
|
128
101
|
*/
|
|
129
102
|
export type ActionCtx = GenericActionCtx<DataModel>;
|
|
130
|
-
|
|
131
103
|
/**
|
|
132
104
|
* An interface to read from the database within Convex query functions.
|
|
133
105
|
*
|
|
@@ -136,7 +108,6 @@ export type ActionCtx = GenericActionCtx<DataModel>;
|
|
|
136
108
|
* building a query.
|
|
137
109
|
*/
|
|
138
110
|
export type DatabaseReader = GenericDatabaseReader<DataModel>;
|
|
139
|
-
|
|
140
111
|
/**
|
|
141
112
|
* An interface to read from and write to the database within Convex mutation
|
|
142
113
|
* functions.
|
|
@@ -147,3 +118,4 @@ export type DatabaseReader = GenericDatabaseReader<DataModel>;
|
|
|
147
118
|
* for the guarantees Convex provides your functions.
|
|
148
119
|
*/
|
|
149
120
|
export type DatabaseWriter = GenericDatabaseWriter<DataModel>;
|
|
121
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/server.
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/server.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,eAAe,CAAC;AAUvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,EAAE,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAgB,CAAC;AAErE;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC,SAAS,EAAE,UAAU,CACxC,CAAC;AAEvB;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,EAAE,eAAe,CAAC,SAAS,EAAE,QAAQ,CAAmB,CAAC;AAE9E;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,EAAE,eAAe,CAAC,SAAS,EAAE,UAAU,CAC3C,CAAC;AAE1B;;;;;;;;;;GAUG;AACH,eAAO,MAAM,MAAM,EAAE,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAiB,CAAC;AAExE;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,aAAa,CAAC,SAAS,EAAE,UAAU,CACzC,CAAC;AAExB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,EAAE,iBAAqC,CAAC;AAO/D;;;;;;;GAOG;AACH,MAAM,MAAM,QAAQ,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;AAElD;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;AAExD;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;AAE9D;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* To regenerate, run `npx convex dev`.
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
|
-
import { actionGeneric, httpActionGeneric, queryGeneric, mutationGeneric, internalActionGeneric, internalMutationGeneric, internalQueryGeneric,
|
|
10
|
+
import { actionGeneric, httpActionGeneric, queryGeneric, mutationGeneric, internalActionGeneric, internalMutationGeneric, internalQueryGeneric, } from "convex/server";
|
|
11
11
|
/**
|
|
12
12
|
* Define a query in this Convex app's public API.
|
|
13
13
|
*
|
|
@@ -64,11 +64,15 @@ export const action = actionGeneric;
|
|
|
64
64
|
*/
|
|
65
65
|
export const internalAction = internalActionGeneric;
|
|
66
66
|
/**
|
|
67
|
-
* Define
|
|
67
|
+
* Define an HTTP action.
|
|
68
68
|
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
69
|
+
* The wrapped function will be used to respond to HTTP requests received
|
|
70
|
+
* by a Convex deployment if the requests matches the path and method where
|
|
71
|
+
* this action is routed. Be sure to route your httpAction in `convex/http.js`.
|
|
72
|
+
*
|
|
73
|
+
* @param func - The function. It receives an {@link ActionCtx} as its first argument
|
|
74
|
+
* and a Fetch API `Request` object as its second.
|
|
75
|
+
* @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
|
|
72
76
|
*/
|
|
73
77
|
export const httpAction = httpActionGeneric;
|
|
74
78
|
//# sourceMappingURL=server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/component/_generated/server.
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/component/_generated/server.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG;AAaH,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,eAAe,CAAC;AAGvB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,KAAK,GAAsC,YAAY,CAAC;AAErE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GACxB,oBAAoB,CAAC;AAEvB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAyC,eAAe,CAAC;AAE9E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAC3B,uBAAuB,CAAC;AAE1B;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,MAAM,GAAuC,aAAa,CAAC;AAExE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GACzB,qBAAqB,CAAC;AAExB;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,UAAU,GAAsB,iBAAiB,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export declare const clearPending: import("convex/server").RegisteredMutation<"internal", {
|
|
2
|
-
olderThan?: number | undefined;
|
|
3
2
|
before?: number | undefined;
|
|
3
|
+
olderThan?: number | undefined;
|
|
4
4
|
cursor?: string | undefined;
|
|
5
5
|
}, Promise<void>>;
|
|
6
6
|
export declare const clearOldWork: import("convex/server").RegisteredMutation<"internal", {
|
|
7
|
-
olderThan?: number | undefined;
|
|
8
7
|
before?: number | undefined;
|
|
8
|
+
olderThan?: number | undefined;
|
|
9
9
|
cursor?: string | undefined;
|
|
10
10
|
}, Promise<void>>;
|
|
11
11
|
//# sourceMappingURL=danger.d.ts.map
|
package/dist/component/lib.d.ts
CHANGED
|
@@ -9,20 +9,20 @@ export declare const enqueue: import("convex/server").RegisteredMutation<"public
|
|
|
9
9
|
initialBackoffMs: number;
|
|
10
10
|
base: number;
|
|
11
11
|
} | undefined;
|
|
12
|
-
fnHandle: string;
|
|
13
|
-
fnType: "action" | "mutation" | "query";
|
|
14
|
-
fnName: string;
|
|
15
|
-
fnArgs: any;
|
|
16
|
-
runAt: number;
|
|
17
12
|
config: {
|
|
18
|
-
maxParallelism: number;
|
|
19
13
|
logLevel: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
|
|
14
|
+
maxParallelism: number;
|
|
20
15
|
};
|
|
16
|
+
fnArgs: any;
|
|
17
|
+
fnHandle: string;
|
|
18
|
+
fnName: string;
|
|
19
|
+
fnType: "mutation" | "query" | "action";
|
|
20
|
+
runAt: number;
|
|
21
21
|
}, Promise<import("convex/values").GenericId<"work">>>;
|
|
22
22
|
export declare const enqueueBatch: import("convex/server").RegisteredMutation<"public", {
|
|
23
23
|
config: {
|
|
24
|
-
maxParallelism: number;
|
|
25
24
|
logLevel: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
|
|
25
|
+
maxParallelism: number;
|
|
26
26
|
};
|
|
27
27
|
items: {
|
|
28
28
|
onComplete?: {
|
|
@@ -34,10 +34,10 @@ export declare const enqueueBatch: import("convex/server").RegisteredMutation<"p
|
|
|
34
34
|
initialBackoffMs: number;
|
|
35
35
|
base: number;
|
|
36
36
|
} | undefined;
|
|
37
|
+
fnArgs: any;
|
|
37
38
|
fnHandle: string;
|
|
38
|
-
fnType: "action" | "mutation" | "query";
|
|
39
39
|
fnName: string;
|
|
40
|
-
|
|
40
|
+
fnType: "mutation" | "query" | "action";
|
|
41
41
|
runAt: number;
|
|
42
42
|
}[];
|
|
43
43
|
}, Promise<(string & {
|
package/dist/component/lib.js
CHANGED
|
@@ -5,8 +5,8 @@ import { kickMainLoop } from "./kick.js";
|
|
|
5
5
|
import { createLogger, logLevel, } from "./logging.js";
|
|
6
6
|
import { boundScheduledTime, config, fnType, getNextSegment, max, onComplete, retryBehavior, status as statusValidator, toSegment, } from "./shared.js";
|
|
7
7
|
import { recordEnqueued } from "./stats.js";
|
|
8
|
-
const MAX_POSSIBLE_PARALLELISM =
|
|
9
|
-
const MAX_PARALLELISM_SOFT_LIMIT =
|
|
8
|
+
const MAX_POSSIBLE_PARALLELISM = 200;
|
|
9
|
+
const MAX_PARALLELISM_SOFT_LIMIT = 100;
|
|
10
10
|
const itemArgs = {
|
|
11
11
|
fnHandle: v.string(),
|
|
12
12
|
fnName: v.string(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../src/component/lib.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,CAAC,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C,OAAO,EACL,QAAQ,EAER,KAAK,GAEN,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EACL,YAAY,EAGZ,QAAQ,GACT,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,kBAAkB,EAClB,MAAM,EACN,MAAM,EACN,cAAc,EACd,GAAG,EACH,UAAU,EACV,aAAa,EACb,MAAM,IAAI,eAAe,EACzB,SAAS,GACV,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,wBAAwB,GAAG,GAAG,CAAC;AACrC,MAAM,0BAA0B,GAAG,
|
|
1
|
+
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../src/component/lib.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,CAAC,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C,OAAO,EACL,QAAQ,EAER,KAAK,GAEN,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EACL,YAAY,EAGZ,QAAQ,GACT,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,kBAAkB,EAClB,MAAM,EACN,MA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CAAC,IAAI,EAAE,CAAC;QACV,OAAO,CAAC,IAAI,CAAC,iBAAiB,MAAM,gBAAgB,CAAC,CAAC;QACtD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,kBAAkB,GAAG,MAAM,GAAG,CAAC,EAAE;SACpC,KAAK,CAAC,oBAAoB,CAAC;SAC3B,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;SAClD,MAAM,EAAE,CAAC;IACZ,IAAI,kBAAkB,EAAE,CAAC;QACvB,OAAO,CAAC,IAAI,CAAC,iBAAiB,MAAM,4BAA4B,CAAC,CAAC;QAClE,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,6DAA6D;AAC7D,MAAM,OAAO,GAAG,wCAAwC,CAAC"}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
declare const _default: import("convex/server").SchemaDefinition<{
|
|
2
2
|
globals: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
3
|
-
maxParallelism: number;
|
|
4
3
|
logLevel: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
|
|
4
|
+
maxParallelism: number;
|
|
5
5
|
}, {
|
|
6
6
|
maxParallelism: import("convex/values").VFloat64<number, "required">;
|
|
7
7
|
logLevel: import("convex/values").VUnion<"DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR", [import("convex/values").VLiteral<"DEBUG", "required">, import("convex/values").VLiteral<"TRACE", "required">, import("convex/values").VLiteral<"INFO", "required">, import("convex/values").VLiteral<"REPORT", "required">, import("convex/values").VLiteral<"WARN", "required">, import("convex/values").VLiteral<"ERROR", "required">], "required", never>;
|
|
8
|
-
}, "required", "
|
|
8
|
+
}, "required", "logLevel" | "maxParallelism">, {}, {}, {}>;
|
|
9
9
|
internalState: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
10
|
+
running: {
|
|
11
|
+
workId: import("convex/values").GenericId<"work">;
|
|
12
|
+
scheduledId: import("convex/values").GenericId<"_scheduled_functions">;
|
|
13
|
+
started: number;
|
|
14
|
+
}[];
|
|
10
15
|
report: {
|
|
11
16
|
failed: number;
|
|
12
17
|
canceled: number;
|
|
@@ -15,11 +20,6 @@ declare const _default: import("convex/server").SchemaDefinition<{
|
|
|
15
20
|
retries: number;
|
|
16
21
|
lastReportTs: number;
|
|
17
22
|
};
|
|
18
|
-
running: {
|
|
19
|
-
workId: import("convex/values").GenericId<"work">;
|
|
20
|
-
scheduledId: import("convex/values").GenericId<"_scheduled_functions">;
|
|
21
|
-
started: number;
|
|
22
|
-
}[];
|
|
23
23
|
lastRecovery: bigint;
|
|
24
24
|
generation: bigint;
|
|
25
25
|
segmentCursors: {
|
|
@@ -67,7 +67,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
|
|
|
67
67
|
scheduledId: import("convex/values").VId<import("convex/values").GenericId<"_scheduled_functions">, "required">;
|
|
68
68
|
started: import("convex/values").VFloat64<number, "required">;
|
|
69
69
|
}, "required", "workId" | "scheduledId" | "started">, "required">;
|
|
70
|
-
}, "required", "
|
|
70
|
+
}, "required", "running" | "report" | "lastRecovery" | "generation" | "segmentCursors" | "report.failed" | "report.canceled" | "report.completed" | "report.succeeded" | "report.retries" | "report.lastReportTs" | "segmentCursors.incoming" | "segmentCursors.completion" | "segmentCursors.cancelation">, {}, {}, {}>;
|
|
71
71
|
runStatus: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
72
72
|
state: {
|
|
73
73
|
kind: "running";
|
|
@@ -118,7 +118,6 @@ declare const _default: import("convex/server").SchemaDefinition<{
|
|
|
118
118
|
}, "required", "kind" | "generation">], "required", "kind" | "generation" | "scheduledId" | "segment" | "saturated">;
|
|
119
119
|
}, "required", "state" | "state.kind" | "state.generation" | "state.scheduledId" | "state.segment" | "state.saturated">, {}, {}, {}>;
|
|
120
120
|
work: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
121
|
-
canceled?: boolean | undefined;
|
|
122
121
|
onComplete?: {
|
|
123
122
|
context?: any;
|
|
124
123
|
fnHandle: string;
|
|
@@ -128,13 +127,14 @@ declare const _default: import("convex/server").SchemaDefinition<{
|
|
|
128
127
|
initialBackoffMs: number;
|
|
129
128
|
base: number;
|
|
130
129
|
} | undefined;
|
|
130
|
+
canceled?: boolean | undefined;
|
|
131
|
+
fnArgs: any;
|
|
131
132
|
fnHandle: string;
|
|
132
|
-
fnType: "action" | "mutation" | "query";
|
|
133
133
|
fnName: string;
|
|
134
|
-
|
|
134
|
+
fnType: "mutation" | "query" | "action";
|
|
135
135
|
attempts: number;
|
|
136
136
|
}, {
|
|
137
|
-
fnType: import("convex/values").VUnion<"
|
|
137
|
+
fnType: import("convex/values").VUnion<"mutation" | "query" | "action", [import("convex/values").VLiteral<"action", "required">, import("convex/values").VLiteral<"mutation", "required">, import("convex/values").VLiteral<"query", "required">], "required", never>;
|
|
138
138
|
fnHandle: import("convex/values").VString<string, "required">;
|
|
139
139
|
fnName: import("convex/values").VString<string, "required">;
|
|
140
140
|
fnArgs: import("convex/values").VAny<any, "required", string>;
|
|
@@ -156,7 +156,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
|
|
|
156
156
|
base: import("convex/values").VFloat64<number, "required">;
|
|
157
157
|
}, "optional", "maxAttempts" | "initialBackoffMs" | "base">;
|
|
158
158
|
canceled: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
159
|
-
}, "required", "
|
|
159
|
+
}, "required", "fnArgs" | "fnHandle" | "fnName" | "fnType" | "onComplete" | "retryBehavior" | "canceled" | "attempts" | `fnArgs.${string}` | "onComplete.fnHandle" | "onComplete.context" | `onComplete.context.${string}` | "retryBehavior.maxAttempts" | "retryBehavior.initialBackoffMs" | "retryBehavior.base">, {}, {}, {}>;
|
|
160
160
|
pendingStart: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
161
161
|
workId: import("convex/values").GenericId<"work">;
|
|
162
162
|
segment: bigint;
|
|
@@ -169,6 +169,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
|
|
|
169
169
|
}, {}, {}>;
|
|
170
170
|
pendingCompletion: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
171
171
|
workId: import("convex/values").GenericId<"work">;
|
|
172
|
+
retry: boolean;
|
|
172
173
|
segment: bigint;
|
|
173
174
|
runResult: {
|
|
174
175
|
kind: "success";
|
|
@@ -179,7 +180,6 @@ declare const _default: import("convex/server").SchemaDefinition<{
|
|
|
179
180
|
} | {
|
|
180
181
|
kind: "canceled";
|
|
181
182
|
};
|
|
182
|
-
retry: boolean;
|
|
183
183
|
}, {
|
|
184
184
|
segment: import("convex/values").VInt64<bigint, "required">;
|
|
185
185
|
runResult: import("convex/values").VUnion<{
|
|
@@ -209,7 +209,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
|
|
|
209
209
|
}, "required", "kind">], "required", "kind" | "returnValue" | `returnValue.${string}` | "error">;
|
|
210
210
|
workId: import("convex/values").VId<import("convex/values").GenericId<"work">, "required">;
|
|
211
211
|
retry: import("convex/values").VBoolean<boolean, "required">;
|
|
212
|
-
}, "required", "workId" | "
|
|
212
|
+
}, "required", "workId" | "retry" | "segment" | "runResult" | "runResult.kind" | "runResult.returnValue" | `runResult.returnValue.${string}` | "runResult.error">, {
|
|
213
213
|
workId: ["workId", "_creationTime"];
|
|
214
214
|
segment: ["segment", "_creationTime"];
|
|
215
215
|
}, {}, {}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Infer } from "convex/values";
|
|
2
2
|
import { type Logger } from "./logging.js";
|
|
3
|
-
export declare const fnType: import("convex/values").VUnion<"
|
|
3
|
+
export declare const fnType: import("convex/values").VUnion<"mutation" | "query" | "action", [import("convex/values").VLiteral<"action", "required">, import("convex/values").VLiteral<"mutation", "required">, import("convex/values").VLiteral<"query", "required">], "required", never>;
|
|
4
4
|
export declare const DEFAULT_MAX_PARALLELISM = 10;
|
|
5
5
|
export declare const SECOND = 1000;
|
|
6
6
|
export declare const MINUTE: number;
|
|
@@ -12,12 +12,12 @@ export declare function getCurrentSegment(): bigint;
|
|
|
12
12
|
export declare function getNextSegment(): bigint;
|
|
13
13
|
export declare function fromSegment(segment: bigint): number;
|
|
14
14
|
export declare const config: import("convex/values").VObject<{
|
|
15
|
-
maxParallelism: number;
|
|
16
15
|
logLevel: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
|
|
16
|
+
maxParallelism: number;
|
|
17
17
|
}, {
|
|
18
18
|
maxParallelism: import("convex/values").VFloat64<number, "required">;
|
|
19
19
|
logLevel: import("convex/values").VUnion<"DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR", [import("convex/values").VLiteral<"DEBUG", "required">, import("convex/values").VLiteral<"TRACE", "required">, import("convex/values").VLiteral<"INFO", "required">, import("convex/values").VLiteral<"REPORT", "required">, import("convex/values").VLiteral<"WARN", "required">, import("convex/values").VLiteral<"ERROR", "required">], "required", never>;
|
|
20
|
-
}, "required", "
|
|
20
|
+
}, "required", "logLevel" | "maxParallelism">;
|
|
21
21
|
export type Config = Infer<typeof config>;
|
|
22
22
|
export declare const retryBehavior: import("convex/values").VObject<{
|
|
23
23
|
maxAttempts: number;
|
|
@@ -15,6 +15,8 @@ export declare function recordStarted(console: Logger, work: Doc<"work">, lagMs:
|
|
|
15
15
|
export declare function recordCompleted(console: Logger, work: Doc<"work">, status: "success" | "failed" | "canceled" | "retrying"): void;
|
|
16
16
|
export declare function generateReport(ctx: MutationCtx, console: Logger, state: Doc<"internalState">, { maxParallelism, logLevel }: Config): Promise<void>;
|
|
17
17
|
export declare const calculateBacklogAndReport: import("convex/server").RegisteredMutation<"internal", {
|
|
18
|
+
logLevel: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
|
|
19
|
+
running: number;
|
|
18
20
|
report: {
|
|
19
21
|
failed: number;
|
|
20
22
|
canceled: number;
|
|
@@ -23,8 +25,6 @@ export declare const calculateBacklogAndReport: import("convex/server").Register
|
|
|
23
25
|
retries: number;
|
|
24
26
|
lastReportTs: number;
|
|
25
27
|
};
|
|
26
|
-
logLevel: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
|
|
27
|
-
running: number;
|
|
28
28
|
cursor: string;
|
|
29
29
|
startSegment: bigint;
|
|
30
30
|
endSegment: bigint;
|