@trestleinc/replicate 1.1.0 → 1.1.2-preview.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.
Files changed (91) hide show
  1. package/README.md +446 -260
  2. package/dist/client/index.d.ts +311 -19
  3. package/dist/client/index.js +4027 -0
  4. package/dist/component/_generated/api.d.ts +13 -17
  5. package/dist/component/_generated/api.js +24 -4
  6. package/dist/component/_generated/component.d.ts +79 -77
  7. package/dist/component/_generated/component.js +1 -0
  8. package/dist/component/_generated/dataModel.d.ts +12 -15
  9. package/dist/component/_generated/dataModel.js +1 -0
  10. package/dist/component/_generated/server.d.ts +19 -22
  11. package/dist/component/_generated/server.js +65 -1
  12. package/dist/component/_virtual/rolldown_runtime.js +18 -0
  13. package/dist/component/convex.config.d.ts +6 -2
  14. package/dist/component/convex.config.js +7 -3
  15. package/dist/component/logger.d.ts +10 -6
  16. package/dist/component/logger.js +25 -28
  17. package/dist/component/public.d.ts +70 -61
  18. package/dist/component/public.js +311 -295
  19. package/dist/component/schema.d.ts +53 -45
  20. package/dist/component/schema.js +26 -32
  21. package/dist/component/shared/types.d.ts +9 -0
  22. package/dist/component/shared/types.js +15 -0
  23. package/dist/server/index.d.ts +134 -13
  24. package/dist/server/index.js +368 -0
  25. package/dist/shared/index.d.ts +27 -3
  26. package/dist/shared/index.js +1 -2
  27. package/package.json +34 -29
  28. package/src/client/collection.ts +339 -306
  29. package/src/client/errors.ts +9 -9
  30. package/src/client/index.ts +13 -32
  31. package/src/client/logger.ts +2 -2
  32. package/src/client/merge.ts +37 -34
  33. package/src/client/persistence/custom.ts +84 -0
  34. package/src/client/persistence/index.ts +9 -46
  35. package/src/client/persistence/indexeddb.ts +111 -84
  36. package/src/client/persistence/memory.ts +3 -3
  37. package/src/client/persistence/sqlite/browser.ts +168 -0
  38. package/src/client/persistence/sqlite/native.ts +29 -0
  39. package/src/client/persistence/sqlite/schema.ts +124 -0
  40. package/src/client/persistence/types.ts +32 -28
  41. package/src/client/prose-schema.ts +55 -0
  42. package/src/client/prose.ts +28 -25
  43. package/src/client/replicate.ts +5 -5
  44. package/src/client/services/cursor.ts +109 -0
  45. package/src/component/_generated/component.ts +31 -29
  46. package/src/component/convex.config.ts +2 -2
  47. package/src/component/logger.ts +7 -7
  48. package/src/component/public.ts +225 -237
  49. package/src/component/schema.ts +18 -15
  50. package/src/server/builder.ts +20 -7
  51. package/src/server/index.ts +3 -5
  52. package/src/server/schema.ts +5 -5
  53. package/src/server/storage.ts +113 -59
  54. package/src/shared/index.ts +5 -5
  55. package/src/shared/types.ts +51 -14
  56. package/dist/client/collection.d.ts +0 -96
  57. package/dist/client/errors.d.ts +0 -59
  58. package/dist/client/logger.d.ts +0 -2
  59. package/dist/client/merge.d.ts +0 -77
  60. package/dist/client/persistence/adapters/index.d.ts +0 -8
  61. package/dist/client/persistence/adapters/opsqlite.d.ts +0 -46
  62. package/dist/client/persistence/adapters/sqljs.d.ts +0 -83
  63. package/dist/client/persistence/index.d.ts +0 -49
  64. package/dist/client/persistence/indexeddb.d.ts +0 -17
  65. package/dist/client/persistence/memory.d.ts +0 -16
  66. package/dist/client/persistence/sqlite-browser.d.ts +0 -51
  67. package/dist/client/persistence/sqlite-level.d.ts +0 -63
  68. package/dist/client/persistence/sqlite-rn.d.ts +0 -36
  69. package/dist/client/persistence/sqlite.d.ts +0 -47
  70. package/dist/client/persistence/types.d.ts +0 -42
  71. package/dist/client/prose.d.ts +0 -56
  72. package/dist/client/replicate.d.ts +0 -40
  73. package/dist/client/services/checkpoint.d.ts +0 -18
  74. package/dist/client/services/reconciliation.d.ts +0 -24
  75. package/dist/index.js +0 -1620
  76. package/dist/server/builder.d.ts +0 -94
  77. package/dist/server/schema.d.ts +0 -27
  78. package/dist/server/storage.d.ts +0 -80
  79. package/dist/server.js +0 -281
  80. package/dist/shared/types.d.ts +0 -50
  81. package/dist/shared/types.js +0 -6
  82. package/dist/shared.js +0 -6
  83. package/src/client/persistence/adapters/index.ts +0 -8
  84. package/src/client/persistence/adapters/opsqlite.ts +0 -54
  85. package/src/client/persistence/adapters/sqljs.ts +0 -128
  86. package/src/client/persistence/sqlite-browser.ts +0 -107
  87. package/src/client/persistence/sqlite-level.ts +0 -407
  88. package/src/client/persistence/sqlite-rn.ts +0 -44
  89. package/src/client/persistence/sqlite.ts +0 -161
  90. package/src/client/services/checkpoint.ts +0 -86
  91. package/src/client/services/reconciliation.ts +0 -108
@@ -1,17 +1,12 @@
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 logger from "../logger.js";
10
- import type * as public_ from "../public.js";
11
- import type { ApiFromModules, FilterApi, FunctionReference } from "convex/server";
1
+ import { logger_d_exports } from "../logger.js";
2
+ import { public_d_exports } from "../public.js";
3
+ import { ApiFromModules, FilterApi, FunctionReference } from "convex/server";
4
+
5
+ //#region src/component/_generated/api.d.ts
6
+
12
7
  declare const fullApi: ApiFromModules<{
13
- logger: typeof logger;
14
- public: typeof public_;
8
+ logger: typeof logger_d_exports;
9
+ public: typeof public_d_exports;
15
10
  }>;
16
11
  /**
17
12
  * A utility for referencing Convex functions in your app's public API.
@@ -21,7 +16,7 @@ declare const fullApi: ApiFromModules<{
21
16
  * const myFunctionReference = api.myModule.myFunction;
22
17
  * ```
23
18
  */
24
- export declare const api: FilterApi<typeof fullApi, FunctionReference<any, "public">>;
19
+ declare const api: FilterApi<typeof fullApi, FunctionReference<any, "public">>;
25
20
  /**
26
21
  * A utility for referencing Convex functions in your app's internal API.
27
22
  *
@@ -30,6 +25,7 @@ export declare const api: FilterApi<typeof fullApi, FunctionReference<any, "publ
30
25
  * const myFunctionReference = internal.myModule.myFunction;
31
26
  * ```
32
27
  */
33
- export declare const internal: FilterApi<typeof fullApi, FunctionReference<any, "internal">>;
34
- export declare const components: {};
35
- export {};
28
+ declare const internal: FilterApi<typeof fullApi, FunctionReference<any, "internal">>;
29
+ declare const components: {};
30
+ //#endregion
31
+ export { api, components, internal };
@@ -1,5 +1,25 @@
1
- import { anyApi as server_anyApi, componentsGeneric } from "convex/server";
2
- const api = server_anyApi;
3
- const internal = server_anyApi;
1
+ import { anyApi, componentsGeneric } from "convex/server";
2
+
3
+ //#region src/component/_generated/api.ts
4
+ /**
5
+ * A utility for referencing Convex functions in your app's public API.
6
+ *
7
+ * Usage:
8
+ * ```js
9
+ * const myFunctionReference = api.myModule.myFunction;
10
+ * ```
11
+ */
12
+ const api = anyApi;
13
+ /**
14
+ * A utility for referencing Convex functions in your app's internal API.
15
+ *
16
+ * Usage:
17
+ * ```js
18
+ * const myFunctionReference = internal.myModule.myFunction;
19
+ * ```
20
+ */
21
+ const internal = anyApi;
4
22
  const components = componentsGeneric();
5
- export { api, components, internal };
23
+
24
+ //#endregion
25
+ export { api, components, internal };
@@ -1,12 +1,7 @@
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";
1
+ import { FunctionReference } from "convex/server";
2
+
3
+ //#region src/component/_generated/component.d.ts
4
+
10
5
  /**
11
6
  * A utility for referencing a Convex component's exposed API.
12
7
  *
@@ -18,72 +13,79 @@ import type { FunctionReference } from "convex/server";
18
13
  * }
19
14
  * ```
20
15
  */
21
- export type ComponentApi<Name extends string | undefined = string | undefined> = {
22
- public: {
23
- deleteDocument: FunctionReference<"mutation", "internal", {
24
- collection: string;
25
- crdtBytes: ArrayBuffer;
26
- documentId: string;
27
- threshold?: number;
28
- version: number;
29
- }, {
30
- compacted?: boolean;
31
- success: boolean;
32
- }, Name>;
33
- getInitialState: FunctionReference<"query", "internal", {
34
- collection: string;
35
- }, {
36
- checkpoint: {
37
- lastModified: number;
38
- };
39
- crdtBytes: ArrayBuffer;
40
- } | null, Name>;
41
- insertDocument: FunctionReference<"mutation", "internal", {
42
- collection: string;
43
- crdtBytes: ArrayBuffer;
44
- documentId: string;
45
- threshold?: number;
46
- version: number;
47
- }, {
48
- compacted?: boolean;
49
- success: boolean;
50
- }, Name>;
51
- recovery: FunctionReference<"query", "internal", {
52
- clientStateVector: ArrayBuffer;
53
- collection: string;
54
- }, {
55
- diff?: ArrayBuffer;
56
- serverStateVector: ArrayBuffer;
57
- }, Name>;
58
- stream: FunctionReference<"query", "internal", {
59
- checkpoint: {
60
- lastModified: number;
61
- };
62
- collection: string;
63
- limit?: number;
64
- vector?: ArrayBuffer;
65
- }, {
66
- changes: Array<{
67
- crdtBytes: ArrayBuffer;
68
- documentId?: string;
69
- operationType: string;
70
- timestamp: number;
71
- version: number;
72
- }>;
73
- checkpoint: {
74
- lastModified: number;
75
- };
76
- hasMore: boolean;
77
- }, Name>;
78
- updateDocument: FunctionReference<"mutation", "internal", {
79
- collection: string;
80
- crdtBytes: ArrayBuffer;
81
- documentId: string;
82
- threshold?: number;
83
- version: number;
84
- }, {
85
- compacted?: boolean;
86
- success: boolean;
87
- }, Name>;
88
- };
16
+ type ComponentApi<Name extends string | undefined = string | undefined> = {
17
+ public: {
18
+ compact: FunctionReference<"mutation", "internal", {
19
+ collection: string;
20
+ documentId: string;
21
+ peerTimeout?: number;
22
+ snapshotBytes: ArrayBuffer;
23
+ stateVector: ArrayBuffer;
24
+ }, {
25
+ removed: number;
26
+ retained: number;
27
+ success: boolean;
28
+ }, Name>;
29
+ deleteDocument: FunctionReference<"mutation", "internal", {
30
+ collection: string;
31
+ crdtBytes: ArrayBuffer;
32
+ documentId: string;
33
+ }, {
34
+ seq: number;
35
+ success: boolean;
36
+ }, Name>;
37
+ getInitialState: FunctionReference<"query", "internal", {
38
+ collection: string;
39
+ }, {
40
+ crdtBytes: ArrayBuffer;
41
+ cursor: number;
42
+ } | null, Name>;
43
+ insertDocument: FunctionReference<"mutation", "internal", {
44
+ collection: string;
45
+ crdtBytes: ArrayBuffer;
46
+ documentId: string;
47
+ }, {
48
+ seq: number;
49
+ success: boolean;
50
+ }, Name>;
51
+ mark: FunctionReference<"mutation", "internal", {
52
+ collection: string;
53
+ peerId: string;
54
+ syncedSeq: number;
55
+ }, null, Name>;
56
+ recovery: FunctionReference<"query", "internal", {
57
+ clientStateVector: ArrayBuffer;
58
+ collection: string;
59
+ }, {
60
+ cursor: number;
61
+ diff?: ArrayBuffer;
62
+ serverStateVector: ArrayBuffer;
63
+ }, Name>;
64
+ stream: FunctionReference<"query", "internal", {
65
+ collection: string;
66
+ cursor: number;
67
+ limit?: number;
68
+ sizeThreshold?: number;
69
+ }, {
70
+ changes: Array<{
71
+ crdtBytes: ArrayBuffer;
72
+ documentId: string;
73
+ operationType: string;
74
+ seq: number;
75
+ }>;
76
+ compact?: string;
77
+ cursor: number;
78
+ hasMore: boolean;
79
+ }, Name>;
80
+ updateDocument: FunctionReference<"mutation", "internal", {
81
+ collection: string;
82
+ crdtBytes: ArrayBuffer;
83
+ documentId: string;
84
+ }, {
85
+ seq: number;
86
+ success: boolean;
87
+ }, Name>;
88
+ };
89
89
  };
90
+ //#endregion
91
+ export { ComponentApi };
@@ -0,0 +1 @@
1
+ export { };
@@ -1,24 +1,19 @@
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";
1
+ import _default from "../schema.js";
2
+ import { DataModelFromSchemaDefinition, DocumentByName, SystemTableNames, TableNamesInDataModel } from "convex/server";
3
+ import { GenericId } from "convex/values";
4
+
5
+ //#region src/component/_generated/dataModel.d.ts
6
+
12
7
  /**
13
8
  * The names of all of your Convex tables.
14
9
  */
15
- export type TableNames = TableNamesInDataModel<DataModel>;
10
+ type TableNames = TableNamesInDataModel<DataModel>;
16
11
  /**
17
12
  * The type of a document stored in Convex.
18
13
  *
19
14
  * @typeParam TableName - A string literal type of the table name (like "users").
20
15
  */
21
- export type Doc<TableName extends TableNames> = DocumentByName<DataModel, TableName>;
16
+ type Doc<TableName extends TableNames> = DocumentByName<DataModel, TableName>;
22
17
  /**
23
18
  * An identifier for a document in Convex.
24
19
  *
@@ -32,7 +27,7 @@ export type Doc<TableName extends TableNames> = DocumentByName<DataModel, TableN
32
27
  *
33
28
  * @typeParam TableName - A string literal type of the table name (like "users").
34
29
  */
35
- export type Id<TableName extends TableNames | SystemTableNames> = GenericId<TableName>;
30
+ type Id<TableName extends TableNames | SystemTableNames> = GenericId<TableName>;
36
31
  /**
37
32
  * A type describing your Convex data model.
38
33
  *
@@ -42,4 +37,6 @@ export type Id<TableName extends TableNames | SystemTableNames> = GenericId<Tabl
42
37
  * This type is used to parameterize methods like `queryGeneric` and
43
38
  * `mutationGeneric` to make them type-safe.
44
39
  */
45
- export type DataModel = DataModelFromSchemaDefinition<typeof schema>;
40
+ type DataModel = DataModelFromSchemaDefinition<typeof _default>;
41
+ //#endregion
42
+ export { DataModel, Doc, Id, TableNames };
@@ -0,0 +1 @@
1
+ export { };
@@ -1,13 +1,8 @@
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";
1
+ import { DataModel } from "./dataModel.js";
2
+ import { ActionBuilder, GenericActionCtx, GenericDatabaseReader, GenericDatabaseWriter, GenericMutationCtx, GenericQueryCtx, HttpActionBuilder, MutationBuilder, QueryBuilder } from "convex/server";
3
+
4
+ //#region src/component/_generated/server.d.ts
5
+
11
6
  /**
12
7
  * Define a query in this Convex app's public API.
13
8
  *
@@ -16,7 +11,7 @@ import type { DataModel } from "./dataModel.js";
16
11
  * @param func - The query function. It receives a {@link QueryCtx} as its first argument.
17
12
  * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
18
13
  */
19
- export declare const query: QueryBuilder<DataModel, "public">;
14
+ declare const query: QueryBuilder<DataModel, "public">;
20
15
  /**
21
16
  * Define a query that is only accessible from other Convex functions (but not from the client).
22
17
  *
@@ -25,7 +20,7 @@ export declare const query: QueryBuilder<DataModel, "public">;
25
20
  * @param func - The query function. It receives a {@link QueryCtx} as its first argument.
26
21
  * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
27
22
  */
28
- export declare const internalQuery: QueryBuilder<DataModel, "internal">;
23
+ declare const internalQuery: QueryBuilder<DataModel, "internal">;
29
24
  /**
30
25
  * Define a mutation in this Convex app's public API.
31
26
  *
@@ -34,7 +29,7 @@ export declare const internalQuery: QueryBuilder<DataModel, "internal">;
34
29
  * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
35
30
  * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
36
31
  */
37
- export declare const mutation: MutationBuilder<DataModel, "public">;
32
+ declare const mutation: MutationBuilder<DataModel, "public">;
38
33
  /**
39
34
  * Define a mutation that is only accessible from other Convex functions (but not from the client).
40
35
  *
@@ -43,7 +38,7 @@ export declare const mutation: MutationBuilder<DataModel, "public">;
43
38
  * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
44
39
  * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
45
40
  */
46
- export declare const internalMutation: MutationBuilder<DataModel, "internal">;
41
+ declare const internalMutation: MutationBuilder<DataModel, "internal">;
47
42
  /**
48
43
  * Define an action in this Convex app's public API.
49
44
  *
@@ -55,14 +50,14 @@ export declare const internalMutation: MutationBuilder<DataModel, "internal">;
55
50
  * @param func - The action. It receives an {@link ActionCtx} as its first argument.
56
51
  * @returns The wrapped action. Include this as an `export` to name it and make it accessible.
57
52
  */
58
- export declare const action: ActionBuilder<DataModel, "public">;
53
+ declare const action: ActionBuilder<DataModel, "public">;
59
54
  /**
60
55
  * Define an action that is only accessible from other Convex functions (but not from the client).
61
56
  *
62
57
  * @param func - The function. It receives an {@link ActionCtx} as its first argument.
63
58
  * @returns The wrapped function. Include this as an `export` to name it and make it accessible.
64
59
  */
65
- export declare const internalAction: ActionBuilder<DataModel, "internal">;
60
+ declare const internalAction: ActionBuilder<DataModel, "internal">;
66
61
  /**
67
62
  * Define an HTTP action.
68
63
  *
@@ -74,7 +69,7 @@ export declare const internalAction: ActionBuilder<DataModel, "internal">;
74
69
  * and a Fetch API `Request` object as its second.
75
70
  * @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
76
71
  */
77
- export declare const httpAction: HttpActionBuilder;
72
+ declare const httpAction: HttpActionBuilder;
78
73
  /**
79
74
  * A set of services for use within Convex query functions.
80
75
  *
@@ -83,7 +78,7 @@ export declare const httpAction: HttpActionBuilder;
83
78
  *
84
79
  * If you're using code generation, use the `QueryCtx` type in `convex/_generated/server.d.ts` instead.
85
80
  */
86
- export type QueryCtx = GenericQueryCtx<DataModel>;
81
+ type QueryCtx = GenericQueryCtx<DataModel>;
87
82
  /**
88
83
  * A set of services for use within Convex mutation functions.
89
84
  *
@@ -92,14 +87,14 @@ export type QueryCtx = GenericQueryCtx<DataModel>;
92
87
  *
93
88
  * If you're using code generation, use the `MutationCtx` type in `convex/_generated/server.d.ts` instead.
94
89
  */
95
- export type MutationCtx = GenericMutationCtx<DataModel>;
90
+ type MutationCtx = GenericMutationCtx<DataModel>;
96
91
  /**
97
92
  * A set of services for use within Convex action functions.
98
93
  *
99
94
  * The action context is passed as the first argument to any Convex action
100
95
  * function run on the server.
101
96
  */
102
- export type ActionCtx = GenericActionCtx<DataModel>;
97
+ type ActionCtx = GenericActionCtx<DataModel>;
103
98
  /**
104
99
  * An interface to read from the database within Convex query functions.
105
100
  *
@@ -107,7 +102,7 @@ export type ActionCtx = GenericActionCtx<DataModel>;
107
102
  * document by its {@link Id}, or {@link DatabaseReader.query}, which starts
108
103
  * building a query.
109
104
  */
110
- export type DatabaseReader = GenericDatabaseReader<DataModel>;
105
+ type DatabaseReader = GenericDatabaseReader<DataModel>;
111
106
  /**
112
107
  * An interface to read from and write to the database within Convex mutation
113
108
  * functions.
@@ -117,4 +112,6 @@ export type DatabaseReader = GenericDatabaseReader<DataModel>;
117
112
  * your data in an inconsistent state. See [the Convex Guide](https://docs.convex.dev/understanding/convex-fundamentals/functions#atomicity-and-optimistic-concurrency-control)
118
113
  * for the guarantees Convex provides your functions.
119
114
  */
120
- export type DatabaseWriter = GenericDatabaseWriter<DataModel>;
115
+ type DatabaseWriter = GenericDatabaseWriter<DataModel>;
116
+ //#endregion
117
+ export { ActionCtx, DatabaseReader, DatabaseWriter, MutationCtx, QueryCtx, action, httpAction, internalAction, internalMutation, internalQuery, mutation, query };
@@ -1,9 +1,73 @@
1
1
  import { actionGeneric, httpActionGeneric, internalActionGeneric, internalMutationGeneric, internalQueryGeneric, mutationGeneric, queryGeneric } from "convex/server";
2
+
3
+ //#region src/component/_generated/server.ts
4
+ /**
5
+ * Define a query in this Convex app's public API.
6
+ *
7
+ * This function will be allowed to read your Convex database and will be accessible from the client.
8
+ *
9
+ * @param func - The query function. It receives a {@link QueryCtx} as its first argument.
10
+ * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
11
+ */
2
12
  const query = queryGeneric;
13
+ /**
14
+ * Define a query that is only accessible from other Convex functions (but not from the client).
15
+ *
16
+ * This function will be allowed to read from your Convex database. It will not be accessible from the client.
17
+ *
18
+ * @param func - The query function. It receives a {@link QueryCtx} as its first argument.
19
+ * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
20
+ */
3
21
  const internalQuery = internalQueryGeneric;
22
+ /**
23
+ * Define a mutation in this Convex app's public API.
24
+ *
25
+ * This function will be allowed to modify your Convex database and will be accessible from the client.
26
+ *
27
+ * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
28
+ * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
29
+ */
4
30
  const mutation = mutationGeneric;
31
+ /**
32
+ * Define a mutation that is only accessible from other Convex functions (but not from the client).
33
+ *
34
+ * This function will be allowed to modify your Convex database. It will not be accessible from the client.
35
+ *
36
+ * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
37
+ * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
38
+ */
5
39
  const internalMutation = internalMutationGeneric;
40
+ /**
41
+ * Define an action in this Convex app's public API.
42
+ *
43
+ * An action is a function which can execute any JavaScript code, including non-deterministic
44
+ * code and code with side-effects, like calling third-party services.
45
+ * They can be run in Convex's JavaScript environment or in Node.js using the "use node" directive.
46
+ * They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}.
47
+ *
48
+ * @param func - The action. It receives an {@link ActionCtx} as its first argument.
49
+ * @returns The wrapped action. Include this as an `export` to name it and make it accessible.
50
+ */
6
51
  const action = actionGeneric;
52
+ /**
53
+ * Define an action that is only accessible from other Convex functions (but not from the client).
54
+ *
55
+ * @param func - The function. It receives an {@link ActionCtx} as its first argument.
56
+ * @returns The wrapped function. Include this as an `export` to name it and make it accessible.
57
+ */
7
58
  const internalAction = internalActionGeneric;
59
+ /**
60
+ * Define an HTTP action.
61
+ *
62
+ * The wrapped function will be used to respond to HTTP requests received
63
+ * by a Convex deployment if the requests matches the path and method where
64
+ * this action is routed. Be sure to route your httpAction in `convex/http.js`.
65
+ *
66
+ * @param func - The function. It receives an {@link ActionCtx} as its first argument
67
+ * and a Fetch API `Request` object as its second.
68
+ * @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
69
+ */
8
70
  const httpAction = httpActionGeneric;
9
- export { action, httpAction, internalAction, internalMutation, internalQuery, mutation, query };
71
+
72
+ //#endregion
73
+ export { action, httpAction, internalAction, internalMutation, internalQuery, mutation, query };
@@ -0,0 +1,18 @@
1
+ //#region rolldown:runtime
2
+ var __defProp = Object.defineProperty;
3
+ var __export = (all, symbols) => {
4
+ let target = {};
5
+ for (var name in all) {
6
+ __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ }
11
+ if (symbols) {
12
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
13
+ }
14
+ return target;
15
+ };
16
+
17
+ //#endregion
18
+ export { __export };
@@ -1,2 +1,6 @@
1
- declare const component: import("convex/server").ComponentDefinition<any>;
2
- export default component;
1
+ import * as convex_server0 from "convex/server";
2
+
3
+ //#region src/component/convex.config.d.ts
4
+ declare const component: convex_server0.ComponentDefinition<any>;
5
+ //#endregion
6
+ export { component as default };
@@ -1,4 +1,8 @@
1
1
  import { defineComponent } from "convex/server";
2
- const component = defineComponent('replicate');
3
- const convex_config = component;
4
- export { convex_config as default };
2
+
3
+ //#region src/component/convex.config.ts
4
+ const component = defineComponent("replicate");
5
+ var convex_config_default = component;
6
+
7
+ //#endregion
8
+ export { convex_config_default as default };
@@ -1,8 +1,12 @@
1
+ declare namespace logger_d_exports {
2
+ export { getLogger };
3
+ }
1
4
  interface Logger {
2
- debug(message: string, context?: Record<string, any>): void;
3
- info(message: string, context?: Record<string, any>): void;
4
- warn(message: string, context?: Record<string, any>): void;
5
- error(message: string, context?: Record<string, any>): void;
5
+ debug(message: string, context?: Record<string, any>): void;
6
+ info(message: string, context?: Record<string, any>): void;
7
+ warn(message: string, context?: Record<string, any>): void;
8
+ error(message: string, context?: Record<string, any>): void;
6
9
  }
7
- export declare function getLogger(category: string[]): Logger;
8
- export {};
10
+ declare function getLogger(category: string[]): Logger;
11
+ //#endregion
12
+ export { getLogger, logger_d_exports };
@@ -1,30 +1,27 @@
1
- class ComponentLogger {
2
- category;
3
- constructor(category){
4
- this.category = category;
5
- }
6
- format(level, message, context) {
7
- const prefix = `[${this.category.join(':')}]`;
8
- const contextStr = context ? ` ${JSON.stringify(context)}` : '';
9
- return `${prefix} ${level}: ${message}${contextStr}`;
10
- }
11
- debug(message, context) {
12
- console.log(this.format('DEBUG', message, context));
13
- }
14
- info(message, context) {
15
- console.log(this.format('INFO', message, context));
16
- }
17
- warn(message, context) {
18
- console.warn(this.format('WARN', message, context));
19
- }
20
- error(message, context) {
21
- console.error(this.format('ERROR', message, context));
22
- }
23
- }
1
+ //#region src/component/logger.ts
2
+ var ComponentLogger = class {
3
+ constructor(category) {
4
+ this.category = category;
5
+ }
6
+ format(level, message, context) {
7
+ return `${`[${this.category.join(":")}]`} ${level}: ${message}${context ? ` ${JSON.stringify(context)}` : ""}`;
8
+ }
9
+ debug(message, context) {
10
+ console.log(this.format("DEBUG", message, context));
11
+ }
12
+ info(message, context) {
13
+ console.log(this.format("INFO", message, context));
14
+ }
15
+ warn(message, context) {
16
+ console.warn(this.format("WARN", message, context));
17
+ }
18
+ error(message, context) {
19
+ console.error(this.format("ERROR", message, context));
20
+ }
21
+ };
24
22
  function getLogger(category) {
25
- return new ComponentLogger([
26
- 'component',
27
- ...category
28
- ]);
23
+ return new ComponentLogger(["component", ...category]);
29
24
  }
30
- export { getLogger };
25
+
26
+ //#endregion
27
+ export { getLogger };