create-mf2-app
Version:
The stack AI moves fast with.
1,190 lines (1,184 loc) • 33.7 kB
TypeScript
/* eslint-disable */
/**
* Generated `api` utility.
*
* THIS CODE IS AUTOMATICALLY GENERATED.
*
* To regenerate, run `npx convex dev`.
* @module
*/
import type * as auth_config from "../auth/config.js";
import type * as auth_users from "../auth/users.js";
import type * as crons from "../crons.js";
import type * as email_actions from "../email/actions.js";
import type * as email_events from "../email/events.js";
import type * as email_utils from "../email/utils.js";
import type * as http from "../http.js";
import type * as messages from "../messages.js";
import type * as payments_cleanup from "../payments/cleanup.js";
import type * as payments_polar from "../payments/polar.js";
import type * as waitlist from "../waitlist.js";
import type {
ApiFromModules,
FilterApi,
FunctionReference,
} from "convex/server";
/**
* A utility for referencing Convex functions in your app's API.
*
* Usage:
* ```js
* const myFunctionReference = api.myModule.myFunction;
* ```
*/
declare const fullApi: ApiFromModules<{
"auth/config": typeof auth_config;
"auth/users": typeof auth_users;
crons: typeof crons;
"email/actions": typeof email_actions;
"email/events": typeof email_events;
"email/utils": typeof email_utils;
http: typeof http;
messages: typeof messages;
"payments/cleanup": typeof payments_cleanup;
"payments/polar": typeof payments_polar;
waitlist: typeof waitlist;
}>;
declare const fullApiWithMounts: typeof fullApi;
export declare const api: FilterApi<
typeof fullApiWithMounts,
FunctionReference<any, "public">
>;
export declare const internal: FilterApi<
typeof fullApiWithMounts,
FunctionReference<any, "internal">
>;
export declare const components: {
actionCache: {
crons: {
purge: FunctionReference<
"mutation",
"internal",
{ expiresAt?: number },
null
>;
};
lib: {
get: FunctionReference<
"query",
"internal",
{ args: any; name: string; ttl: number | null },
{ kind: "hit"; value: any } | { expiredEntry?: string; kind: "miss" }
>;
put: FunctionReference<
"mutation",
"internal",
{
args: any;
expiredEntry?: string;
name: string;
ttl: number | null;
value: any;
},
{ cacheHit: boolean; deletedExpiredEntry: boolean }
>;
remove: FunctionReference<
"mutation",
"internal",
{ args: any; name: string },
null
>;
removeAll: FunctionReference<
"mutation",
"internal",
{ batchSize?: number; before?: number; name?: string },
null
>;
};
};
actionRetrier: {
public: {
cancel: FunctionReference<
"mutation",
"internal",
{ runId: string },
boolean
>;
cleanup: FunctionReference<
"mutation",
"internal",
{ runId: string },
any
>;
start: FunctionReference<
"mutation",
"internal",
{
functionArgs: any;
functionHandle: string;
options: {
base: number;
initialBackoffMs: number;
logLevel: "DEBUG" | "INFO" | "WARN" | "ERROR";
maxFailures: number;
onComplete?: string;
runAfter?: number;
runAt?: number;
};
},
string
>;
status: FunctionReference<
"query",
"internal",
{ runId: string },
| { type: "inProgress" }
| {
result:
| { returnValue: any; type: "success" }
| { error: string; type: "failed" }
| { type: "canceled" };
type: "completed";
}
>;
};
};
rateLimiter: {
lib: {
checkRateLimit: FunctionReference<
"query",
"internal",
{
config:
| {
capacity?: number;
kind: "token bucket";
maxReserved?: number;
period: number;
rate: number;
shards?: number;
start?: null;
}
| {
capacity?: number;
kind: "fixed window";
maxReserved?: number;
period: number;
rate: number;
shards?: number;
start?: number;
};
count?: number;
key?: string;
name: string;
reserve?: boolean;
throws?: boolean;
},
{ ok: true; retryAfter?: number } | { ok: false; retryAfter: number }
>;
clearAll: FunctionReference<
"mutation",
"internal",
{ before?: number },
null
>;
getServerTime: FunctionReference<"mutation", "internal", {}, number>;
getValue: FunctionReference<
"query",
"internal",
{
config:
| {
capacity?: number;
kind: "token bucket";
maxReserved?: number;
period: number;
rate: number;
shards?: number;
start?: null;
}
| {
capacity?: number;
kind: "fixed window";
maxReserved?: number;
period: number;
rate: number;
shards?: number;
start?: number;
};
key?: string;
name: string;
sampleShards?: number;
},
{
config:
| {
capacity?: number;
kind: "token bucket";
maxReserved?: number;
period: number;
rate: number;
shards?: number;
start?: null;
}
| {
capacity?: number;
kind: "fixed window";
maxReserved?: number;
period: number;
rate: number;
shards?: number;
start?: number;
};
shard: number;
ts: number;
value: number;
}
>;
rateLimit: FunctionReference<
"mutation",
"internal",
{
config:
| {
capacity?: number;
kind: "token bucket";
maxReserved?: number;
period: number;
rate: number;
shards?: number;
start?: null;
}
| {
capacity?: number;
kind: "fixed window";
maxReserved?: number;
period: number;
rate: number;
shards?: number;
start?: number;
};
count?: number;
key?: string;
name: string;
reserve?: boolean;
throws?: boolean;
},
{ ok: true; retryAfter?: number } | { ok: false; retryAfter: number }
>;
resetRateLimit: FunctionReference<
"mutation",
"internal",
{ key?: string; name: string },
null
>;
};
time: {
getServerTime: FunctionReference<"mutation", "internal", {}, number>;
};
};
migrations: {
lib: {
cancel: FunctionReference<
"mutation",
"internal",
{ name: string },
{
batchSize?: number;
cursor?: string | null;
error?: string;
isDone: boolean;
latestEnd?: number;
latestStart: number;
name: string;
next?: Array<string>;
processed: number;
state: "inProgress" | "success" | "failed" | "canceled" | "unknown";
}
>;
cancelAll: FunctionReference<
"mutation",
"internal",
{ sinceTs?: number },
Array<{
batchSize?: number;
cursor?: string | null;
error?: string;
isDone: boolean;
latestEnd?: number;
latestStart: number;
name: string;
next?: Array<string>;
processed: number;
state: "inProgress" | "success" | "failed" | "canceled" | "unknown";
}>
>;
clearAll: FunctionReference<
"mutation",
"internal",
{ before?: number },
null
>;
getStatus: FunctionReference<
"query",
"internal",
{ limit?: number; names?: Array<string> },
Array<{
batchSize?: number;
cursor?: string | null;
error?: string;
isDone: boolean;
latestEnd?: number;
latestStart: number;
name: string;
next?: Array<string>;
processed: number;
state: "inProgress" | "success" | "failed" | "canceled" | "unknown";
}>
>;
migrate: FunctionReference<
"mutation",
"internal",
{
batchSize?: number;
cursor?: string | null;
dryRun: boolean;
fnHandle: string;
name: string;
next?: Array<{ fnHandle: string; name: string }>;
},
{
batchSize?: number;
cursor?: string | null;
error?: string;
isDone: boolean;
latestEnd?: number;
latestStart: number;
name: string;
next?: Array<string>;
processed: number;
state: "inProgress" | "success" | "failed" | "canceled" | "unknown";
}
>;
};
};
presence: {
public: {
disconnect: FunctionReference<
"mutation",
"internal",
{ sessionToken: string },
null
>;
heartbeat: FunctionReference<
"mutation",
"internal",
{
interval?: number;
roomId: string;
sessionId: string;
userId: string;
},
{ roomToken: string; sessionToken: string }
>;
list: FunctionReference<
"query",
"internal",
{ limit?: number; roomToken: string },
Array<{ lastDisconnected: number; online: boolean; userId: string }>
>;
listRoom: FunctionReference<
"query",
"internal",
{ limit?: number; onlineOnly?: boolean; roomId: string },
Array<{ lastDisconnected: number; online: boolean; userId: string }>
>;
listUser: FunctionReference<
"query",
"internal",
{ limit?: number; onlineOnly?: boolean; userId: string },
Array<{ lastDisconnected: number; online: boolean; roomId: string }>
>;
removeRoom: FunctionReference<
"mutation",
"internal",
{ roomId: string },
null
>;
removeRoomUser: FunctionReference<
"mutation",
"internal",
{ roomId: string; userId: string },
null
>;
};
};
shardedCounter: {
public: {
add: FunctionReference<
"mutation",
"internal",
{ count: number; name: string; shard?: number; shards?: number },
number
>;
count: FunctionReference<"query", "internal", { name: string }, number>;
estimateCount: FunctionReference<
"query",
"internal",
{ name: string; readFromShards?: number; shards?: number },
any
>;
rebalance: FunctionReference<
"mutation",
"internal",
{ name: string; shards?: number },
any
>;
reset: FunctionReference<"mutation", "internal", { name: string }, any>;
};
};
polar: {
lib: {
createProduct: FunctionReference<
"mutation",
"internal",
{
product: {
createdAt: string;
description: string | null;
id: string;
isArchived: boolean;
isRecurring: boolean;
medias: Array<{
checksumEtag: string | null;
checksumSha256Base64: string | null;
checksumSha256Hex: string | null;
createdAt: string;
id: string;
isUploaded: boolean;
lastModifiedAt: string | null;
mimeType: string;
name: string;
organizationId: string;
path: string;
publicUrl: string;
service?: string;
size: number;
sizeReadable: string;
storageVersion: string | null;
version: string | null;
}>;
metadata?: Record<string, any>;
modifiedAt: string | null;
name: string;
organizationId: string;
prices: Array<{
amountType?: string;
createdAt: string;
id: string;
isArchived: boolean;
modifiedAt: string | null;
priceAmount?: number;
priceCurrency?: string;
productId: string;
recurringInterval?: "month" | "year" | null;
type?: string;
}>;
recurringInterval?: "month" | "year" | null;
};
},
any
>;
createSubscription: FunctionReference<
"mutation",
"internal",
{
subscription: {
amount: number | null;
cancelAtPeriodEnd: boolean;
checkoutId: string | null;
createdAt: string;
currency: string | null;
currentPeriodEnd: string | null;
currentPeriodStart: string;
customerCancellationComment?: string | null;
customerCancellationReason?: string | null;
customerId: string;
endedAt: string | null;
id: string;
metadata: Record<string, any>;
modifiedAt: string | null;
priceId?: string;
productId: string;
recurringInterval: "month" | "year" | null;
startedAt: string | null;
status: string;
};
},
any
>;
getCurrentSubscription: FunctionReference<
"query",
"internal",
{ userId: string },
{
amount: number | null;
cancelAtPeriodEnd: boolean;
checkoutId: string | null;
createdAt: string;
currency: string | null;
currentPeriodEnd: string | null;
currentPeriodStart: string;
customerCancellationComment?: string | null;
customerCancellationReason?: string | null;
customerId: string;
endedAt: string | null;
id: string;
metadata: Record<string, any>;
modifiedAt: string | null;
priceId?: string;
product: {
createdAt: string;
description: string | null;
id: string;
isArchived: boolean;
isRecurring: boolean;
medias: Array<{
checksumEtag: string | null;
checksumSha256Base64: string | null;
checksumSha256Hex: string | null;
createdAt: string;
id: string;
isUploaded: boolean;
lastModifiedAt: string | null;
mimeType: string;
name: string;
organizationId: string;
path: string;
publicUrl: string;
service?: string;
size: number;
sizeReadable: string;
storageVersion: string | null;
version: string | null;
}>;
metadata?: Record<string, any>;
modifiedAt: string | null;
name: string;
organizationId: string;
prices: Array<{
amountType?: string;
createdAt: string;
id: string;
isArchived: boolean;
modifiedAt: string | null;
priceAmount?: number;
priceCurrency?: string;
productId: string;
recurringInterval?: "month" | "year" | null;
type?: string;
}>;
recurringInterval?: "month" | "year" | null;
};
productId: string;
recurringInterval: "month" | "year" | null;
startedAt: string | null;
status: string;
} | null
>;
getCustomerByUserId: FunctionReference<
"query",
"internal",
{ userId: string },
{ id: string; metadata?: Record<string, any>; userId: string } | null
>;
getProduct: FunctionReference<
"query",
"internal",
{ id: string },
{
createdAt: string;
description: string | null;
id: string;
isArchived: boolean;
isRecurring: boolean;
medias: Array<{
checksumEtag: string | null;
checksumSha256Base64: string | null;
checksumSha256Hex: string | null;
createdAt: string;
id: string;
isUploaded: boolean;
lastModifiedAt: string | null;
mimeType: string;
name: string;
organizationId: string;
path: string;
publicUrl: string;
service?: string;
size: number;
sizeReadable: string;
storageVersion: string | null;
version: string | null;
}>;
metadata?: Record<string, any>;
modifiedAt: string | null;
name: string;
organizationId: string;
prices: Array<{
amountType?: string;
createdAt: string;
id: string;
isArchived: boolean;
modifiedAt: string | null;
priceAmount?: number;
priceCurrency?: string;
productId: string;
recurringInterval?: "month" | "year" | null;
type?: string;
}>;
recurringInterval?: "month" | "year" | null;
} | null
>;
getSubscription: FunctionReference<
"query",
"internal",
{ id: string },
{
amount: number | null;
cancelAtPeriodEnd: boolean;
checkoutId: string | null;
createdAt: string;
currency: string | null;
currentPeriodEnd: string | null;
currentPeriodStart: string;
customerCancellationComment?: string | null;
customerCancellationReason?: string | null;
customerId: string;
endedAt: string | null;
id: string;
metadata: Record<string, any>;
modifiedAt: string | null;
priceId?: string;
productId: string;
recurringInterval: "month" | "year" | null;
startedAt: string | null;
status: string;
} | null
>;
insertCustomer: FunctionReference<
"mutation",
"internal",
{ id: string; metadata?: Record<string, any>; userId: string },
string
>;
listCustomerSubscriptions: FunctionReference<
"query",
"internal",
{ customerId: string },
Array<{
amount: number | null;
cancelAtPeriodEnd: boolean;
checkoutId: string | null;
createdAt: string;
currency: string | null;
currentPeriodEnd: string | null;
currentPeriodStart: string;
customerCancellationComment?: string | null;
customerCancellationReason?: string | null;
customerId: string;
endedAt: string | null;
id: string;
metadata: Record<string, any>;
modifiedAt: string | null;
priceId?: string;
productId: string;
recurringInterval: "month" | "year" | null;
startedAt: string | null;
status: string;
}>
>;
listProducts: FunctionReference<
"query",
"internal",
{ includeArchived?: boolean },
Array<{
createdAt: string;
description: string | null;
id: string;
isArchived: boolean;
isRecurring: boolean;
medias: Array<{
checksumEtag: string | null;
checksumSha256Base64: string | null;
checksumSha256Hex: string | null;
createdAt: string;
id: string;
isUploaded: boolean;
lastModifiedAt: string | null;
mimeType: string;
name: string;
organizationId: string;
path: string;
publicUrl: string;
service?: string;
size: number;
sizeReadable: string;
storageVersion: string | null;
version: string | null;
}>;
metadata?: Record<string, any>;
modifiedAt: string | null;
name: string;
organizationId: string;
priceAmount?: number;
prices: Array<{
amountType?: string;
createdAt: string;
id: string;
isArchived: boolean;
modifiedAt: string | null;
priceAmount?: number;
priceCurrency?: string;
productId: string;
recurringInterval?: "month" | "year" | null;
type?: string;
}>;
recurringInterval?: "month" | "year" | null;
}>
>;
listUserSubscriptions: FunctionReference<
"query",
"internal",
{ userId: string },
Array<{
amount: number | null;
cancelAtPeriodEnd: boolean;
checkoutId: string | null;
createdAt: string;
currency: string | null;
currentPeriodEnd: string | null;
currentPeriodStart: string;
customerCancellationComment?: string | null;
customerCancellationReason?: string | null;
customerId: string;
endedAt: string | null;
id: string;
metadata: Record<string, any>;
modifiedAt: string | null;
priceId?: string;
product: {
createdAt: string;
description: string | null;
id: string;
isArchived: boolean;
isRecurring: boolean;
medias: Array<{
checksumEtag: string | null;
checksumSha256Base64: string | null;
checksumSha256Hex: string | null;
createdAt: string;
id: string;
isUploaded: boolean;
lastModifiedAt: string | null;
mimeType: string;
name: string;
organizationId: string;
path: string;
publicUrl: string;
service?: string;
size: number;
sizeReadable: string;
storageVersion: string | null;
version: string | null;
}>;
metadata?: Record<string, any>;
modifiedAt: string | null;
name: string;
organizationId: string;
prices: Array<{
amountType?: string;
createdAt: string;
id: string;
isArchived: boolean;
modifiedAt: string | null;
priceAmount?: number;
priceCurrency?: string;
productId: string;
recurringInterval?: "month" | "year" | null;
type?: string;
}>;
recurringInterval?: "month" | "year" | null;
} | null;
productId: string;
recurringInterval: "month" | "year" | null;
startedAt: string | null;
status: string;
}>
>;
syncProducts: FunctionReference<
"action",
"internal",
{ polarAccessToken: string; server: "sandbox" | "production" },
any
>;
updateProduct: FunctionReference<
"mutation",
"internal",
{
product: {
createdAt: string;
description: string | null;
id: string;
isArchived: boolean;
isRecurring: boolean;
medias: Array<{
checksumEtag: string | null;
checksumSha256Base64: string | null;
checksumSha256Hex: string | null;
createdAt: string;
id: string;
isUploaded: boolean;
lastModifiedAt: string | null;
mimeType: string;
name: string;
organizationId: string;
path: string;
publicUrl: string;
service?: string;
size: number;
sizeReadable: string;
storageVersion: string | null;
version: string | null;
}>;
metadata?: Record<string, any>;
modifiedAt: string | null;
name: string;
organizationId: string;
prices: Array<{
amountType?: string;
createdAt: string;
id: string;
isArchived: boolean;
modifiedAt: string | null;
priceAmount?: number;
priceCurrency?: string;
productId: string;
recurringInterval?: "month" | "year" | null;
type?: string;
}>;
recurringInterval?: "month" | "year" | null;
};
},
any
>;
updateProducts: FunctionReference<
"mutation",
"internal",
{
polarAccessToken: string;
products: Array<{
createdAt: string;
description: string | null;
id: string;
isArchived: boolean;
isRecurring: boolean;
medias: Array<{
checksumEtag: string | null;
checksumSha256Base64: string | null;
checksumSha256Hex: string | null;
createdAt: string;
id: string;
isUploaded: boolean;
lastModifiedAt: string | null;
mimeType: string;
name: string;
organizationId: string;
path: string;
publicUrl: string;
service?: string;
size: number;
sizeReadable: string;
storageVersion: string | null;
version: string | null;
}>;
metadata?: Record<string, any>;
modifiedAt: string | null;
name: string;
organizationId: string;
prices: Array<{
amountType?: string;
createdAt: string;
id: string;
isArchived: boolean;
modifiedAt: string | null;
priceAmount?: number;
priceCurrency?: string;
productId: string;
recurringInterval?: "month" | "year" | null;
type?: string;
}>;
recurringInterval?: "month" | "year" | null;
}>;
},
any
>;
updateSubscription: FunctionReference<
"mutation",
"internal",
{
subscription: {
amount: number | null;
cancelAtPeriodEnd: boolean;
checkoutId: string | null;
createdAt: string;
currency: string | null;
currentPeriodEnd: string | null;
currentPeriodStart: string;
customerCancellationComment?: string | null;
customerCancellationReason?: string | null;
customerId: string;
endedAt: string | null;
id: string;
metadata: Record<string, any>;
modifiedAt: string | null;
priceId?: string;
productId: string;
recurringInterval: "month" | "year" | null;
startedAt: string | null;
status: string;
};
},
any
>;
upsertCustomer: FunctionReference<
"mutation",
"internal",
{ id: string; metadata?: Record<string, any>; userId: string },
string
>;
};
};
r2: {
lib: {
deleteMetadata: FunctionReference<
"mutation",
"internal",
{ bucket: string; key: string },
null
>;
deleteObject: FunctionReference<
"mutation",
"internal",
{
accessKeyId: string;
bucket: string;
endpoint: string;
key: string;
secretAccessKey: string;
},
null
>;
deleteR2Object: FunctionReference<
"action",
"internal",
{
accessKeyId: string;
bucket: string;
endpoint: string;
key: string;
secretAccessKey: string;
},
null
>;
getMetadata: FunctionReference<
"query",
"internal",
{
accessKeyId: string;
bucket: string;
endpoint: string;
key: string;
secretAccessKey: string;
},
{
bucket: string;
bucketLink: string;
contentType?: string;
key: string;
lastModified: string;
link: string;
sha256?: string;
size?: number;
url: string;
} | null
>;
listMetadata: FunctionReference<
"query",
"internal",
{
accessKeyId: string;
bucket: string;
cursor?: string;
endpoint: string;
limit?: number;
secretAccessKey: string;
},
{
continueCursor: string;
isDone: boolean;
page: Array<{
bucket: string;
bucketLink: string;
contentType?: string;
key: string;
lastModified: string;
link: string;
sha256?: string;
size?: number;
url: string;
}>;
pageStatus?: null | "SplitRecommended" | "SplitRequired";
splitCursor?: null | string;
}
>;
store: FunctionReference<
"action",
"internal",
{
accessKeyId: string;
bucket: string;
endpoint: string;
secretAccessKey: string;
url: string;
},
any
>;
syncMetadata: FunctionReference<
"action",
"internal",
{
accessKeyId: string;
bucket: string;
endpoint: string;
key: string;
onComplete?: string;
secretAccessKey: string;
},
null
>;
upsertMetadata: FunctionReference<
"mutation",
"internal",
{
bucket: string;
contentType?: string;
key: string;
lastModified: string;
link: string;
sha256?: string;
size?: number;
},
{ isNew: boolean }
>;
};
};
resend: {
lib: {
cancelEmail: FunctionReference<
"mutation",
"internal",
{ emailId: string },
null
>;
cleanupAbandonedEmails: FunctionReference<
"mutation",
"internal",
{ olderThan?: number },
null
>;
cleanupOldEmails: FunctionReference<
"mutation",
"internal",
{ olderThan?: number },
null
>;
get: FunctionReference<
"query",
"internal",
{ emailId: string },
{
complained: boolean;
createdAt: number;
errorMessage?: string;
finalizedAt: number;
from: string;
headers?: Array<{ name: string; value: string }>;
html?: string;
opened: boolean;
replyTo: Array<string>;
resendId?: string;
segment: number;
status:
| "waiting"
| "queued"
| "cancelled"
| "sent"
| "delivered"
| "delivery_delayed"
| "bounced"
| "failed";
subject: string;
text?: string;
to: string;
} | null
>;
getStatus: FunctionReference<
"query",
"internal",
{ emailId: string },
{
complained: boolean;
errorMessage: string | null;
opened: boolean;
status:
| "waiting"
| "queued"
| "cancelled"
| "sent"
| "delivered"
| "delivery_delayed"
| "bounced"
| "failed";
} | null
>;
handleEmailEvent: FunctionReference<
"mutation",
"internal",
{ event: any },
null
>;
sendEmail: FunctionReference<
"mutation",
"internal",
{
from: string;
headers?: Array<{ name: string; value: string }>;
html?: string;
options: {
apiKey: string;
initialBackoffMs: number;
onEmailEvent?: { fnHandle: string };
retryAttempts: number;
testMode: boolean;
};
replyTo?: Array<string>;
subject: string;
text?: string;
to: string;
},
string
>;
};
};
};