@posthog/convex 0.0.1 → 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 +299 -0
- package/README.md +237 -29
- package/dist/client/index.d.ts +126 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +213 -0
- package/dist/client/index.js.map +1 -0
- package/dist/component/_generated/api.d.ts +34 -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 +134 -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 +119 -0
- package/dist/component/lib.d.ts.map +1 -0
- package/dist/component/lib.js +221 -0
- package/dist/component/lib.js.map +1 -0
- package/dist/component/schema.d.ts +3 -0
- package/dist/component/schema.d.ts.map +1 -0
- package/dist/component/schema.js +3 -0
- package/dist/component/schema.js.map +1 -0
- package/package.json +78 -7
- package/src/client/index.test.ts +505 -0
- package/src/client/index.ts +363 -0
- package/src/client/setup.test.ts +20 -0
- package/src/component/_generated/api.ts +50 -0
- package/src/component/_generated/component.ts +203 -0
- package/src/component/_generated/dataModel.ts +60 -0
- package/src/component/_generated/server.ts +156 -0
- package/src/component/convex.config.ts +3 -0
- package/src/component/lib.ts +259 -0
- package/src/component/schema.ts +3 -0
- package/src/component/setup.test.ts +11 -0
- package/src/test.ts +15 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { Scheduler } from 'convex/server';
|
|
2
|
+
import type { ComponentApi } from '../component/_generated/component.js';
|
|
3
|
+
/** Context with a scheduler — available in mutations and actions. */
|
|
4
|
+
type SchedulerCtx = {
|
|
5
|
+
scheduler: Scheduler;
|
|
6
|
+
};
|
|
7
|
+
/** Context with runAction — available in actions only. */
|
|
8
|
+
type ActionCtx = {
|
|
9
|
+
runAction: (reference: any, args: any) => Promise<any>;
|
|
10
|
+
};
|
|
11
|
+
type FeatureFlagOptions = {
|
|
12
|
+
groups?: Record<string, string>;
|
|
13
|
+
personProperties?: Record<string, string>;
|
|
14
|
+
groupProperties?: Record<string, Record<string, string>>;
|
|
15
|
+
sendFeatureFlagEvents?: boolean;
|
|
16
|
+
disableGeoip?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type FeatureFlagResult = {
|
|
19
|
+
key: string;
|
|
20
|
+
enabled: boolean;
|
|
21
|
+
variant: string | null;
|
|
22
|
+
payload: unknown;
|
|
23
|
+
};
|
|
24
|
+
export type PostHogEvent = {
|
|
25
|
+
event: string;
|
|
26
|
+
distinctId: string;
|
|
27
|
+
properties?: Record<string, unknown>;
|
|
28
|
+
};
|
|
29
|
+
export type BeforeSendFn = (event: PostHogEvent) => PostHogEvent | null;
|
|
30
|
+
export type IdentifyFn = (ctx: any) => Promise<{
|
|
31
|
+
distinctId: string;
|
|
32
|
+
} | null>;
|
|
33
|
+
export declare function normalizeError(error: unknown): {
|
|
34
|
+
message: string;
|
|
35
|
+
stack?: string;
|
|
36
|
+
name?: string;
|
|
37
|
+
};
|
|
38
|
+
export declare class PostHog {
|
|
39
|
+
component: ComponentApi;
|
|
40
|
+
private apiKey;
|
|
41
|
+
private host;
|
|
42
|
+
private beforeSend?;
|
|
43
|
+
private identifyFn?;
|
|
44
|
+
constructor(component: ComponentApi, options?: {
|
|
45
|
+
apiKey?: string;
|
|
46
|
+
host?: string;
|
|
47
|
+
beforeSend?: BeforeSendFn | BeforeSendFn[];
|
|
48
|
+
identify?: IdentifyFn;
|
|
49
|
+
});
|
|
50
|
+
private resolveDistinctId;
|
|
51
|
+
private runBeforeSend;
|
|
52
|
+
capture(ctx: SchedulerCtx, args: {
|
|
53
|
+
distinctId?: string;
|
|
54
|
+
event: string;
|
|
55
|
+
properties?: Record<string, unknown>;
|
|
56
|
+
groups?: Record<string, string | number>;
|
|
57
|
+
sendFeatureFlags?: boolean;
|
|
58
|
+
timestamp?: Date;
|
|
59
|
+
uuid?: string;
|
|
60
|
+
disableGeoip?: boolean;
|
|
61
|
+
}): Promise<void>;
|
|
62
|
+
identify(ctx: SchedulerCtx, args: {
|
|
63
|
+
distinctId?: string;
|
|
64
|
+
properties?: Record<string, unknown> & {
|
|
65
|
+
$set?: Record<string, unknown>;
|
|
66
|
+
$set_once?: Record<string, unknown>;
|
|
67
|
+
$anon_distinct_id?: string;
|
|
68
|
+
};
|
|
69
|
+
disableGeoip?: boolean;
|
|
70
|
+
}): Promise<void>;
|
|
71
|
+
groupIdentify(ctx: SchedulerCtx, args: {
|
|
72
|
+
groupType: string;
|
|
73
|
+
groupKey: string;
|
|
74
|
+
properties?: Record<string, unknown>;
|
|
75
|
+
distinctId?: string;
|
|
76
|
+
disableGeoip?: boolean;
|
|
77
|
+
}): Promise<void>;
|
|
78
|
+
alias(ctx: SchedulerCtx, args: {
|
|
79
|
+
distinctId?: string;
|
|
80
|
+
alias: string;
|
|
81
|
+
disableGeoip?: boolean;
|
|
82
|
+
}): Promise<void>;
|
|
83
|
+
captureException(ctx: SchedulerCtx, args: {
|
|
84
|
+
error: unknown;
|
|
85
|
+
distinctId?: string;
|
|
86
|
+
additionalProperties?: Record<string, unknown>;
|
|
87
|
+
}): Promise<void>;
|
|
88
|
+
getFeatureFlag(ctx: ActionCtx, args: {
|
|
89
|
+
key: string;
|
|
90
|
+
distinctId?: string;
|
|
91
|
+
} & FeatureFlagOptions): Promise<boolean | string | null>;
|
|
92
|
+
isFeatureEnabled(ctx: ActionCtx, args: {
|
|
93
|
+
key: string;
|
|
94
|
+
distinctId?: string;
|
|
95
|
+
} & FeatureFlagOptions): Promise<boolean | null>;
|
|
96
|
+
getFeatureFlagPayload(ctx: ActionCtx, args: {
|
|
97
|
+
key: string;
|
|
98
|
+
distinctId?: string;
|
|
99
|
+
matchValue?: boolean | string;
|
|
100
|
+
} & FeatureFlagOptions): Promise<unknown>;
|
|
101
|
+
getFeatureFlagResult(ctx: ActionCtx, args: {
|
|
102
|
+
key: string;
|
|
103
|
+
distinctId?: string;
|
|
104
|
+
} & FeatureFlagOptions): Promise<FeatureFlagResult | null>;
|
|
105
|
+
getAllFlags(ctx: ActionCtx, args: {
|
|
106
|
+
distinctId?: string;
|
|
107
|
+
groups?: Record<string, string>;
|
|
108
|
+
personProperties?: Record<string, string>;
|
|
109
|
+
groupProperties?: Record<string, Record<string, string>>;
|
|
110
|
+
disableGeoip?: boolean;
|
|
111
|
+
flagKeys?: string[];
|
|
112
|
+
}): Promise<Record<string, boolean | string>>;
|
|
113
|
+
getAllFlagsAndPayloads(ctx: ActionCtx, args: {
|
|
114
|
+
distinctId?: string;
|
|
115
|
+
groups?: Record<string, string>;
|
|
116
|
+
personProperties?: Record<string, string>;
|
|
117
|
+
groupProperties?: Record<string, Record<string, string>>;
|
|
118
|
+
disableGeoip?: boolean;
|
|
119
|
+
flagKeys?: string[];
|
|
120
|
+
}): Promise<{
|
|
121
|
+
featureFlags: Record<string, boolean | string>;
|
|
122
|
+
featureFlagPayloads: Record<string, unknown>;
|
|
123
|
+
}>;
|
|
124
|
+
}
|
|
125
|
+
export {};
|
|
126
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAA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OAAO,CAAC;QACT,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,CAAA;QAC9C,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAC7C,CAAC;CASH"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
export function normalizeError(error) {
|
|
2
|
+
if (error instanceof Error) {
|
|
3
|
+
return { message: error.message, stack: error.stack, name: error.name };
|
|
4
|
+
}
|
|
5
|
+
if (typeof error === 'string') {
|
|
6
|
+
return { message: error };
|
|
7
|
+
}
|
|
8
|
+
if (typeof error === 'object' &&
|
|
9
|
+
error !== null &&
|
|
10
|
+
'message' in error &&
|
|
11
|
+
typeof error.message === 'string') {
|
|
12
|
+
const obj = error;
|
|
13
|
+
return {
|
|
14
|
+
message: obj.message,
|
|
15
|
+
stack: typeof obj.stack === 'string' ? obj.stack : undefined,
|
|
16
|
+
name: typeof obj.name === 'string' ? obj.name : undefined,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
return { message: String(error) };
|
|
20
|
+
}
|
|
21
|
+
export class PostHog {
|
|
22
|
+
component;
|
|
23
|
+
apiKey;
|
|
24
|
+
host;
|
|
25
|
+
beforeSend;
|
|
26
|
+
identifyFn;
|
|
27
|
+
constructor(component, options) {
|
|
28
|
+
this.component = component;
|
|
29
|
+
this.apiKey = options?.apiKey ?? process.env.POSTHOG_API_KEY ?? '';
|
|
30
|
+
this.host = options?.host ?? process.env.POSTHOG_HOST ?? 'https://us.i.posthog.com';
|
|
31
|
+
this.beforeSend = options?.beforeSend;
|
|
32
|
+
this.identifyFn = options?.identify;
|
|
33
|
+
}
|
|
34
|
+
async resolveDistinctId(ctx, argsDistinctId) {
|
|
35
|
+
if (this.identifyFn) {
|
|
36
|
+
const result = await this.identifyFn(ctx);
|
|
37
|
+
if (result)
|
|
38
|
+
return result.distinctId;
|
|
39
|
+
}
|
|
40
|
+
if (argsDistinctId)
|
|
41
|
+
return argsDistinctId;
|
|
42
|
+
throw new Error('PostHog: Could not resolve distinctId. Either configure an identify callback ' +
|
|
43
|
+
'in the PostHog constructor or pass distinctId explicitly.');
|
|
44
|
+
}
|
|
45
|
+
runBeforeSend(event) {
|
|
46
|
+
if (!this.beforeSend)
|
|
47
|
+
return event;
|
|
48
|
+
const fns = Array.isArray(this.beforeSend) ? this.beforeSend : [this.beforeSend];
|
|
49
|
+
let result = event;
|
|
50
|
+
for (const fn of fns) {
|
|
51
|
+
result = fn(result);
|
|
52
|
+
if (!result)
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
// --- Fire-and-forget methods (work in mutations and actions) ---
|
|
58
|
+
async capture(ctx, args) {
|
|
59
|
+
const distinctId = await this.resolveDistinctId(ctx, args.distinctId);
|
|
60
|
+
const result = this.runBeforeSend({
|
|
61
|
+
event: args.event,
|
|
62
|
+
distinctId,
|
|
63
|
+
properties: args.properties,
|
|
64
|
+
});
|
|
65
|
+
if (!result)
|
|
66
|
+
return;
|
|
67
|
+
await ctx.scheduler.runAfter(0, this.component.lib.capture, {
|
|
68
|
+
apiKey: this.apiKey,
|
|
69
|
+
host: this.host,
|
|
70
|
+
distinctId: result.distinctId,
|
|
71
|
+
event: result.event,
|
|
72
|
+
properties: result.properties,
|
|
73
|
+
groups: args.groups,
|
|
74
|
+
sendFeatureFlags: args.sendFeatureFlags,
|
|
75
|
+
timestamp: args.timestamp?.getTime(),
|
|
76
|
+
uuid: args.uuid,
|
|
77
|
+
disableGeoip: args.disableGeoip,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
async identify(ctx, args) {
|
|
81
|
+
const distinctId = await this.resolveDistinctId(ctx, args.distinctId);
|
|
82
|
+
const result = this.runBeforeSend({
|
|
83
|
+
event: '$identify',
|
|
84
|
+
distinctId,
|
|
85
|
+
properties: args.properties,
|
|
86
|
+
});
|
|
87
|
+
if (!result)
|
|
88
|
+
return;
|
|
89
|
+
await ctx.scheduler.runAfter(0, this.component.lib.identify, {
|
|
90
|
+
apiKey: this.apiKey,
|
|
91
|
+
host: this.host,
|
|
92
|
+
distinctId: result.distinctId,
|
|
93
|
+
properties: result.properties,
|
|
94
|
+
disableGeoip: args.disableGeoip,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
async groupIdentify(ctx, args) {
|
|
98
|
+
const result = this.runBeforeSend({
|
|
99
|
+
event: '$groupidentify',
|
|
100
|
+
distinctId: args.distinctId ?? '',
|
|
101
|
+
properties: args.properties,
|
|
102
|
+
});
|
|
103
|
+
if (!result)
|
|
104
|
+
return;
|
|
105
|
+
await ctx.scheduler.runAfter(0, this.component.lib.groupIdentify, {
|
|
106
|
+
apiKey: this.apiKey,
|
|
107
|
+
host: this.host,
|
|
108
|
+
groupType: args.groupType,
|
|
109
|
+
groupKey: args.groupKey,
|
|
110
|
+
properties: result.properties,
|
|
111
|
+
distinctId: args.distinctId,
|
|
112
|
+
disableGeoip: args.disableGeoip,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
async alias(ctx, args) {
|
|
116
|
+
const distinctId = await this.resolveDistinctId(ctx, args.distinctId);
|
|
117
|
+
const result = this.runBeforeSend({
|
|
118
|
+
event: '$create_alias',
|
|
119
|
+
distinctId,
|
|
120
|
+
});
|
|
121
|
+
if (!result)
|
|
122
|
+
return;
|
|
123
|
+
await ctx.scheduler.runAfter(0, this.component.lib.alias, {
|
|
124
|
+
apiKey: this.apiKey,
|
|
125
|
+
host: this.host,
|
|
126
|
+
distinctId: result.distinctId,
|
|
127
|
+
alias: args.alias,
|
|
128
|
+
disableGeoip: args.disableGeoip,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
async captureException(ctx, args) {
|
|
132
|
+
const { message, stack, name } = normalizeError(args.error);
|
|
133
|
+
let distinctId;
|
|
134
|
+
try {
|
|
135
|
+
distinctId = await this.resolveDistinctId(ctx, args.distinctId);
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
// captureException works without a distinctId
|
|
139
|
+
}
|
|
140
|
+
const result = this.runBeforeSend({
|
|
141
|
+
event: '$exception',
|
|
142
|
+
distinctId: distinctId ?? '',
|
|
143
|
+
properties: args.additionalProperties,
|
|
144
|
+
});
|
|
145
|
+
if (!result)
|
|
146
|
+
return;
|
|
147
|
+
await ctx.scheduler.runAfter(0, this.component.lib.captureException, {
|
|
148
|
+
apiKey: this.apiKey,
|
|
149
|
+
host: this.host,
|
|
150
|
+
distinctId: result.distinctId || undefined,
|
|
151
|
+
errorMessage: message,
|
|
152
|
+
errorStack: stack,
|
|
153
|
+
errorName: name,
|
|
154
|
+
additionalProperties: result.properties,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
// --- Feature flag methods (require action context) ---
|
|
158
|
+
async getFeatureFlag(ctx, args) {
|
|
159
|
+
const distinctId = await this.resolveDistinctId(ctx, args.distinctId);
|
|
160
|
+
return await ctx.runAction(this.component.lib.getFeatureFlag, {
|
|
161
|
+
apiKey: this.apiKey,
|
|
162
|
+
host: this.host,
|
|
163
|
+
...args,
|
|
164
|
+
distinctId,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
async isFeatureEnabled(ctx, args) {
|
|
168
|
+
const distinctId = await this.resolveDistinctId(ctx, args.distinctId);
|
|
169
|
+
return await ctx.runAction(this.component.lib.isFeatureEnabled, {
|
|
170
|
+
apiKey: this.apiKey,
|
|
171
|
+
host: this.host,
|
|
172
|
+
...args,
|
|
173
|
+
distinctId,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
async getFeatureFlagPayload(ctx, args) {
|
|
177
|
+
const distinctId = await this.resolveDistinctId(ctx, args.distinctId);
|
|
178
|
+
return await ctx.runAction(this.component.lib.getFeatureFlagPayload, {
|
|
179
|
+
apiKey: this.apiKey,
|
|
180
|
+
host: this.host,
|
|
181
|
+
...args,
|
|
182
|
+
distinctId,
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
async getFeatureFlagResult(ctx, args) {
|
|
186
|
+
const distinctId = await this.resolveDistinctId(ctx, args.distinctId);
|
|
187
|
+
return await ctx.runAction(this.component.lib.getFeatureFlagResult, {
|
|
188
|
+
apiKey: this.apiKey,
|
|
189
|
+
host: this.host,
|
|
190
|
+
...args,
|
|
191
|
+
distinctId,
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
async getAllFlags(ctx, args) {
|
|
195
|
+
const distinctId = await this.resolveDistinctId(ctx, args.distinctId);
|
|
196
|
+
return await ctx.runAction(this.component.lib.getAllFlags, {
|
|
197
|
+
apiKey: this.apiKey,
|
|
198
|
+
host: this.host,
|
|
199
|
+
...args,
|
|
200
|
+
distinctId,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
async getAllFlagsAndPayloads(ctx, args) {
|
|
204
|
+
const distinctId = await this.resolveDistinctId(ctx, args.distinctId);
|
|
205
|
+
return await ctx.runAction(this.component.lib.getAllFlagsAndPayloads, {
|
|
206
|
+
apiKey: this.apiKey,
|
|
207
|
+
host: this.host,
|
|
208
|
+
...args,
|
|
209
|
+
distinctId,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAkCA,MAAM,UAAU,cAAc,CAAC,KAAc;IAK3C,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAA;IACzE,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;IAC3B,CAAC;IACD,IACE,OAAO,KAAK,KAAK,QAAQ;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KAAK,CAAC,sBAAsB,CAC1B,GAAc,EACd,IAOC;QAKD,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,CAAA;QACrE,OAAO,MAAM,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,sBAAsB,EAAE;YACpE,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,GAAG,IAAI;YACP,UAAU;SACX,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
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 { ApiFromModules, FilterApi, FunctionReference } from "convex/server";
|
|
11
|
+
declare const fullApi: ApiFromModules<{
|
|
12
|
+
lib: typeof lib;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* A utility for referencing Convex functions in your app's public API.
|
|
16
|
+
*
|
|
17
|
+
* Usage:
|
|
18
|
+
* ```js
|
|
19
|
+
* const myFunctionReference = api.myModule.myFunction;
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare const api: FilterApi<typeof fullApi, FunctionReference<any, "public">>;
|
|
23
|
+
/**
|
|
24
|
+
* A utility for referencing Convex functions in your app's internal API.
|
|
25
|
+
*
|
|
26
|
+
* Usage:
|
|
27
|
+
* ```js
|
|
28
|
+
* const myFunctionReference = internal.myModule.myFunction;
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare const internal: FilterApi<typeof fullApi, FunctionReference<any, "internal">>;
|
|
32
|
+
export declare const components: {};
|
|
33
|
+
export {};
|
|
34
|
+
//# 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;AAEtC,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;CACjB,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;AASH,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,OAAO,GAER,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,134 @@
|
|
|
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
|
+
alias: FunctionReference<"action", "internal", {
|
|
24
|
+
alias: string;
|
|
25
|
+
apiKey: string;
|
|
26
|
+
disableGeoip?: boolean;
|
|
27
|
+
distinctId: string;
|
|
28
|
+
host: string;
|
|
29
|
+
}, any, Name>;
|
|
30
|
+
capture: FunctionReference<"action", "internal", {
|
|
31
|
+
apiKey: string;
|
|
32
|
+
disableGeoip?: boolean;
|
|
33
|
+
distinctId: string;
|
|
34
|
+
event: string;
|
|
35
|
+
groups?: any;
|
|
36
|
+
host: string;
|
|
37
|
+
properties?: any;
|
|
38
|
+
sendFeatureFlags?: boolean;
|
|
39
|
+
timestamp?: number;
|
|
40
|
+
uuid?: string;
|
|
41
|
+
}, any, Name>;
|
|
42
|
+
captureException: FunctionReference<"action", "internal", {
|
|
43
|
+
additionalProperties?: any;
|
|
44
|
+
apiKey: string;
|
|
45
|
+
distinctId?: string;
|
|
46
|
+
errorMessage: string;
|
|
47
|
+
errorName?: string;
|
|
48
|
+
errorStack?: string;
|
|
49
|
+
host: string;
|
|
50
|
+
}, any, Name>;
|
|
51
|
+
getAllFlags: FunctionReference<"action", "internal", {
|
|
52
|
+
apiKey: string;
|
|
53
|
+
disableGeoip?: boolean;
|
|
54
|
+
distinctId: string;
|
|
55
|
+
flagKeys?: Array<string>;
|
|
56
|
+
groupProperties?: any;
|
|
57
|
+
groups?: any;
|
|
58
|
+
host: string;
|
|
59
|
+
personProperties?: any;
|
|
60
|
+
}, any, Name>;
|
|
61
|
+
getAllFlagsAndPayloads: FunctionReference<"action", "internal", {
|
|
62
|
+
apiKey: string;
|
|
63
|
+
disableGeoip?: boolean;
|
|
64
|
+
distinctId: string;
|
|
65
|
+
flagKeys?: Array<string>;
|
|
66
|
+
groupProperties?: any;
|
|
67
|
+
groups?: any;
|
|
68
|
+
host: string;
|
|
69
|
+
personProperties?: any;
|
|
70
|
+
}, any, Name>;
|
|
71
|
+
getFeatureFlag: FunctionReference<"action", "internal", {
|
|
72
|
+
apiKey: string;
|
|
73
|
+
disableGeoip?: boolean;
|
|
74
|
+
distinctId: string;
|
|
75
|
+
groupProperties?: any;
|
|
76
|
+
groups?: any;
|
|
77
|
+
host: string;
|
|
78
|
+
key: string;
|
|
79
|
+
personProperties?: any;
|
|
80
|
+
sendFeatureFlagEvents?: boolean;
|
|
81
|
+
}, any, Name>;
|
|
82
|
+
getFeatureFlagPayload: FunctionReference<"action", "internal", {
|
|
83
|
+
apiKey: string;
|
|
84
|
+
disableGeoip?: boolean;
|
|
85
|
+
distinctId: string;
|
|
86
|
+
groupProperties?: any;
|
|
87
|
+
groups?: any;
|
|
88
|
+
host: string;
|
|
89
|
+
key: string;
|
|
90
|
+
matchValue?: string | boolean;
|
|
91
|
+
personProperties?: any;
|
|
92
|
+
sendFeatureFlagEvents?: boolean;
|
|
93
|
+
}, any, Name>;
|
|
94
|
+
getFeatureFlagResult: FunctionReference<"action", "internal", {
|
|
95
|
+
apiKey: string;
|
|
96
|
+
disableGeoip?: boolean;
|
|
97
|
+
distinctId: string;
|
|
98
|
+
groupProperties?: any;
|
|
99
|
+
groups?: any;
|
|
100
|
+
host: string;
|
|
101
|
+
key: string;
|
|
102
|
+
personProperties?: any;
|
|
103
|
+
sendFeatureFlagEvents?: boolean;
|
|
104
|
+
}, any, Name>;
|
|
105
|
+
groupIdentify: FunctionReference<"action", "internal", {
|
|
106
|
+
apiKey: string;
|
|
107
|
+
disableGeoip?: boolean;
|
|
108
|
+
distinctId?: string;
|
|
109
|
+
groupKey: string;
|
|
110
|
+
groupType: string;
|
|
111
|
+
host: string;
|
|
112
|
+
properties?: any;
|
|
113
|
+
}, any, Name>;
|
|
114
|
+
identify: FunctionReference<"action", "internal", {
|
|
115
|
+
apiKey: string;
|
|
116
|
+
disableGeoip?: boolean;
|
|
117
|
+
distinctId: string;
|
|
118
|
+
host: string;
|
|
119
|
+
properties?: any;
|
|
120
|
+
}, any, Name>;
|
|
121
|
+
isFeatureEnabled: FunctionReference<"action", "internal", {
|
|
122
|
+
apiKey: string;
|
|
123
|
+
disableGeoip?: boolean;
|
|
124
|
+
distinctId: string;
|
|
125
|
+
groupProperties?: any;
|
|
126
|
+
groups?: any;
|
|
127
|
+
host: string;
|
|
128
|
+
key: string;
|
|
129
|
+
personProperties?: any;
|
|
130
|
+
sendFeatureFlagEvents?: boolean;
|
|
131
|
+
}, any, Name>;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
//# 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,KAAK,EAAE,iBAAiB,CACtB,QAAQ,EACR,UAAU,EACV;YACE,KAAK,EAAE,MAAM,CAAC;YACd,MAAM,EAAE,MAAM,CAAC;YACf,YAAY,CAAC,EAAE,OAAO,CAAC;YACvB,UAAU,EAAE,MAAM,CAAC;YACnB,IAAI,EAAE,MAAM,CAAC;SACd,EACD,GAAG,EACH,IAAI,CACL,CAAC;QACF,OAAO,EAAE,iBAAiB,CACxB,QAAQ,EACR,UAAU,EACV;YACE,MAAM,EAAE,MAAM,CAAC;YACf,YAAY,CAAC,EAAE,OAAO,CAAC;YACvB,UAAU,EAAE,MAAM,CAAC;YACnB,KAAK,EAAE,MAAM,CAAC;YACd,MAAM,CAAC,EAAE,GAAG,CAAC;YACb,IAAI,EAAE,MAAM,CAAC;YACb,UAAU,CAAC,EAAE,GAAG,CAAC;YACjB,gBAAgB,CAAC,EAAE,OAAO,CAAC;YAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,IAAI,CAAC,EAAE,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ACf,YAAY,CAAC,EAAE,OAAO,CAAC;YACvB,UAAU,CAAC,EAAE,MAAM,CAAC;YACpB,QAAQ,EAAE,MAAM,CAAC;YACjB,SAAS,EAAE,MAAM,CAAC;YAClB,IAAI,EAAE,MAAM,CAAC;YACb,UAAU,CAAC,EAAE,GAAG,CAAC;SAClB,EACD,GAAG,EACH,IAAI,CACL,CAAC;QACF,QAAQ,EAAE,iBAAiB,CACzB,QAAQ,EACR,UAAU,EACV;YACE,MAAM,EAAE,MAAM,CAAC;YACf,YAAY,CAAC,EAAE,OAAO,CAAC;YACvB,UAAU,EAAE,MAAM,CAAC;YACnB,IAAI,EAAE,MAAM,CAAC;YACb,UAAU,CAAC,EAAE,GAAG,CAAC;SAClB,EACD,GAAG,EACH,IAAI,CACL,CAAC;QACF,gBAAgB,EAAE,iBAAiB,CACjC,QAAQ,EACR,UAAU,EACV;YACE,MAAM,EAAE,MAAM,CAAC;YACf,YAAY,CAAC,EAAE,OAAO,CAAC;YACvB,UAAU,EAAE,MAAM,CAAC;YACnB,eAAe,CAAC,EAAE,GAAG,CAAC;YACtB,MAAM,CAAC,EAAE,GAAG,CAAC;YACb,IAAI,EAAE,MAAM,CAAC;YACb,GAAG,EAAE,MAAM,CAAC;YACZ,gBAAgB,CAAC,EAAE,GAAG,CAAC;YACvB,qBAAqB,CAAC,EAAE,OAAO,CAAC;SACjC,EACD,GAAG,EACH,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"}
|