convex-tracer 0.1.1 → 0.1.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/dist/client/_generated/_ignore.d.ts +1 -0
- package/dist/client/_generated/_ignore.d.ts.map +1 -0
- package/dist/client/_generated/_ignore.js +3 -0
- package/dist/client/_generated/_ignore.js.map +1 -0
- package/dist/client/helpers.d.ts +31 -0
- package/dist/client/helpers.js +186 -0
- package/dist/client/helpers.js.map +1 -0
- package/dist/client/tracer-api/index.d.ts +27 -0
- package/dist/client/tracer-api/index.js +177 -0
- package/dist/client/tracer-api/index.js.map +1 -0
- package/dist/client/tracer-api/types.d.ts +143 -0
- package/dist/client/tracer-api/types.js +2 -0
- package/dist/client/tracer-api/types.js.map +1 -0
- package/dist/client/types.d.ts +168 -0
- package/dist/client/types.js +2 -0
- package/dist/client/types.js.map +1 -0
- package/dist/component/_generated/api.d.ts +36 -0
- package/dist/component/_generated/api.js +31 -0
- package/dist/component/_generated/api.js.map +1 -0
- package/dist/component/_generated/dataModel.d.ts +46 -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 +121 -0
- package/dist/component/_generated/server.js +78 -0
- package/dist/component/_generated/server.js.map +1 -0
- package/dist/component/convex.config.d.ts +3 -0
- package/dist/component/convex.config.d.ts.map +1 -0
- package/dist/component/convex.config.js +3 -0
- package/dist/component/convex.config.js.map +1 -0
- package/dist/component/lib.d.ts +29 -29
- package/dist/component/schema.d.ts +17 -17
- package/dist/component/types.d.ts +93 -93
- package/dist/react/index.d.ts +6 -0
- package/dist/react/index.js +11 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/types.d.ts +8 -0
- package/dist/react/types.js +2 -0
- package/dist/react/types.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import type { FunctionReference, FunctionType, GenericActionCtx, GenericDatabaseReader, GenericDataModel, GenericMutationCtx, GenericQueryCtx, StorageReader } from "convex/server";
|
|
2
|
+
import type { ObjectType, OptionalProperty, PropertyValidators, Validator } from "convex/values";
|
|
3
|
+
import type { EmptyObject } from "../react/types";
|
|
4
|
+
import type { TraceAPI } from "./tracer-api/types";
|
|
5
|
+
export type AnyFunctionReference = FunctionReference<any, any>;
|
|
6
|
+
export type OptionalArgsObject<Args extends PropertyValidators> = keyof Args extends never ? EmptyObject : ObjectType<Args>;
|
|
7
|
+
export type IfArgs<Args extends PropertyValidators, T, F> = keyof Args extends never ? F : T;
|
|
8
|
+
export type ExtractOutput<T> = T extends (ctx: any, args: any) => Promise<infer R> ? R : never;
|
|
9
|
+
export interface TraceContext extends Required<TracerConfig> {
|
|
10
|
+
traceId: string;
|
|
11
|
+
spanId: string;
|
|
12
|
+
}
|
|
13
|
+
export type ArgsWithTraceContext<Args> = Args & {
|
|
14
|
+
__traceContext?: TraceContext;
|
|
15
|
+
};
|
|
16
|
+
export interface TracerConfig {
|
|
17
|
+
/**
|
|
18
|
+
* The sample rate for the trace.
|
|
19
|
+
* This is used to determine whether to sample the trace or not.
|
|
20
|
+
* @default - 0.1
|
|
21
|
+
*/
|
|
22
|
+
sampleRate?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Whether to preserve errors.
|
|
25
|
+
* If true, the trace will be preserved on error.
|
|
26
|
+
* If false, the trace will get sampled.
|
|
27
|
+
* @default - true
|
|
28
|
+
*/
|
|
29
|
+
preserveErrors?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* The amount of time to wait before sampling or deleting the trace.
|
|
32
|
+
* This is used to prevent tracing of long-running functions.
|
|
33
|
+
* @default - 120
|
|
34
|
+
*/
|
|
35
|
+
retentionMinutes?: number;
|
|
36
|
+
}
|
|
37
|
+
export type LogArgs<Args extends PropertyValidators> = IfArgs<Args, boolean | Array<keyof ObjectType<Args>> | undefined, EmptyObject>;
|
|
38
|
+
export interface TracedFunctionOptions<Ctx, Args extends PropertyValidators, Output> {
|
|
39
|
+
/**
|
|
40
|
+
* The name of the traced function.
|
|
41
|
+
* This is used to identify the function in the DB or UI.
|
|
42
|
+
* @default - anonymous_function
|
|
43
|
+
*/
|
|
44
|
+
name?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Whether to log the arguments of the function.
|
|
47
|
+
* This can be a boolean or an array of argument names to log.
|
|
48
|
+
* @default - false
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* logArgs: true, // Logs all arguments
|
|
52
|
+
* logArgs: ["userId", "title"], // Logs only the userId and title arguments
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
logArgs?: LogArgs<Args>;
|
|
56
|
+
/**
|
|
57
|
+
* Whether to log the return value of the function.
|
|
58
|
+
* @default - false
|
|
59
|
+
*/
|
|
60
|
+
logReturn?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* The sample rate for the trace.
|
|
63
|
+
* This is used to determine whether to sample the trace or not.
|
|
64
|
+
* If undefined, the Tracer config will be used
|
|
65
|
+
* @default - 0.1
|
|
66
|
+
*/
|
|
67
|
+
sampleRate?: number;
|
|
68
|
+
/** The retention minutes for the trace.
|
|
69
|
+
* This is used to determine how long to keep the trace.
|
|
70
|
+
* If undefined, the Tracer config will be used
|
|
71
|
+
* @default - 120
|
|
72
|
+
*/
|
|
73
|
+
retentionMinutes?: number;
|
|
74
|
+
/** Whether to preserve errors.
|
|
75
|
+
* If true, the trace will be preserved on error.
|
|
76
|
+
* If undefined, the Tracer config will be used
|
|
77
|
+
* @default - undefined
|
|
78
|
+
*/
|
|
79
|
+
preserveErrors?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* A callback to run before the function starts.
|
|
82
|
+
* @param {any} ctx - The context object.
|
|
83
|
+
* @param {ObjectType<Args>} args - The arguments object.
|
|
84
|
+
* @returns {void | Promise<void>}
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* onStart: async (ctx, args) => {
|
|
88
|
+
* // do something before the function starts
|
|
89
|
+
* await ctx.tracer.info("Starting Processing...");
|
|
90
|
+
* }
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
onStart?: (ctx: Ctx, args: OptionalArgsObject<Args>) => void | Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* A callback to run after the function succeeds.
|
|
96
|
+
* @param {any} ctx - The context object.
|
|
97
|
+
* @param {ObjectType<Args>} args - The arguments object.
|
|
98
|
+
* @param {unknown} result - The result of the function.
|
|
99
|
+
* @returns {void | Promise<void>}
|
|
100
|
+
* @example
|
|
101
|
+
* ```ts
|
|
102
|
+
* onSuccess: async (ctx, args, result) => {
|
|
103
|
+
* // do something with the result
|
|
104
|
+
* await ctx.tracer.info("Successfully processed");
|
|
105
|
+
* }
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
onSuccess?: (ctx: Ctx, args: OptionalArgsObject<Args>, result: Output) => void | Promise<void>;
|
|
109
|
+
/**
|
|
110
|
+
* A callback to run after the function fails.
|
|
111
|
+
* @param {any} ctx - The context object.
|
|
112
|
+
* @param {ObjectType<Args>} args - The arguments object.
|
|
113
|
+
* @param {Error} error - The error that occurred.
|
|
114
|
+
* @returns {void | Promise<void>}
|
|
115
|
+
* @example
|
|
116
|
+
* ```ts
|
|
117
|
+
* onError: async (ctx, args, error) => {
|
|
118
|
+
* // do something to handle the error
|
|
119
|
+
* await ctx.tracer.error("Failed to process", { error: error.message });
|
|
120
|
+
* }
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
onError?: (ctx: Ctx, args: OptionalArgsObject<Args>, error: Error) => void | Promise<void>;
|
|
124
|
+
}
|
|
125
|
+
export type TracerHandler<Ctx, Args extends PropertyValidators> = (ctx: Ctx, args: OptionalArgsObject<Args>) => Promise<any>;
|
|
126
|
+
export type TracedFunctionConfig<Ctx, Args extends PropertyValidators, Handler extends TracerHandler<Ctx, Args>, Output extends ExtractOutput<Handler>> = TracedFunctionOptions<Ctx, Args, Output> & {
|
|
127
|
+
args?: Args;
|
|
128
|
+
handler: Handler;
|
|
129
|
+
returns?: Validator<Output, OptionalProperty, any>;
|
|
130
|
+
};
|
|
131
|
+
export type TracerArgs<Args extends PropertyValidators> = ObjectType<Args & {
|
|
132
|
+
__traceContext?: TraceContext;
|
|
133
|
+
}>;
|
|
134
|
+
export type TracedFunctionTypes = Exclude<FunctionType, "query">;
|
|
135
|
+
export type TracedFunction<Type extends TracedFunctionTypes> = <FuncRef extends FunctionReference<Type, any, any, any>>(funcRef: FuncRef, args?: Omit<FuncRef["_args"], "__traceContext">) => Promise<FuncRef["_returnType"]>;
|
|
136
|
+
type RestrictedQueryContext<DataModel extends GenericDataModel> = Omit<GenericMutationCtx<DataModel>, "runMutation" | "scheduler" | "db" | "storage"> & {
|
|
137
|
+
db: GenericDatabaseReader<DataModel>;
|
|
138
|
+
storage: StorageReader;
|
|
139
|
+
};
|
|
140
|
+
export type QueryCtxWithTracer<DataModel extends GenericDataModel> = RestrictedQueryContext<DataModel> & {
|
|
141
|
+
tracer: TraceAPI;
|
|
142
|
+
runTracedQuery: TracedFunction<"mutation">;
|
|
143
|
+
};
|
|
144
|
+
export type MutationCtxWithTracer<DataModel extends GenericDataModel> = GenericMutationCtx<DataModel> & {
|
|
145
|
+
tracer: TraceAPI;
|
|
146
|
+
runTracedQuery: TracedFunction<"mutation">;
|
|
147
|
+
runTracedMutation: TracedFunction<"mutation">;
|
|
148
|
+
};
|
|
149
|
+
export type ActionCtxWithTracer<DataModel extends GenericDataModel> = GenericActionCtx<DataModel> & {
|
|
150
|
+
tracer: TraceAPI;
|
|
151
|
+
runTracedQuery: TracedFunction<"mutation">;
|
|
152
|
+
runTracedMutation: TracedFunction<"mutation">;
|
|
153
|
+
runTracedAction: TracedFunction<"action">;
|
|
154
|
+
};
|
|
155
|
+
export type TracedFunctionContext<DataModel extends GenericDataModel> = QueryCtxWithTracer<DataModel> | MutationCtxWithTracer<DataModel> | ActionCtxWithTracer<DataModel>;
|
|
156
|
+
export type StrippedGenericFunctionContext<DataModel extends GenericDataModel> = GenericMutationCtx<DataModel> | GenericActionCtx<DataModel>;
|
|
157
|
+
export type GenericFunctionContext<DataModel extends GenericDataModel> = GenericQueryCtx<DataModel> | StrippedGenericFunctionContext<DataModel>;
|
|
158
|
+
export type TracedResult<Output> = {
|
|
159
|
+
success: true;
|
|
160
|
+
data: Output;
|
|
161
|
+
error: undefined;
|
|
162
|
+
} | {
|
|
163
|
+
success: false;
|
|
164
|
+
data: undefined;
|
|
165
|
+
error: string;
|
|
166
|
+
};
|
|
167
|
+
export {};
|
|
168
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated `api` utility.
|
|
3
|
+
*
|
|
4
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
5
|
+
*
|
|
6
|
+
* To regenerate, run `npx convex dev`.
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type * as lib from "../lib.js";
|
|
10
|
+
import type * as types from "../types.js";
|
|
11
|
+
import type { ApiFromModules, FilterApi, FunctionReference } from "convex/server";
|
|
12
|
+
declare const fullApi: ApiFromModules<{
|
|
13
|
+
lib: typeof lib;
|
|
14
|
+
types: typeof types;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* A utility for referencing Convex functions in your app's public API.
|
|
18
|
+
*
|
|
19
|
+
* Usage:
|
|
20
|
+
* ```js
|
|
21
|
+
* const myFunctionReference = api.myModule.myFunction;
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare const api: FilterApi<typeof fullApi, FunctionReference<any, "public">>;
|
|
25
|
+
/**
|
|
26
|
+
* A utility for referencing Convex functions in your app's internal API.
|
|
27
|
+
*
|
|
28
|
+
* Usage:
|
|
29
|
+
* ```js
|
|
30
|
+
* const myFunctionReference = internal.myModule.myFunction;
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare const internal: FilterApi<typeof fullApi, FunctionReference<any, "internal">>;
|
|
34
|
+
export declare const components: {};
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/**
|
|
3
|
+
* Generated `api` utility.
|
|
4
|
+
*
|
|
5
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
6
|
+
*
|
|
7
|
+
* To regenerate, run `npx convex dev`.
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import { anyApi, componentsGeneric } from "convex/server";
|
|
11
|
+
const fullApi = anyApi;
|
|
12
|
+
/**
|
|
13
|
+
* A utility for referencing Convex functions in your app's public API.
|
|
14
|
+
*
|
|
15
|
+
* Usage:
|
|
16
|
+
* ```js
|
|
17
|
+
* const myFunctionReference = api.myModule.myFunction;
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export const api = anyApi;
|
|
21
|
+
/**
|
|
22
|
+
* A utility for referencing Convex functions in your app's internal API.
|
|
23
|
+
*
|
|
24
|
+
* Usage:
|
|
25
|
+
* ```js
|
|
26
|
+
* const myFunctionReference = internal.myModule.myFunction;
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export const internal = anyApi;
|
|
30
|
+
export const components = componentsGeneric();
|
|
31
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/component/_generated/api.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG;AAUH,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,OAAO,GAGR,MAAa,CAAC;AAEnB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,GAAG,GAGZ,MAAa,CAAC;AAElB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAGjB,MAAa,CAAC;AAElB,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,EAAmB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated data model types.
|
|
3
|
+
*
|
|
4
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
5
|
+
*
|
|
6
|
+
* To regenerate, run `npx convex dev`.
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type { DataModelFromSchemaDefinition, DocumentByName, TableNamesInDataModel, SystemTableNames } from "convex/server";
|
|
10
|
+
import type { GenericId } from "convex/values";
|
|
11
|
+
import schema from "../schema.js";
|
|
12
|
+
/**
|
|
13
|
+
* The names of all of your Convex tables.
|
|
14
|
+
*/
|
|
15
|
+
export type TableNames = TableNamesInDataModel<DataModel>;
|
|
16
|
+
/**
|
|
17
|
+
* The type of a document stored in Convex.
|
|
18
|
+
*
|
|
19
|
+
* @typeParam TableName - A string literal type of the table name (like "users").
|
|
20
|
+
*/
|
|
21
|
+
export type Doc<TableName extends TableNames> = DocumentByName<DataModel, TableName>;
|
|
22
|
+
/**
|
|
23
|
+
* An identifier for a document in Convex.
|
|
24
|
+
*
|
|
25
|
+
* Convex documents are uniquely identified by their `Id`, which is accessible
|
|
26
|
+
* on the `_id` field. To learn more, see [Document IDs](https://docs.convex.dev/using/document-ids).
|
|
27
|
+
*
|
|
28
|
+
* Documents can be loaded using `db.get(tableName, id)` in query and mutation functions.
|
|
29
|
+
*
|
|
30
|
+
* IDs are just strings at runtime, but this type can be used to distinguish them from other
|
|
31
|
+
* strings when type checking.
|
|
32
|
+
*
|
|
33
|
+
* @typeParam TableName - A string literal type of the table name (like "users").
|
|
34
|
+
*/
|
|
35
|
+
export type Id<TableName extends TableNames | SystemTableNames> = GenericId<TableName>;
|
|
36
|
+
/**
|
|
37
|
+
* A type describing your Convex data model.
|
|
38
|
+
*
|
|
39
|
+
* This type includes information about what tables you have, the type of
|
|
40
|
+
* documents stored in those tables, and the indexes defined on them.
|
|
41
|
+
*
|
|
42
|
+
* This type is used to parameterize methods like `queryGeneric` and
|
|
43
|
+
* `mutationGeneric` to make them type-safe.
|
|
44
|
+
*/
|
|
45
|
+
export type DataModel = DataModelFromSchemaDefinition<typeof schema>;
|
|
46
|
+
//# sourceMappingURL=dataModel.d.ts.map
|
|
@@ -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"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated utilities for implementing server-side Convex query and mutation functions.
|
|
3
|
+
*
|
|
4
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
5
|
+
*
|
|
6
|
+
* To regenerate, run `npx convex dev`.
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type { ActionBuilder, HttpActionBuilder, MutationBuilder, QueryBuilder, GenericActionCtx, GenericMutationCtx, GenericQueryCtx, GenericDatabaseReader, GenericDatabaseWriter } from "convex/server";
|
|
10
|
+
import type { DataModel } from "./dataModel.js";
|
|
11
|
+
/**
|
|
12
|
+
* Define a query in this Convex app's public API.
|
|
13
|
+
*
|
|
14
|
+
* This function will be allowed to read your Convex database and will be accessible from the client.
|
|
15
|
+
*
|
|
16
|
+
* @param func - The query function. It receives a {@link QueryCtx} as its first argument.
|
|
17
|
+
* @returns The wrapped query. Include this as an `export` to name it and make it accessible.
|
|
18
|
+
*/
|
|
19
|
+
export declare const query: QueryBuilder<DataModel, "public">;
|
|
20
|
+
/**
|
|
21
|
+
* Define a query that is only accessible from other Convex functions (but not from the client).
|
|
22
|
+
*
|
|
23
|
+
* This function will be allowed to read from your Convex database. It will not be accessible from the client.
|
|
24
|
+
*
|
|
25
|
+
* @param func - The query function. It receives a {@link QueryCtx} as its first argument.
|
|
26
|
+
* @returns The wrapped query. Include this as an `export` to name it and make it accessible.
|
|
27
|
+
*/
|
|
28
|
+
export declare const internalQuery: QueryBuilder<DataModel, "internal">;
|
|
29
|
+
/**
|
|
30
|
+
* Define a mutation in this Convex app's public API.
|
|
31
|
+
*
|
|
32
|
+
* This function will be allowed to modify your Convex database and will be accessible from the client.
|
|
33
|
+
*
|
|
34
|
+
* @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
|
|
35
|
+
* @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
|
|
36
|
+
*/
|
|
37
|
+
export declare const mutation: MutationBuilder<DataModel, "public">;
|
|
38
|
+
/**
|
|
39
|
+
* Define a mutation that is only accessible from other Convex functions (but not from the client).
|
|
40
|
+
*
|
|
41
|
+
* This function will be allowed to modify your Convex database. It will not be accessible from the client.
|
|
42
|
+
*
|
|
43
|
+
* @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
|
|
44
|
+
* @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
|
|
45
|
+
*/
|
|
46
|
+
export declare const internalMutation: MutationBuilder<DataModel, "internal">;
|
|
47
|
+
/**
|
|
48
|
+
* Define an action in this Convex app's public API.
|
|
49
|
+
*
|
|
50
|
+
* An action is a function which can execute any JavaScript code, including non-deterministic
|
|
51
|
+
* code and code with side-effects, like calling third-party services.
|
|
52
|
+
* They can be run in Convex's JavaScript environment or in Node.js using the "use node" directive.
|
|
53
|
+
* They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}.
|
|
54
|
+
*
|
|
55
|
+
* @param func - The action. It receives an {@link ActionCtx} as its first argument.
|
|
56
|
+
* @returns The wrapped action. Include this as an `export` to name it and make it accessible.
|
|
57
|
+
*/
|
|
58
|
+
export declare const action: ActionBuilder<DataModel, "public">;
|
|
59
|
+
/**
|
|
60
|
+
* Define an action that is only accessible from other Convex functions (but not from the client).
|
|
61
|
+
*
|
|
62
|
+
* @param func - The function. It receives an {@link ActionCtx} as its first argument.
|
|
63
|
+
* @returns The wrapped function. Include this as an `export` to name it and make it accessible.
|
|
64
|
+
*/
|
|
65
|
+
export declare const internalAction: ActionBuilder<DataModel, "internal">;
|
|
66
|
+
/**
|
|
67
|
+
* Define an HTTP action.
|
|
68
|
+
*
|
|
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.
|
|
76
|
+
*/
|
|
77
|
+
export declare const httpAction: HttpActionBuilder;
|
|
78
|
+
/**
|
|
79
|
+
* A set of services for use within Convex query functions.
|
|
80
|
+
*
|
|
81
|
+
* The query context is passed as the first argument to any Convex query
|
|
82
|
+
* function run on the server.
|
|
83
|
+
*
|
|
84
|
+
* If you're using code generation, use the `QueryCtx` type in `convex/_generated/server.d.ts` instead.
|
|
85
|
+
*/
|
|
86
|
+
export type QueryCtx = GenericQueryCtx<DataModel>;
|
|
87
|
+
/**
|
|
88
|
+
* A set of services for use within Convex mutation functions.
|
|
89
|
+
*
|
|
90
|
+
* The mutation context is passed as the first argument to any Convex mutation
|
|
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.
|
|
94
|
+
*/
|
|
95
|
+
export type MutationCtx = GenericMutationCtx<DataModel>;
|
|
96
|
+
/**
|
|
97
|
+
* A set of services for use within Convex action functions.
|
|
98
|
+
*
|
|
99
|
+
* The action context is passed as the first argument to any Convex action
|
|
100
|
+
* function run on the server.
|
|
101
|
+
*/
|
|
102
|
+
export type ActionCtx = GenericActionCtx<DataModel>;
|
|
103
|
+
/**
|
|
104
|
+
* An interface to read from the database within Convex query functions.
|
|
105
|
+
*
|
|
106
|
+
* The two entry points are {@link DatabaseReader.get}, which fetches a single
|
|
107
|
+
* document by its {@link Id}, or {@link DatabaseReader.query}, which starts
|
|
108
|
+
* building a query.
|
|
109
|
+
*/
|
|
110
|
+
export type DatabaseReader = GenericDatabaseReader<DataModel>;
|
|
111
|
+
/**
|
|
112
|
+
* An interface to read from and write to the database within Convex mutation
|
|
113
|
+
* functions.
|
|
114
|
+
*
|
|
115
|
+
* Convex guarantees that all writes within a single mutation are
|
|
116
|
+
* executed atomically, so you never have to worry about partial writes leaving
|
|
117
|
+
* your data in an inconsistent state. See [the Convex Guide](https://docs.convex.dev/understanding/convex-fundamentals/functions#atomicity-and-optimistic-concurrency-control)
|
|
118
|
+
* for the guarantees Convex provides your functions.
|
|
119
|
+
*/
|
|
120
|
+
export type DatabaseWriter = GenericDatabaseWriter<DataModel>;
|
|
121
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/**
|
|
3
|
+
* Generated utilities for implementing server-side Convex query and mutation functions.
|
|
4
|
+
*
|
|
5
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
6
|
+
*
|
|
7
|
+
* To regenerate, run `npx convex dev`.
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import { actionGeneric, httpActionGeneric, queryGeneric, mutationGeneric, internalActionGeneric, internalMutationGeneric, internalQueryGeneric, } from "convex/server";
|
|
11
|
+
/**
|
|
12
|
+
* Define a query in this Convex app's public API.
|
|
13
|
+
*
|
|
14
|
+
* This function will be allowed to read your Convex database and will be accessible from the client.
|
|
15
|
+
*
|
|
16
|
+
* @param func - The query function. It receives a {@link QueryCtx} as its first argument.
|
|
17
|
+
* @returns The wrapped query. Include this as an `export` to name it and make it accessible.
|
|
18
|
+
*/
|
|
19
|
+
export const query = queryGeneric;
|
|
20
|
+
/**
|
|
21
|
+
* Define a query that is only accessible from other Convex functions (but not from the client).
|
|
22
|
+
*
|
|
23
|
+
* This function will be allowed to read from your Convex database. It will not be accessible from the client.
|
|
24
|
+
*
|
|
25
|
+
* @param func - The query function. It receives a {@link QueryCtx} as its first argument.
|
|
26
|
+
* @returns The wrapped query. Include this as an `export` to name it and make it accessible.
|
|
27
|
+
*/
|
|
28
|
+
export const internalQuery = internalQueryGeneric;
|
|
29
|
+
/**
|
|
30
|
+
* Define a mutation in this Convex app's public API.
|
|
31
|
+
*
|
|
32
|
+
* This function will be allowed to modify your Convex database and will be accessible from the client.
|
|
33
|
+
*
|
|
34
|
+
* @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
|
|
35
|
+
* @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
|
|
36
|
+
*/
|
|
37
|
+
export const mutation = mutationGeneric;
|
|
38
|
+
/**
|
|
39
|
+
* Define a mutation that is only accessible from other Convex functions (but not from the client).
|
|
40
|
+
*
|
|
41
|
+
* This function will be allowed to modify your Convex database. It will not be accessible from the client.
|
|
42
|
+
*
|
|
43
|
+
* @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
|
|
44
|
+
* @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
|
|
45
|
+
*/
|
|
46
|
+
export const internalMutation = internalMutationGeneric;
|
|
47
|
+
/**
|
|
48
|
+
* Define an action in this Convex app's public API.
|
|
49
|
+
*
|
|
50
|
+
* An action is a function which can execute any JavaScript code, including non-deterministic
|
|
51
|
+
* code and code with side-effects, like calling third-party services.
|
|
52
|
+
* They can be run in Convex's JavaScript environment or in Node.js using the "use node" directive.
|
|
53
|
+
* They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}.
|
|
54
|
+
*
|
|
55
|
+
* @param func - The action. It receives an {@link ActionCtx} as its first argument.
|
|
56
|
+
* @returns The wrapped action. Include this as an `export` to name it and make it accessible.
|
|
57
|
+
*/
|
|
58
|
+
export const action = actionGeneric;
|
|
59
|
+
/**
|
|
60
|
+
* Define an action that is only accessible from other Convex functions (but not from the client).
|
|
61
|
+
*
|
|
62
|
+
* @param func - The function. It receives an {@link ActionCtx} as its first argument.
|
|
63
|
+
* @returns The wrapped function. Include this as an `export` to name it and make it accessible.
|
|
64
|
+
*/
|
|
65
|
+
export const internalAction = internalActionGeneric;
|
|
66
|
+
/**
|
|
67
|
+
* Define an HTTP action.
|
|
68
|
+
*
|
|
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.
|
|
76
|
+
*/
|
|
77
|
+
export const httpAction = httpActionGeneric;
|
|
78
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convex.config.d.ts","sourceRoot":"","sources":["../../src/component/convex.config.ts"],"names":[],"mappings":";AAEA,wBAAyC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convex.config.js","sourceRoot":"","sources":["../../src/component/convex.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,eAAe,eAAe,CAAC,QAAQ,CAAC,CAAC"}
|