cosveti-sync 0.0.1

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.
@@ -0,0 +1,238 @@
1
+ import { mutationGeneric, queryGeneric } from 'convex/server';
2
+ import { v } from 'convex/values';
3
+ import { vClientId } from '../component/schema.js';
4
+ import { Schema, Node } from '@tiptap/pm/model';
5
+ import { Step, Transform } from '@tiptap/pm/transform';
6
+ export class TiptapSyncSvelte {
7
+ component;
8
+ /**
9
+ * Backend API for the ProsemirrorSync component.
10
+ * Responsible for exposing the `sync` API to the client, and having
11
+ * convenience methods for interacting with the component from the backend.
12
+ *
13
+ * Typically used like:
14
+ *
15
+ * ```ts
16
+ * const prosemirrorSync = new ProsemirrorSync(components.prosemirrorSync);
17
+ * export const {
18
+ * ... // see {@link syncApi} docstring for details
19
+ * } = prosemirrorSync.syncApi({...});
20
+ * ```
21
+ *
22
+ * @param component - Generally `components.prosemirrorSync` from
23
+ * `./_generated/api` once you've configured it in `convex.config.ts`.
24
+ */
25
+ constructor(component) {
26
+ this.component = component;
27
+ }
28
+ /**
29
+ * Create a new document with the given ID and content.
30
+ *
31
+ * @param ctx - A Convex mutation context.
32
+ * @param id - The document ID.
33
+ * @param content - The document content. Should be ProseMirror JSON.
34
+ * @returns A promise that resolves when the document is created.
35
+ */
36
+ create(ctx, id, content) {
37
+ return ctx.runMutation(this.component.lib.submitSnapshot, {
38
+ id,
39
+ version: 1,
40
+ content: JSON.stringify(content)
41
+ });
42
+ }
43
+ /**
44
+ * Get the latest document version and content.
45
+ *
46
+ * @param ctx - A Convex mutation context.
47
+ * @param id - The document ID.
48
+ * @param schema - Your ProseMirror schema.
49
+ * For Tiptap, use `getSchema(extensions)`.
50
+ * For BlockNote, use `editor.pmSchema`.
51
+ * @returns The latest ProseMirror doc (Node) and version.
52
+ */
53
+ async getDoc(ctx, id, schema) {
54
+ const { transform, version } = await getLatestVersion(ctx, this.component, id, schema);
55
+ return {
56
+ version,
57
+ doc: transform.doc
58
+ };
59
+ }
60
+ /**
61
+ * Transform the document by applying the given function to the document.
62
+ *
63
+ * This will keep applying the function until the document is synced,
64
+ * so ensure that the function is idempotent (can be applied multiple times).
65
+ *
66
+ * e.g.
67
+ * ```ts
68
+ * import { getSchema } from "@tiptap/core";
69
+ * import { Transform } from "@tiptap/pm/transform";
70
+ *
71
+ * const schema = getSchema(extensions);
72
+ * await prosemirrorSync.transform(ctx, id, schema, (doc) => {
73
+ * const tr = new Transform(doc);
74
+ * tr.insert(0, schema.text("Hello world"));
75
+ * return tr;
76
+ * });
77
+ * ```
78
+ *
79
+ * @param ctx - A Convex mutation context.
80
+ * @param id - The document ID.
81
+ * @param schema - The document schema.
82
+ * @param fn - A function that takes the document and returns a Transform
83
+ * or null if no changes are needed.
84
+ * @returns A promise that resolves with the transformed document.
85
+ */
86
+ async transform(ctx, id, schema, fn, opts) {
87
+ const { transform: serverVersion, version: initialVersion } = await getLatestVersion(ctx, this.component, id, schema);
88
+ let version = initialVersion;
89
+ while (true) {
90
+ const tr = await fn(serverVersion.doc, version);
91
+ if (tr === null)
92
+ return serverVersion.doc;
93
+ const result = await ctx.runMutation(this.component.lib.submitSteps, {
94
+ id,
95
+ version,
96
+ clientId: opts?.clientId ?? 'transform',
97
+ steps: tr.steps.map((step) => JSON.stringify(step.toJSON()))
98
+ });
99
+ if (result.status === 'synced') {
100
+ await ctx.runMutation(this.component.lib.submitSnapshot, {
101
+ id,
102
+ version: version + tr.steps.length,
103
+ content: JSON.stringify(tr.doc.toJSON())
104
+ });
105
+ return tr.doc;
106
+ }
107
+ for (const step of result.steps) {
108
+ serverVersion.step(Step.fromJSON(schema, JSON.parse(step)));
109
+ }
110
+ version += result.steps.length;
111
+ }
112
+ }
113
+ /**
114
+ * Expose the sync API to the client for use with the `useTiptapSync` hook.
115
+ * If you export these in `convex/prosemirror.ts`, pass `api.prosemirror`
116
+ * to the `useTiptapSync` hook.
117
+ *
118
+ * It allows you to define optional read and write permissions, along with
119
+ * a callback when new snapshots are available.
120
+ *
121
+ * You can pass the optional type argument `<DataModel>` to have the `ctx`
122
+ * parameter specific to your tables.
123
+ *
124
+ * ```ts
125
+ * import { DataModel } from "./convex/_generated/dataModel";
126
+ * // ...
127
+ * export const { ... } = prosemirrorSync.syncApi<DataModel>({...});
128
+ * ```
129
+ *
130
+ * To define just one function to use for both, you can define it like this:
131
+ * ```ts
132
+ * async function checkPermissions(ctx: QueryCtx, id: string) {
133
+ * const user = await getAuthUser(ctx);
134
+ * if (!user || !(await canUserAccessDocument(user, id))) {
135
+ * throw new Error("Unauthorized");
136
+ * }
137
+ * }
138
+ * ```
139
+ * @param opts - Optional callbacks.
140
+ * @returns functions to export, so the `useTiptapSync` hook can use them.
141
+ */
142
+ syncApi(opts) {
143
+ const id = v.string();
144
+ return {
145
+ getSnapshot: queryGeneric({
146
+ args: {
147
+ id,
148
+ version: v.optional(v.number())
149
+ },
150
+ returns: v.union(v.object({
151
+ content: v.null(),
152
+ version: v.null()
153
+ }), v.object({
154
+ content: v.string(),
155
+ version: v.number()
156
+ })),
157
+ handler: async (ctx, args) => {
158
+ if (opts?.checkRead) {
159
+ await opts.checkRead(ctx, args.id);
160
+ }
161
+ return ctx.runQuery(this.component.lib.getSnapshot, args);
162
+ }
163
+ }),
164
+ submitSnapshot: mutationGeneric({
165
+ args: {
166
+ id,
167
+ version: v.number(),
168
+ content: v.string()
169
+ },
170
+ returns: v.null(),
171
+ handler: async (ctx, args) => {
172
+ if (opts?.checkWrite) {
173
+ await opts.checkWrite(ctx, args.id);
174
+ }
175
+ if (opts?.onSnapshot) {
176
+ await opts.onSnapshot(ctx, args.id, args.content, args.version);
177
+ }
178
+ await ctx.runMutation(this.component.lib.submitSnapshot, {
179
+ ...args,
180
+ pruneSnapshots: opts?.pruneSnapshots
181
+ });
182
+ }
183
+ }),
184
+ latestVersion: queryGeneric({
185
+ args: { id },
186
+ returns: v.union(v.null(), v.number()),
187
+ handler: async (ctx, args) => {
188
+ if (opts?.checkRead) {
189
+ await opts.checkRead(ctx, args.id);
190
+ }
191
+ return ctx.runQuery(this.component.lib.latestVersion, args);
192
+ }
193
+ }),
194
+ getSteps: queryGeneric({
195
+ args: {
196
+ id,
197
+ version: v.number()
198
+ },
199
+ handler: async (ctx, args) => {
200
+ if (opts?.checkRead) {
201
+ await opts.checkRead(ctx, args.id);
202
+ }
203
+ return ctx.runQuery(this.component.lib.getSteps, args);
204
+ }
205
+ }),
206
+ submitSteps: mutationGeneric({
207
+ args: {
208
+ id,
209
+ version: v.number(),
210
+ clientId: vClientId,
211
+ steps: v.array(v.string())
212
+ },
213
+ handler: async (ctx, args) => {
214
+ if (opts?.checkWrite) {
215
+ await opts.checkWrite(ctx, args.id);
216
+ }
217
+ return ctx.runMutation(this.component.lib.submitSteps, args);
218
+ }
219
+ })
220
+ };
221
+ }
222
+ }
223
+ async function getLatestVersion(ctx, component, id, schema) {
224
+ const snapshot = await ctx.runQuery(component.lib.getSnapshot, { id });
225
+ if (!snapshot.content) {
226
+ throw new Error('Document not found');
227
+ }
228
+ const content = JSON.parse(snapshot.content);
229
+ const transform = new Transform(schema.nodeFromJSON(content));
230
+ const { steps, version } = await ctx.runQuery(component.lib.getSteps, {
231
+ id,
232
+ version: snapshot.version
233
+ });
234
+ for (const step of steps) {
235
+ transform.step(Step.fromJSON(schema, JSON.parse(step)));
236
+ }
237
+ return { transform, version };
238
+ }
@@ -0,0 +1,33 @@
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 {};
@@ -0,0 +1,30 @@
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();
@@ -0,0 +1,77 @@
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
+ deleteDocument: FunctionReference<"mutation", "internal", {
24
+ id: string;
25
+ }, null, Name>;
26
+ deleteSnapshots: FunctionReference<"mutation", "internal", {
27
+ afterVersion?: number;
28
+ beforeVersion?: number;
29
+ id: string;
30
+ }, null, Name>;
31
+ deleteSteps: FunctionReference<"mutation", "internal", {
32
+ afterVersion?: number;
33
+ beforeTs: number;
34
+ deleteNewerThanLatestSnapshot?: boolean;
35
+ id: string;
36
+ }, null, Name>;
37
+ getSnapshot: FunctionReference<"query", "internal", {
38
+ id: string;
39
+ version?: number;
40
+ }, {
41
+ content: null;
42
+ version: null;
43
+ } | {
44
+ content: string;
45
+ version: number;
46
+ }, Name>;
47
+ getSteps: FunctionReference<"query", "internal", {
48
+ id: string;
49
+ version: number;
50
+ }, {
51
+ clientIds: Array<string | number>;
52
+ steps: Array<string>;
53
+ version: number;
54
+ }, Name>;
55
+ latestVersion: FunctionReference<"query", "internal", {
56
+ id: string;
57
+ }, null | number, Name>;
58
+ submitSnapshot: FunctionReference<"mutation", "internal", {
59
+ content: string;
60
+ id: string;
61
+ pruneSnapshots?: boolean;
62
+ version: number;
63
+ }, null, Name>;
64
+ submitSteps: FunctionReference<"mutation", "internal", {
65
+ clientId: string | number;
66
+ id: string;
67
+ steps: Array<string>;
68
+ version: number;
69
+ }, {
70
+ clientIds: Array<string | number>;
71
+ status: "needs-rebase";
72
+ steps: Array<string>;
73
+ } | {
74
+ status: "synced";
75
+ }, Name>;
76
+ };
77
+ };
@@ -0,0 +1,10 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated `ComponentApi` utility.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+ export {};
@@ -0,0 +1,45 @@
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>;
@@ -0,0 +1,10 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated data model types.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+ import schema from "../schema.js";
@@ -0,0 +1,120 @@
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>;
@@ -0,0 +1,77 @@
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;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("convex/server").ComponentDefinition<any>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import { defineComponent } from 'convex/server';
2
+ export default defineComponent('tiptapSyncSvelte');