@devwithbobby/loops 0.1.18 → 0.2.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/dist/client/index.d.ts +133 -103
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +55 -10
- package/dist/component/_generated/api.d.ts +228 -0
- package/dist/component/_generated/api.d.ts.map +1 -0
- package/{src → dist}/component/_generated/api.js +10 -3
- package/dist/component/_generated/component.d.ts +266 -0
- package/dist/component/_generated/component.d.ts.map +1 -0
- package/dist/component/_generated/component.js +9 -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 +10 -0
- package/{src → dist}/component/_generated/server.d.ts +10 -38
- package/dist/component/_generated/server.d.ts.map +1 -0
- package/{src → dist}/component/_generated/server.js +9 -22
- package/dist/component/aggregates.d.ts +42 -0
- package/dist/component/aggregates.d.ts.map +1 -0
- package/dist/component/aggregates.js +54 -0
- package/dist/component/convex.config.d.ts.map +1 -1
- package/dist/component/convex.config.js +2 -22
- package/dist/component/helpers.d.ts +1 -1
- package/dist/component/helpers.d.ts.map +1 -1
- package/dist/component/helpers.js +1 -2
- package/dist/component/http.js +1 -1
- package/dist/component/lib.d.ts +66 -17
- package/dist/component/lib.d.ts.map +1 -1
- package/dist/component/lib.js +194 -73
- package/dist/component/schema.d.ts +2 -2
- package/dist/component/tables/contacts.d.ts.map +1 -1
- package/dist/component/tables/emailOperations.d.ts +4 -4
- package/dist/component/tables/emailOperations.d.ts.map +1 -1
- package/dist/test.d.ts +83 -0
- package/dist/test.d.ts.map +1 -0
- package/dist/test.js +16 -0
- package/dist/types.d.ts +249 -62
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -2
- package/dist/utils.d.ts +6 -6
- package/package.json +25 -13
- package/src/client/index.ts +69 -18
- package/src/component/_generated/api.ts +249 -0
- package/src/component/_generated/component.ts +328 -0
- package/src/component/_generated/server.ts +161 -0
- package/src/component/aggregates.ts +89 -0
- package/src/component/convex.config.ts +2 -26
- package/src/component/helpers.ts +2 -2
- package/src/component/http.ts +1 -1
- package/src/component/lib.ts +226 -89
- package/src/test.ts +27 -0
- package/src/types.ts +20 -122
- package/src/component/_generated/api.d.ts +0 -47
- /package/src/component/_generated/{dataModel.d.ts → dataModel.ts} +0 -0
package/src/types.ts
CHANGED
|
@@ -1,75 +1,28 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
StorageActionWriter,
|
|
7
|
-
StorageReader,
|
|
2
|
+
GenericActionCtx,
|
|
3
|
+
GenericDataModel,
|
|
4
|
+
GenericMutationCtx,
|
|
5
|
+
GenericQueryCtx,
|
|
8
6
|
} from "convex/server";
|
|
9
|
-
import
|
|
10
|
-
import { internal } from "./component/_generated/api";
|
|
7
|
+
import { api } from "./component/_generated/api";
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
query: Query,
|
|
15
|
-
args: FunctionArgs<Query>,
|
|
16
|
-
) => Promise<FunctionReturnType<Query>>;
|
|
17
|
-
};
|
|
9
|
+
// Convenient types for `ctx` args, that only include the bare minimum.
|
|
10
|
+
export type RunQueryCtx = Pick<GenericQueryCtx<GenericDataModel>, "runQuery">;
|
|
18
11
|
|
|
19
|
-
export type RunMutationCtx =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
) => Promise<FunctionReturnType<Mutation>>;
|
|
24
|
-
};
|
|
12
|
+
export type RunMutationCtx = Pick<
|
|
13
|
+
GenericMutationCtx<GenericDataModel>,
|
|
14
|
+
"runQuery" | "runMutation"
|
|
15
|
+
>;
|
|
25
16
|
|
|
26
|
-
export type RunActionCtx =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
): Promise<FunctionReturnType<Action>>;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export type ActionCtx = RunActionCtx & {
|
|
34
|
-
storage: StorageActionWriter;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export type QueryCtx = RunQueryCtx & {
|
|
38
|
-
storage: StorageReader;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export type OpaqueIds<T> = T extends GenericId<infer _T>
|
|
42
|
-
? string
|
|
43
|
-
: T extends (infer U)[]
|
|
44
|
-
? OpaqueIds<U>[]
|
|
45
|
-
: T extends ArrayBuffer
|
|
46
|
-
? ArrayBuffer
|
|
47
|
-
: T extends object
|
|
48
|
-
? {
|
|
49
|
-
[K in keyof T]: OpaqueIds<T[K]>;
|
|
50
|
-
}
|
|
51
|
-
: T;
|
|
52
|
-
|
|
53
|
-
export type UseApi<API> = Expand<{
|
|
54
|
-
[mod in keyof API]: API[mod] extends FunctionReference<
|
|
55
|
-
infer FType,
|
|
56
|
-
"public",
|
|
57
|
-
infer FArgs,
|
|
58
|
-
infer FReturnType,
|
|
59
|
-
infer FComponentPath
|
|
60
|
-
>
|
|
61
|
-
? FunctionReference<
|
|
62
|
-
FType,
|
|
63
|
-
"internal",
|
|
64
|
-
OpaqueIds<FArgs>,
|
|
65
|
-
OpaqueIds<FReturnType>,
|
|
66
|
-
FComponentPath
|
|
67
|
-
>
|
|
68
|
-
: UseApi<API[mod]>;
|
|
69
|
-
}>;
|
|
17
|
+
export type RunActionCtx = Pick<
|
|
18
|
+
GenericActionCtx<GenericDataModel>,
|
|
19
|
+
"runQuery" | "runMutation" | "runAction"
|
|
20
|
+
>;
|
|
70
21
|
|
|
22
|
+
// Type for Headers constructor parameter
|
|
71
23
|
export type HeadersInitParam = ConstructorParameters<typeof Headers>[0];
|
|
72
24
|
|
|
25
|
+
// Payload types for the Loops API
|
|
73
26
|
export interface ContactPayload {
|
|
74
27
|
email: string;
|
|
75
28
|
firstName?: string;
|
|
@@ -108,61 +61,6 @@ export interface TriggerPayload {
|
|
|
108
61
|
eventName?: string;
|
|
109
62
|
}
|
|
110
63
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
> = FunctionReference<"action", "internal", Args, Result>;
|
|
115
|
-
|
|
116
|
-
export type InternalMutationRef<
|
|
117
|
-
Args extends Record<string, unknown> = Record<string, unknown>,
|
|
118
|
-
Result = unknown,
|
|
119
|
-
> = FunctionReference<"mutation", "internal", Args, Result>;
|
|
120
|
-
|
|
121
|
-
export type InternalQueryRef<
|
|
122
|
-
Args extends Record<string, unknown> = Record<string, unknown>,
|
|
123
|
-
Result = unknown,
|
|
124
|
-
> = FunctionReference<"query", "internal", Args, Result>;
|
|
125
|
-
|
|
126
|
-
type AddContactArgs = {
|
|
127
|
-
apiKey: string;
|
|
128
|
-
contact: ContactPayload;
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
type AddContactResult = {
|
|
132
|
-
success: boolean;
|
|
133
|
-
id?: string;
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
export interface InternalActionLib {
|
|
137
|
-
addContact: InternalActionRef<AddContactArgs, AddContactResult>;
|
|
138
|
-
updateContact: InternalActionRef;
|
|
139
|
-
findContact: InternalActionRef;
|
|
140
|
-
deleteContact: InternalActionRef;
|
|
141
|
-
sendTransactional: InternalActionRef;
|
|
142
|
-
sendEvent: InternalActionRef;
|
|
143
|
-
triggerLoop: InternalActionRef;
|
|
144
|
-
batchCreateContacts: InternalActionRef;
|
|
145
|
-
unsubscribeContact: InternalActionRef;
|
|
146
|
-
resubscribeContact: InternalActionRef;
|
|
147
|
-
storeContact: InternalMutationRef;
|
|
148
|
-
removeContact: InternalMutationRef;
|
|
149
|
-
logEmailOperation: InternalMutationRef;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export interface InternalQueryLib {
|
|
153
|
-
countContacts: InternalQueryRef;
|
|
154
|
-
listContacts: InternalQueryRef;
|
|
155
|
-
detectRecipientSpam: InternalQueryRef;
|
|
156
|
-
detectActorSpam: InternalQueryRef;
|
|
157
|
-
getEmailStats: InternalQueryRef;
|
|
158
|
-
detectRapidFirePatterns: InternalQueryRef;
|
|
159
|
-
checkRecipientRateLimit: InternalQueryRef;
|
|
160
|
-
checkActorRateLimit: InternalQueryRef;
|
|
161
|
-
checkGlobalRateLimit: InternalQueryRef;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export type InternalLibReferences = InternalActionLib & InternalQueryLib;
|
|
165
|
-
|
|
166
|
-
export const internalLib = (
|
|
167
|
-
internal as unknown as { lib: InternalLibReferences }
|
|
168
|
-
).lib;
|
|
64
|
+
// Lib reference for component internals
|
|
65
|
+
// This is used internally by the component to call its own functions
|
|
66
|
+
export const internalLib = api.lib;
|
|
@@ -1,47 +0,0 @@
|
|
|
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
|
-
|
|
11
|
-
import type * as lib from "../lib.js";
|
|
12
|
-
|
|
13
|
-
import type {
|
|
14
|
-
ApiFromModules,
|
|
15
|
-
FilterApi,
|
|
16
|
-
FunctionReference,
|
|
17
|
-
} from "convex/server";
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* A utility for referencing Convex functions in your app's API.
|
|
21
|
-
*
|
|
22
|
-
* Usage:
|
|
23
|
-
* ```js
|
|
24
|
-
* const myFunctionReference = api.myModule.myFunction;
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
declare const fullApi: ApiFromModules<{
|
|
28
|
-
lib: typeof lib;
|
|
29
|
-
}>;
|
|
30
|
-
export type Mounts = ApiFromModules<{
|
|
31
|
-
lib: typeof lib;
|
|
32
|
-
}>;
|
|
33
|
-
// For now fullApiWithMounts is only fullApi which provides
|
|
34
|
-
// jump-to-definition in component client code.
|
|
35
|
-
// Use Mounts for the same type without the inference.
|
|
36
|
-
declare const fullApiWithMounts: typeof fullApi;
|
|
37
|
-
|
|
38
|
-
export declare const api: FilterApi<
|
|
39
|
-
typeof fullApiWithMounts,
|
|
40
|
-
FunctionReference<any, "public">
|
|
41
|
-
>;
|
|
42
|
-
export declare const internal: FilterApi<
|
|
43
|
-
typeof fullApiWithMounts,
|
|
44
|
-
FunctionReference<any, "internal">
|
|
45
|
-
>;
|
|
46
|
-
|
|
47
|
-
export declare const components: {};
|
|
File without changes
|