convex-tracer 0.1.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/LICENSE +201 -0
- package/README.md +592 -0
- 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.d.ts.map +1 -0
- package/dist/client/helpers.js +177 -0
- package/dist/client/helpers.js.map +1 -0
- package/dist/client/index.d.ts +210 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +355 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/tracer-api/index.d.ts +27 -0
- package/dist/client/tracer-api/index.d.ts.map +1 -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.d.ts.map +1 -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.d.ts.map +1 -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.d.ts.map +1 -0
- package/dist/component/_generated/api.js +31 -0
- package/dist/component/_generated/api.js.map +1 -0
- package/dist/component/_generated/component.d.ts +139 -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 +46 -0
- 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 +121 -0
- package/dist/component/_generated/server.d.ts.map +1 -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 +161 -0
- package/dist/component/lib.d.ts.map +1 -0
- package/dist/component/lib.js +349 -0
- package/dist/component/lib.js.map +1 -0
- package/dist/component/schema.d.ts +75 -0
- package/dist/component/schema.d.ts.map +1 -0
- package/dist/component/schema.js +46 -0
- package/dist/component/schema.js.map +1 -0
- package/dist/component/types.d.ts +286 -0
- package/dist/component/types.d.ts.map +1 -0
- package/dist/component/types.js +28 -0
- package/dist/component/types.js.map +1 -0
- package/dist/react/index.d.ts +6 -0
- package/dist/react/index.d.ts.map +1 -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.d.ts.map +1 -0
- package/dist/react/types.js +2 -0
- package/dist/react/types.js.map +1 -0
- package/package.json +121 -0
- package/src/client/_generated/_ignore.ts +1 -0
- package/src/client/helpers.ts +278 -0
- package/src/client/index.ts +593 -0
- package/src/client/setup.test.ts +26 -0
- package/src/client/tracer-api/index.ts +235 -0
- package/src/client/tracer-api/types.ts +168 -0
- package/src/client/types.ts +257 -0
- package/src/component/_generated/api.ts +52 -0
- package/src/component/_generated/component.ts +199 -0
- package/src/component/_generated/dataModel.ts +60 -0
- package/src/component/_generated/server.ts +161 -0
- package/src/component/convex.config.ts +3 -0
- package/src/component/lib.ts +399 -0
- package/src/component/schema.ts +62 -0
- package/src/component/setup.test.ts +11 -0
- package/src/component/types.ts +38 -0
- package/src/react/index.ts +36 -0
- package/src/react/types.ts +15 -0
- package/src/test.ts +18 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { sourceValidator, statusValidator } from "../../component/schema";
|
|
2
|
+
export interface SpanAPI {
|
|
3
|
+
/**
|
|
4
|
+
* Adds an info log to the current span.
|
|
5
|
+
* @param {string} message - The message to log.
|
|
6
|
+
* @param {Record<string, any>} metadata - Optional metadata to include with the log.
|
|
7
|
+
* @returns {Promise<void>}
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* ctx.tracer.info("User created", { userId: user._id });
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
info(message: string, metadata?: Record<string, any>): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Adds a warning log to the current span.
|
|
16
|
+
* @param {string} message - The message to log.
|
|
17
|
+
* @param {Record<string, any>} metadata - Optional metadata to include with the log.
|
|
18
|
+
* @returns {Promise<void>}
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* ctx.tracer.warn("User not found", { userId: user._id });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
warn(message: string, metadata?: Record<string, any>): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Adds an error log to the current span.
|
|
27
|
+
* @param {string} message - The message to log.
|
|
28
|
+
* @param {Record<string, any>} metadata - Optional metadata to include with the log.
|
|
29
|
+
* @returns {Promise<void>}
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* ctx.tracer.error("User not found", { userId: user._id });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
error(message: string, metadata?: Record<string, any>): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Sets the metadata for the current span.
|
|
38
|
+
* @param {Record<string, any>} metadata - The metadata to set.
|
|
39
|
+
* @returns {Promise<void>}
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* ctx.tracer.updateMetadata({ userId: user._id });
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
updateMetadata(metadata: Record<string, any>): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Creates a new span within the current trace.
|
|
48
|
+
* @param {string} name - The name of the span.
|
|
49
|
+
* @param {(span: SpanAPI) => Promise<T>} fn - The function to run within the span.
|
|
50
|
+
* @returns {Promise<T>} The result of the function.
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* const result = await span.withSpan("createPost", async (span) => {
|
|
54
|
+
* await span.info("Creating post");
|
|
55
|
+
* return await ctx.db.insert("posts", args);
|
|
56
|
+
* });
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
withSpan<T>(name: string, fn: (span: SpanAPI) => Promise<T>): Promise<T>;
|
|
60
|
+
}
|
|
61
|
+
export interface TraceAPI extends SpanAPI {
|
|
62
|
+
/**
|
|
63
|
+
* Preserves the current trace.
|
|
64
|
+
* This will prevent the trace from being discarded or sampled.
|
|
65
|
+
* @returns {Promise<void>}
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* await ctx.tracer.preserve();
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
preserve(): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Discards the current trace.
|
|
74
|
+
* This will prevent the trace from being preserved.
|
|
75
|
+
* @returns {Promise<void>}
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* await ctx.tracer.discard();
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
discard(): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Makes sure the current trace will get sampled.
|
|
84
|
+
* This will undo any preserve() or discard() calls.
|
|
85
|
+
* @param {number} sampleRate - The sample rate to use. (optional)
|
|
86
|
+
* @returns {Promise<void>}
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* await ctx.tracer.sample();
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
sample(sampleRate?: number): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* Creates a new span within the current trace.
|
|
95
|
+
* @param {string} name - The name of the span.
|
|
96
|
+
* @param {(span: SpanAPI) => Promise<T>} fn - The function to run within the span.
|
|
97
|
+
* @returns {Promise<T>} The result of the function.
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* const result = await ctx.tracer.withSpan("createPost", async (span) => {
|
|
101
|
+
* await span.info("Creating post");
|
|
102
|
+
* return await ctx.db.insert("posts", args);
|
|
103
|
+
* });
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
withSpan<T>(name: string, fn: (span: SpanAPI) => Promise<T>): Promise<T>;
|
|
107
|
+
/**
|
|
108
|
+
* The Trace ID of the current trace.
|
|
109
|
+
*/
|
|
110
|
+
getTraceId(): string;
|
|
111
|
+
/**
|
|
112
|
+
* The Span ID of the current span.
|
|
113
|
+
*/
|
|
114
|
+
getSpanId(): string;
|
|
115
|
+
}
|
|
116
|
+
export interface TracerAPI {
|
|
117
|
+
/**
|
|
118
|
+
* Creates a new trace in the database.
|
|
119
|
+
* @param {string} traceId - The ID of the trace to create.
|
|
120
|
+
* @param {"pending" | "success" | "error"} status - The status of the trace.
|
|
121
|
+
* @param {number} sampleRate - The sample rate for the trace.
|
|
122
|
+
* @param {any} metadata - The metadata for the trace.
|
|
123
|
+
* @param {typeof statusValidator.type} source - The source of the trace.
|
|
124
|
+
* @returns {Promise<string>} A promise that resolves to the ID of the created trace.
|
|
125
|
+
*/
|
|
126
|
+
createTrace: (traceId: string, status: typeof statusValidator.type, sampleRate: number, metadata: any, source: typeof sourceValidator.type) => Promise<string>;
|
|
127
|
+
/**
|
|
128
|
+
* Updates the status of a trace.
|
|
129
|
+
* @param {string} traceId - The ID of the trace to update.
|
|
130
|
+
* @param {typeof statusValidator.type} status - The new status of the trace.
|
|
131
|
+
* @returns {Promise<void>} A promise that resolves when the trace is updated.
|
|
132
|
+
*/
|
|
133
|
+
updateTraceStatus: (traceId: string, status: typeof statusValidator.type) => Promise<void>;
|
|
134
|
+
/**
|
|
135
|
+
* Updates the preserve flag of a trace.
|
|
136
|
+
* @param {string} traceId - The ID of the trace to update.
|
|
137
|
+
* @param {boolean | undefined} preserve - The new preserve flag of the trace.
|
|
138
|
+
* @returns {Promise<void>} A promise that resolves when the trace is updated.
|
|
139
|
+
*/
|
|
140
|
+
updateTracePreserve: (traceId: string, preserve: boolean | undefined) => Promise<void>;
|
|
141
|
+
updateTraceMetadata: (traceId: string, metadata: any) => Promise<void>;
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/client/tracer-api/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE1E,MAAM,WAAW,OAAO;IACtB;;;;;;;;;OASG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAErE;;;;;;;;;OASG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAErE;;;;;;;;;OASG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtE;;;;;;;;OAQG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7D;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAC1E;AAED,MAAM,WAAW,QAAS,SAAQ,OAAO;IACvC;;;;;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],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -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.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,aAAa,EACd,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EACV,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAE/D,MAAM,MAAM,kBAAkB,CAAC,IAAI,SAAS,kBAAkB,IAC5D,MAAM,IAAI,SAAS,KAAK,GAAG,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;AAE5D,MAAM,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,CAAC;IACjB,cAAc,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAC3C,iBAAiB,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAC9C,eAAe,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;CAC3C,CAAC;AAEJ,MAAM,MAAM,qBAAqB,CAAC,SAAS,SAAS,gBAAgB,IAChE,kBAAkB,CAAC,SAAS,CAAC,GAC7B,qBAAqB,CAAC,SAAS,CAAC,GAChC,mBAAmB,CAAC,SAAS,CAAC,CAAC;AAEnC,MAAM,MAAM,8BAA8B,CAAC,SAAS,SAAS,gBAAgB,IAC3E,kBAAkB,CAAC,SAAS,CAAC,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;AAE9D,MAAM,MAAM,sBAAsB,CAAC,SAAS,SAAS,gBAAgB,IACjE,eAAe,CAAC,SAAS,CAAC,GAC1B,8BAA8B,CAAC,SAAS,CAAC,CAAC;AAE9C,MAAM,MAAM,YAAY,CAAC,MAAM,IAC3B;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GACjD;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/api.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,KAAK,GAAG,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAC;AAE1C,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,iBAAiB,EAClB,MAAM,eAAe,CAAC;AAGvB,QAAA,MAAM,OAAO,EAAE,cAAc,CAAC;IAC5B,GAAG,EAAE,OAAO,GAAG,CAAC;IAChB,KAAK,EAAE,OAAO,KAAK,CAAC;CACrB,CAAiB,CAAC;AAEnB;;;;;;;GAOG;AACH,eAAO,MAAM,GAAG,EAAE,SAAS,CACzB,OAAO,OAAO,EACd,iBAAiB,CAAC,GAAG,EAAE,QAAQ,CAAC,CACjB,CAAC;AAElB;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,EAAE,SAAS,CAC9B,OAAO,OAAO,EACd,iBAAiB,CAAC,GAAG,EAAE,UAAU,CAAC,CACnB,CAAC;AAElB,eAAO,MAAM,UAAU,EAAqC,EAAE,CAAC"}
|
|
@@ -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,139 @@
|
|
|
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
|
+
addLog: FunctionReference<"mutation", "internal", {
|
|
24
|
+
log: {
|
|
25
|
+
message: string;
|
|
26
|
+
metadata?: Record<string, any>;
|
|
27
|
+
severity: "info" | "warn" | "error";
|
|
28
|
+
timestamp: number;
|
|
29
|
+
};
|
|
30
|
+
spanId: string;
|
|
31
|
+
}, string, Name>;
|
|
32
|
+
cleanupTrace: FunctionReference<"mutation", "internal", {
|
|
33
|
+
traceId: string;
|
|
34
|
+
}, null, Name>;
|
|
35
|
+
completeSpan: FunctionReference<"mutation", "internal", {
|
|
36
|
+
duration: number;
|
|
37
|
+
endTime: number;
|
|
38
|
+
error?: string;
|
|
39
|
+
result?: any;
|
|
40
|
+
spanId: string;
|
|
41
|
+
status: "success" | "error";
|
|
42
|
+
}, null, Name>;
|
|
43
|
+
createSpan: FunctionReference<"mutation", "internal", {
|
|
44
|
+
span: {
|
|
45
|
+
args?: any;
|
|
46
|
+
functionName?: string;
|
|
47
|
+
parentSpanId?: string;
|
|
48
|
+
source: "frontend" | "backend";
|
|
49
|
+
spanName: string;
|
|
50
|
+
startTime: number;
|
|
51
|
+
status: "pending" | "success" | "error";
|
|
52
|
+
};
|
|
53
|
+
traceId: string;
|
|
54
|
+
}, string, Name>;
|
|
55
|
+
createTrace: FunctionReference<"mutation", "internal", {
|
|
56
|
+
metadata?: Record<string, any>;
|
|
57
|
+
sampleRate: number;
|
|
58
|
+
source: "frontend" | "backend";
|
|
59
|
+
status: "pending" | "success" | "error";
|
|
60
|
+
}, string, Name>;
|
|
61
|
+
getTrace: FunctionReference<"query", "internal", {
|
|
62
|
+
traceId: string;
|
|
63
|
+
}, null | {
|
|
64
|
+
_creationTime: number;
|
|
65
|
+
_id: string;
|
|
66
|
+
metadata?: Record<string, any>;
|
|
67
|
+
preserve?: boolean;
|
|
68
|
+
sampleRate: number;
|
|
69
|
+
spans: Array<{
|
|
70
|
+
_creationTime: number;
|
|
71
|
+
_id: string;
|
|
72
|
+
args?: any;
|
|
73
|
+
children?: Array<any>;
|
|
74
|
+
duration?: number;
|
|
75
|
+
endTime?: number;
|
|
76
|
+
error?: string;
|
|
77
|
+
functionName?: string;
|
|
78
|
+
logs?: Array<{
|
|
79
|
+
_creationTime: number;
|
|
80
|
+
_id: string;
|
|
81
|
+
message: string;
|
|
82
|
+
metadata?: Record<string, any>;
|
|
83
|
+
severity: "info" | "warn" | "error";
|
|
84
|
+
spanId: string;
|
|
85
|
+
timestamp: number;
|
|
86
|
+
}>;
|
|
87
|
+
metadata?: Record<string, any>;
|
|
88
|
+
parentSpanId?: string;
|
|
89
|
+
result?: any;
|
|
90
|
+
source: "frontend" | "backend";
|
|
91
|
+
spanName: string;
|
|
92
|
+
startTime: number;
|
|
93
|
+
status: "pending" | "success" | "error";
|
|
94
|
+
traceId: string;
|
|
95
|
+
}>;
|
|
96
|
+
status: "pending" | "success" | "error";
|
|
97
|
+
updatedAt: number;
|
|
98
|
+
userId?: string;
|
|
99
|
+
}, Name>;
|
|
100
|
+
listTraces: FunctionReference<"query", "internal", {
|
|
101
|
+
limit?: number;
|
|
102
|
+
status?: "pending" | "success" | "error";
|
|
103
|
+
userId?: string;
|
|
104
|
+
}, Array<{
|
|
105
|
+
_creationTime: number;
|
|
106
|
+
_id: string;
|
|
107
|
+
metadata?: Record<string, any>;
|
|
108
|
+
preserve?: boolean;
|
|
109
|
+
sampleRate: number;
|
|
110
|
+
status: "pending" | "success" | "error";
|
|
111
|
+
updatedAt: number;
|
|
112
|
+
userId?: string;
|
|
113
|
+
}>, Name>;
|
|
114
|
+
updateSpanMetadata: FunctionReference<"mutation", "internal", {
|
|
115
|
+
metadata: Record<string, any>;
|
|
116
|
+
spanId: string;
|
|
117
|
+
}, null, Name>;
|
|
118
|
+
updateTraceMetadata: FunctionReference<"mutation", "internal", {
|
|
119
|
+
metadata: Record<string, any>;
|
|
120
|
+
traceId: string;
|
|
121
|
+
}, null, Name>;
|
|
122
|
+
updateTracePreserve: FunctionReference<"mutation", "internal", {
|
|
123
|
+
preserve?: boolean;
|
|
124
|
+
sampleRate?: number;
|
|
125
|
+
traceId: string;
|
|
126
|
+
}, null, Name>;
|
|
127
|
+
updateTraceStatus: FunctionReference<"mutation", "internal", {
|
|
128
|
+
status: "pending" | "success" | "error";
|
|
129
|
+
traceId: string;
|
|
130
|
+
}, null, Name>;
|
|
131
|
+
verifySpan: FunctionReference<"query", "internal", {
|
|
132
|
+
spanId: string;
|
|
133
|
+
}, boolean, Name>;
|
|
134
|
+
verifyTrace: FunctionReference<"query", "internal", {
|
|
135
|
+
traceId: string;
|
|
136
|
+
}, boolean, Name>;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
//# sourceMappingURL=component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/component.ts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CAAC,EACF,IAAI,CACL,CAAC;QACF,kBAAkB,EAAE,iBAAiB,CACnC,UAAU,EACV,UAAU,EACV;YAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,EACjD,IAAI,EACJ,IAAI,CACL,CAAC;QACF,mBAAmB,EAAE,iBAAiB,CACpC,UAAU,EACV,UAAU,EACV;YAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,EAClD,IAAI,EACJ,IAAI,CACL,CAAC;QACF,mBAAmB,EAAE,iBAAiB,CACpC,UAAU,EACV,UAAU,EACV;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;YAAC,UAAU,CAAC,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,EAC5D,IAAI,EACJ,IAAI,CACL,CAAC;QACF,iBAAiB,EAAE,iBAAiB,CAClC,UAAU,EACV,UAAU,EACV;YAAE,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,EAC5D,IAAI,EACJ,IAAI,CACL,CAAC;QACF,UAAU,EAAE,iBAAiB,CAC3B,OAAO,EACP,UAAU,EACV;YAAE,MAAM,EAAE,MAAM,CAAA;SAAE,EAClB,OAAO,EACP,IAAI,CACL,CAAC;QACF,WAAW,EAAE,iBAAiB,CAC5B,OAAO,EACP,UAAU,EACV;YAAE,OAAO,EAAE,MAAM,CAAA;SAAE,EACnB,OAAO,EACP,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"}
|
|
@@ -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.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"}
|