@transloadit/convex 0.0.2 → 0.0.4
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/README.md +184 -121
- package/dist/client/index.d.ts +100 -60
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +69 -31
- package/dist/client/index.js.map +1 -1
- package/dist/component/_generated/api.d.ts +2 -2
- package/dist/component/_generated/component.d.ts +35 -15
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/_generated/dataModel.d.ts +1 -1
- package/dist/component/_generated/server.d.ts +1 -1
- package/dist/component/apiUtils.d.ts +36 -7
- package/dist/component/apiUtils.d.ts.map +1 -1
- package/dist/component/apiUtils.js +60 -40
- package/dist/component/apiUtils.js.map +1 -1
- package/dist/component/lib.d.ts +71 -49
- package/dist/component/lib.d.ts.map +1 -1
- package/dist/component/lib.js +206 -73
- package/dist/component/lib.js.map +1 -1
- package/dist/component/schema.d.ts +11 -13
- package/dist/component/schema.d.ts.map +1 -1
- package/dist/component/schema.js +3 -10
- package/dist/component/schema.js.map +1 -1
- package/dist/debug/index.d.ts +19 -0
- package/dist/debug/index.d.ts.map +1 -0
- package/dist/debug/index.js +49 -0
- package/dist/debug/index.js.map +1 -0
- package/dist/react/index.d.ts +213 -17
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +726 -105
- package/dist/react/index.js.map +1 -1
- package/dist/shared/assemblyUrls.d.ts +10 -0
- package/dist/shared/assemblyUrls.d.ts.map +1 -0
- package/dist/shared/assemblyUrls.js +26 -0
- package/dist/shared/assemblyUrls.js.map +1 -0
- package/dist/shared/errors.d.ts +7 -0
- package/dist/shared/errors.d.ts.map +1 -0
- package/dist/shared/errors.js +10 -0
- package/dist/shared/errors.js.map +1 -0
- package/dist/shared/pollAssembly.d.ts +12 -0
- package/dist/shared/pollAssembly.d.ts.map +1 -0
- package/dist/shared/pollAssembly.js +50 -0
- package/dist/shared/pollAssembly.js.map +1 -0
- package/dist/shared/resultTypes.d.ts +37 -0
- package/dist/shared/resultTypes.d.ts.map +1 -0
- package/dist/shared/resultTypes.js +2 -0
- package/dist/shared/resultTypes.js.map +1 -0
- package/dist/shared/resultUtils.d.ts +4 -0
- package/dist/shared/resultUtils.d.ts.map +1 -0
- package/dist/shared/resultUtils.js +69 -0
- package/dist/shared/resultUtils.js.map +1 -0
- package/dist/shared/tusUpload.d.ts +13 -0
- package/dist/shared/tusUpload.d.ts.map +1 -0
- package/dist/shared/tusUpload.js +32 -0
- package/dist/shared/tusUpload.js.map +1 -0
- package/dist/test/index.d.ts +65 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +8 -0
- package/dist/test/index.js.map +1 -0
- package/dist/test/nodeModules.d.ts +2 -0
- package/dist/test/nodeModules.d.ts.map +1 -0
- package/dist/test/nodeModules.js +19 -0
- package/dist/test/nodeModules.js.map +1 -0
- package/package.json +53 -15
- package/src/client/index.ts +141 -38
- package/src/component/_generated/api.ts +2 -2
- package/src/component/_generated/component.ts +44 -13
- package/src/component/_generated/dataModel.ts +1 -1
- package/src/component/_generated/server.ts +1 -1
- package/src/component/apiUtils.test.ts +195 -2
- package/src/component/apiUtils.ts +124 -66
- package/src/component/lib.test.ts +243 -7
- package/src/component/lib.ts +302 -90
- package/src/component/schema.ts +3 -13
- package/src/debug/index.ts +84 -0
- package/src/react/index.test.tsx +340 -0
- package/src/react/index.tsx +1105 -152
- package/src/react/uploadWithTus.test.tsx +192 -0
- package/src/shared/assemblyUrls.test.ts +71 -0
- package/src/shared/assemblyUrls.ts +59 -0
- package/src/shared/errors.ts +23 -0
- package/src/shared/pollAssembly.ts +65 -0
- package/src/shared/resultTypes.ts +44 -0
- package/src/shared/resultUtils.test.ts +29 -0
- package/src/shared/resultUtils.ts +71 -0
- package/src/shared/tusUpload.ts +59 -0
- package/src/test/index.ts +10 -0
- package/src/test/nodeModules.ts +19 -0
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
9
|
import type { ActionBuilder, HttpActionBuilder, MutationBuilder, QueryBuilder, GenericActionCtx, GenericMutationCtx, GenericQueryCtx, GenericDatabaseReader, GenericDatabaseWriter } from "convex/server";
|
|
10
|
-
import type { DataModel } from "./dataModel.
|
|
10
|
+
import type { DataModel } from "./dataModel.ts";
|
|
11
11
|
export declare const query: QueryBuilder<DataModel, "public">;
|
|
12
12
|
export declare const internalQuery: QueryBuilder<DataModel, "internal">;
|
|
13
13
|
export declare const mutation: MutationBuilder<DataModel, "public">;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { verifyWebhookSignature } from "@transloadit/utils";
|
|
2
|
+
import type { AssemblyStatusResults } from "@transloadit/zod/v3/assemblyStatus";
|
|
3
|
+
import type { AssemblyInstructionsInput } from "@transloadit/zod/v3/template";
|
|
1
4
|
export interface TransloaditAuthConfig {
|
|
2
5
|
authKey: string;
|
|
3
6
|
authSecret: string;
|
|
@@ -5,8 +8,8 @@ export interface TransloaditAuthConfig {
|
|
|
5
8
|
export interface BuildParamsOptions {
|
|
6
9
|
authKey: string;
|
|
7
10
|
templateId?: string;
|
|
8
|
-
steps?:
|
|
9
|
-
fields?:
|
|
11
|
+
steps?: AssemblyInstructionsInput["steps"];
|
|
12
|
+
fields?: AssemblyInstructionsInput["fields"];
|
|
10
13
|
notifyUrl?: string;
|
|
11
14
|
numExpectedUploadFiles?: number;
|
|
12
15
|
expires?: string;
|
|
@@ -18,14 +21,40 @@ export interface BuildParamsResult {
|
|
|
18
21
|
}
|
|
19
22
|
export declare function buildTransloaditParams(options: BuildParamsOptions): BuildParamsResult;
|
|
20
23
|
export declare function signTransloaditParams(paramsString: string, authSecret: string): Promise<string>;
|
|
21
|
-
export
|
|
24
|
+
export type ParsedWebhookRequest = {
|
|
25
|
+
payload: unknown;
|
|
22
26
|
rawBody: string;
|
|
23
|
-
|
|
27
|
+
signature?: string;
|
|
28
|
+
};
|
|
29
|
+
export type VerifiedWebhookRequest = ParsedWebhookRequest & {
|
|
30
|
+
verified: boolean;
|
|
31
|
+
};
|
|
32
|
+
export declare function parseTransloaditWebhook(request: Request): Promise<ParsedWebhookRequest>;
|
|
33
|
+
export declare function parseAndVerifyTransloaditWebhook(request: Request, options: {
|
|
24
34
|
authSecret: string;
|
|
25
|
-
|
|
35
|
+
requireSignature?: boolean;
|
|
36
|
+
}): Promise<VerifiedWebhookRequest>;
|
|
37
|
+
export declare function buildWebhookQueueArgs(request: Request, options: {
|
|
38
|
+
authSecret: string;
|
|
39
|
+
requireSignature?: boolean;
|
|
40
|
+
}): Promise<ParsedWebhookRequest>;
|
|
41
|
+
export type WebhookActionArgs = {
|
|
42
|
+
payload: unknown;
|
|
43
|
+
rawBody?: string;
|
|
44
|
+
signature?: string;
|
|
45
|
+
};
|
|
46
|
+
export declare function handleWebhookRequest(request: Request, options: {
|
|
47
|
+
mode?: "queue" | "sync";
|
|
48
|
+
runAction: (args: WebhookActionArgs) => Promise<unknown>;
|
|
49
|
+
requireSignature?: boolean;
|
|
50
|
+
authSecret?: string;
|
|
51
|
+
responseStatus?: number;
|
|
52
|
+
}): Promise<Response>;
|
|
53
|
+
export { verifyWebhookSignature };
|
|
54
|
+
export type AssemblyResult = AssemblyStatusResults[string][number];
|
|
26
55
|
export type AssemblyResultRecord = {
|
|
27
56
|
stepName: string;
|
|
28
|
-
result:
|
|
57
|
+
result: AssemblyResult;
|
|
29
58
|
};
|
|
30
|
-
export declare function flattenResults(results:
|
|
59
|
+
export declare function flattenResults(results: AssemblyStatusResults | undefined): AssemblyResultRecord[];
|
|
31
60
|
//# sourceMappingURL=apiUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiUtils.d.ts","sourceRoot":"","sources":["../../src/component/apiUtils.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACj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,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,cAAc,CAAC;CACxB,CAAC;AAEF,wBAAgB,cAAc,CAC5B,OAAO,EAAE,qBAAqB,GAAG,SAAS,GACzC,oBAAoB,EAAE,CAUxB"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { signParams, verifyWebhookSignature } from "@transloadit/utils";
|
|
2
|
+
import { transloaditError } from "../shared/errors.js";
|
|
1
3
|
export function buildTransloaditParams(options) {
|
|
2
4
|
if (!options.templateId && !options.steps) {
|
|
3
|
-
throw
|
|
5
|
+
throw transloaditError("createAssembly", "Provide either templateId or steps to create an Assembly");
|
|
4
6
|
}
|
|
5
7
|
const auth = {
|
|
6
8
|
key: options.authKey,
|
|
@@ -33,51 +35,69 @@ export function buildTransloaditParams(options) {
|
|
|
33
35
|
paramsString: JSON.stringify(params),
|
|
34
36
|
};
|
|
35
37
|
}
|
|
36
|
-
async function hmacHex(algorithm, key, data) {
|
|
37
|
-
if (globalThis.crypto?.subtle) {
|
|
38
|
-
const encoder = new TextEncoder();
|
|
39
|
-
const cryptoKey = await globalThis.crypto.subtle.importKey("raw", encoder.encode(key), { name: "HMAC", hash: { name: algorithm } }, false, ["sign"]);
|
|
40
|
-
const signature = await globalThis.crypto.subtle.sign("HMAC", cryptoKey, encoder.encode(data));
|
|
41
|
-
const bytes = new Uint8Array(signature);
|
|
42
|
-
return Array.from(bytes)
|
|
43
|
-
.map((byte) => byte.toString(16).padStart(2, "0"))
|
|
44
|
-
.join("");
|
|
45
|
-
}
|
|
46
|
-
const { createHmac } = await import("node:crypto");
|
|
47
|
-
return createHmac(algorithm.replace("-", "").toLowerCase(), key)
|
|
48
|
-
.update(data)
|
|
49
|
-
.digest("hex");
|
|
50
|
-
}
|
|
51
38
|
export async function signTransloaditParams(paramsString, authSecret) {
|
|
52
|
-
|
|
53
|
-
return `sha384:${signature}`;
|
|
39
|
+
return signParams(paramsString, authSecret, "sha384");
|
|
54
40
|
}
|
|
55
|
-
function
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
41
|
+
export async function parseTransloaditWebhook(request) {
|
|
42
|
+
const formData = await request.formData();
|
|
43
|
+
const rawPayload = formData.get("transloadit");
|
|
44
|
+
const signature = formData.get("signature");
|
|
45
|
+
if (typeof rawPayload !== "string") {
|
|
46
|
+
throw transloaditError("webhook", "Missing transloadit payload");
|
|
61
47
|
}
|
|
62
|
-
return
|
|
48
|
+
return {
|
|
49
|
+
payload: JSON.parse(rawPayload),
|
|
50
|
+
rawBody: rawPayload,
|
|
51
|
+
signature: typeof signature === "string" ? signature : undefined,
|
|
52
|
+
};
|
|
63
53
|
}
|
|
64
|
-
export async function
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (
|
|
76
|
-
|
|
54
|
+
export async function parseAndVerifyTransloaditWebhook(request, options) {
|
|
55
|
+
const parsed = await parseTransloaditWebhook(request);
|
|
56
|
+
const authSecret = options.authSecret;
|
|
57
|
+
if (!authSecret) {
|
|
58
|
+
throw transloaditError("webhook", "Missing authSecret for webhook verification");
|
|
59
|
+
}
|
|
60
|
+
const verified = await verifyWebhookSignature({
|
|
61
|
+
rawBody: parsed.rawBody,
|
|
62
|
+
signatureHeader: parsed.signature,
|
|
63
|
+
authSecret,
|
|
64
|
+
});
|
|
65
|
+
if (options.requireSignature ?? true) {
|
|
66
|
+
if (!verified) {
|
|
67
|
+
throw transloaditError("webhook", "Invalid Transloadit webhook signature");
|
|
68
|
+
}
|
|
77
69
|
}
|
|
78
|
-
|
|
79
|
-
|
|
70
|
+
return { ...parsed, verified };
|
|
71
|
+
}
|
|
72
|
+
export async function buildWebhookQueueArgs(request, options) {
|
|
73
|
+
if (options.requireSignature === false) {
|
|
74
|
+
return parseTransloaditWebhook(request);
|
|
75
|
+
}
|
|
76
|
+
const parsed = await parseAndVerifyTransloaditWebhook(request, options);
|
|
77
|
+
return {
|
|
78
|
+
payload: parsed.payload,
|
|
79
|
+
rawBody: parsed.rawBody,
|
|
80
|
+
signature: parsed.signature,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export async function handleWebhookRequest(request, options) {
|
|
84
|
+
const mode = options.mode ?? "queue";
|
|
85
|
+
const requireSignature = options.requireSignature ?? false;
|
|
86
|
+
const parsed = requireSignature
|
|
87
|
+
? await parseAndVerifyTransloaditWebhook(request, {
|
|
88
|
+
authSecret: options.authSecret ?? "",
|
|
89
|
+
requireSignature: true,
|
|
90
|
+
})
|
|
91
|
+
: await parseTransloaditWebhook(request);
|
|
92
|
+
await options.runAction({
|
|
93
|
+
payload: parsed.payload,
|
|
94
|
+
rawBody: parsed.rawBody,
|
|
95
|
+
signature: parsed.signature,
|
|
96
|
+
});
|
|
97
|
+
const status = options.responseStatus ?? (mode === "sync" ? 204 : 202);
|
|
98
|
+
return new Response(null, { status });
|
|
80
99
|
}
|
|
100
|
+
export { verifyWebhookSignature };
|
|
81
101
|
export function flattenResults(results) {
|
|
82
102
|
if (!results)
|
|
83
103
|
return [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiUtils.js","sourceRoot":"","sources":["../../src/component/apiUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apiUtils.js","sourceRoot":"","sources":["../../src/component/apiUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAuBvD,MAAM,UAAU,sBAAsB,CACpC,OAA2B;IAE3B,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QAC1C,MAAM,gBAAgB,CACpB,gBAAgB,EAChB,0DAA0D,CAC3D,CAAC;IACJ,CAAC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C,CAAC;AACxC,CAAC;AAED,OAAO,EAAE,sBAAsB,EAAE,CAAC;AASlC,MAAM,UAAU,cAAc,CAC5B,OAA0C;IAE1C,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IACxB,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC1D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;YAAE,SAAS;QACtC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/component/lib.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { type Infer } from "convex/values";
|
|
2
|
+
type ProcessWebhookResult = {
|
|
3
|
+
assemblyId: string;
|
|
4
|
+
resultCount: number;
|
|
5
|
+
ok?: string;
|
|
6
|
+
status?: string;
|
|
7
|
+
};
|
|
2
8
|
export declare const vAssembly: import("convex/values").VObject<{
|
|
3
9
|
status?: string | undefined;
|
|
4
10
|
ok?: string | undefined;
|
|
@@ -6,9 +12,9 @@ export declare const vAssembly: import("convex/values").VObject<{
|
|
|
6
12
|
templateId?: string | undefined;
|
|
7
13
|
notifyUrl?: string | undefined;
|
|
8
14
|
numExpectedUploadFiles?: number | undefined;
|
|
9
|
-
fields?: any;
|
|
10
|
-
uploads?: any;
|
|
11
|
-
results?: any;
|
|
15
|
+
fields?: Record<string, any> | undefined;
|
|
16
|
+
uploads?: any[] | undefined;
|
|
17
|
+
results?: Record<string, any[]> | undefined;
|
|
12
18
|
error?: any;
|
|
13
19
|
raw?: any;
|
|
14
20
|
userId?: string | undefined;
|
|
@@ -27,22 +33,22 @@ export declare const vAssembly: import("convex/values").VObject<{
|
|
|
27
33
|
templateId: import("convex/values").VString<string | undefined, "optional">;
|
|
28
34
|
notifyUrl: import("convex/values").VString<string | undefined, "optional">;
|
|
29
35
|
numExpectedUploadFiles: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
30
|
-
fields: import("convex/values").VAny<any, "optional", string>;
|
|
31
|
-
uploads: import("convex/values").VAny<any, "
|
|
32
|
-
results: import("convex/values").VAny<any, "optional", string>;
|
|
36
|
+
fields: import("convex/values").VRecord<Record<string, any> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "optional", string>;
|
|
37
|
+
uploads: import("convex/values").VArray<any[] | undefined, import("convex/values").VAny<any, "required", string>, "optional">;
|
|
38
|
+
results: import("convex/values").VRecord<Record<string, any[]> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VArray<any[], import("convex/values").VAny<any, "required", string>, "required">, "optional", string>;
|
|
33
39
|
error: import("convex/values").VAny<any, "optional", string>;
|
|
34
40
|
raw: import("convex/values").VAny<any, "optional", string>;
|
|
35
41
|
createdAt: import("convex/values").VFloat64<number, "required">;
|
|
36
42
|
updatedAt: import("convex/values").VFloat64<number, "required">;
|
|
37
43
|
userId: import("convex/values").VString<string | undefined, "optional">;
|
|
38
|
-
}, "required", "assemblyId" | "status" | "ok" | "message" | "templateId" | "notifyUrl" | "numExpectedUploadFiles" | "fields" | "uploads" | "results" | "error" | "raw" | "userId" | "_id" | "_creationTime" | "createdAt" | "updatedAt" | `fields.${string}` | `
|
|
44
|
+
}, "required", "assemblyId" | "status" | "ok" | "message" | "templateId" | "notifyUrl" | "numExpectedUploadFiles" | "fields" | "uploads" | "results" | "error" | "raw" | "userId" | "_id" | "_creationTime" | "createdAt" | "updatedAt" | `fields.${string}` | `results.${string}` | `error.${string}` | `raw.${string}`>;
|
|
39
45
|
export type Assembly = Infer<typeof vAssembly>;
|
|
40
46
|
export declare const vAssemblyResult: import("convex/values").VObject<{
|
|
41
|
-
|
|
42
|
-
sslUrl?: string | undefined;
|
|
47
|
+
mime?: string | undefined;
|
|
43
48
|
name?: string | undefined;
|
|
44
49
|
size?: number | undefined;
|
|
45
|
-
|
|
50
|
+
sslUrl?: string | undefined;
|
|
51
|
+
resultId?: string | undefined;
|
|
46
52
|
assemblyId: string;
|
|
47
53
|
raw: any;
|
|
48
54
|
stepName: string;
|
|
@@ -61,15 +67,15 @@ export declare const vAssemblyResult: import("convex/values").VObject<{
|
|
|
61
67
|
mime: import("convex/values").VString<string | undefined, "optional">;
|
|
62
68
|
raw: import("convex/values").VAny<any, "required", string>;
|
|
63
69
|
createdAt: import("convex/values").VFloat64<number, "required">;
|
|
64
|
-
}, "required", "assemblyId" | "raw" | "stepName" | "
|
|
70
|
+
}, "required", "assemblyId" | "raw" | "stepName" | "mime" | "name" | "size" | "sslUrl" | "resultId" | "_id" | "_creationTime" | "createdAt" | `raw.${string}`>;
|
|
65
71
|
export type AssemblyResult = Infer<typeof vAssemblyResult>;
|
|
66
72
|
export declare const vTransloaditConfig: import("convex/values").VObject<{
|
|
67
|
-
authKey: string;
|
|
68
73
|
authSecret: string;
|
|
74
|
+
authKey: string;
|
|
69
75
|
}, {
|
|
70
76
|
authKey: import("convex/values").VString<string, "required">;
|
|
71
77
|
authSecret: import("convex/values").VString<string, "required">;
|
|
72
|
-
}, "required", "
|
|
78
|
+
}, "required", "authSecret" | "authKey">;
|
|
73
79
|
export declare const upsertAssembly: import("convex/server").RegisteredMutation<"internal", {
|
|
74
80
|
status?: string | undefined;
|
|
75
81
|
ok?: string | undefined;
|
|
@@ -77,9 +83,9 @@ export declare const upsertAssembly: import("convex/server").RegisteredMutation<
|
|
|
77
83
|
templateId?: string | undefined;
|
|
78
84
|
notifyUrl?: string | undefined;
|
|
79
85
|
numExpectedUploadFiles?: number | undefined;
|
|
80
|
-
fields?: any;
|
|
81
|
-
uploads?: any;
|
|
82
|
-
results?: any;
|
|
86
|
+
fields?: Record<string, any> | undefined;
|
|
87
|
+
uploads?: any[] | undefined;
|
|
88
|
+
results?: Record<string, any[]> | undefined;
|
|
83
89
|
error?: any;
|
|
84
90
|
raw?: any;
|
|
85
91
|
userId?: string | undefined;
|
|
@@ -96,36 +102,30 @@ export declare const createAssembly: import("convex/server").RegisteredAction<"p
|
|
|
96
102
|
templateId?: string | undefined;
|
|
97
103
|
notifyUrl?: string | undefined;
|
|
98
104
|
numExpectedUploadFiles?: number | undefined;
|
|
99
|
-
fields?: any;
|
|
105
|
+
fields?: Record<string, any> | undefined;
|
|
100
106
|
userId?: string | undefined;
|
|
101
|
-
steps?: any;
|
|
107
|
+
steps?: Record<string, any> | undefined;
|
|
102
108
|
expires?: string | undefined;
|
|
103
|
-
additionalParams?: any;
|
|
109
|
+
additionalParams?: Record<string, any> | undefined;
|
|
104
110
|
config: {
|
|
105
|
-
authKey: string;
|
|
106
111
|
authSecret: string;
|
|
112
|
+
authKey: string;
|
|
107
113
|
};
|
|
108
114
|
}, Promise<{
|
|
109
115
|
assemblyId: string;
|
|
110
116
|
data: Record<string, unknown>;
|
|
111
117
|
}>>;
|
|
112
|
-
export declare const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
steps?: any;
|
|
119
|
-
expires?: string | undefined;
|
|
120
|
-
additionalParams?: any;
|
|
121
|
-
config: {
|
|
122
|
-
authKey: string;
|
|
123
|
-
authSecret: string;
|
|
124
|
-
};
|
|
118
|
+
export declare const processWebhook: import("convex/server").RegisteredAction<"internal", {
|
|
119
|
+
rawBody?: string | undefined;
|
|
120
|
+
signature?: string | undefined;
|
|
121
|
+
verifySignature?: boolean | undefined;
|
|
122
|
+
authSecret?: string | undefined;
|
|
123
|
+
payload: any;
|
|
125
124
|
}, Promise<{
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
125
|
+
assemblyId: string;
|
|
126
|
+
resultCount: number;
|
|
127
|
+
ok: string | undefined;
|
|
128
|
+
status: string | undefined;
|
|
129
129
|
}>>;
|
|
130
130
|
export declare const handleWebhook: import("convex/server").RegisteredAction<"public", {
|
|
131
131
|
config?: {
|
|
@@ -135,9 +135,30 @@ export declare const handleWebhook: import("convex/server").RegisteredAction<"pu
|
|
|
135
135
|
signature?: string | undefined;
|
|
136
136
|
verifySignature?: boolean | undefined;
|
|
137
137
|
payload: any;
|
|
138
|
+
}, Promise<ProcessWebhookResult>>;
|
|
139
|
+
export declare const queueWebhook: import("convex/server").RegisteredAction<"public", {
|
|
140
|
+
config?: {
|
|
141
|
+
authSecret: string;
|
|
142
|
+
} | undefined;
|
|
143
|
+
rawBody?: string | undefined;
|
|
144
|
+
signature?: string | undefined;
|
|
145
|
+
verifySignature?: boolean | undefined;
|
|
146
|
+
payload: any;
|
|
147
|
+
}, Promise<{
|
|
148
|
+
assemblyId: string;
|
|
149
|
+
queued: boolean;
|
|
150
|
+
}>>;
|
|
151
|
+
export declare const refreshAssembly: import("convex/server").RegisteredAction<"public", {
|
|
152
|
+
config?: {
|
|
153
|
+
authSecret: string;
|
|
154
|
+
authKey: string;
|
|
155
|
+
} | undefined;
|
|
156
|
+
assemblyId: string;
|
|
138
157
|
}, Promise<{
|
|
139
158
|
assemblyId: string;
|
|
140
159
|
resultCount: number;
|
|
160
|
+
ok: string | undefined;
|
|
161
|
+
status: string | undefined;
|
|
141
162
|
}>>;
|
|
142
163
|
export declare const getAssemblyStatus: import("convex/server").RegisteredQuery<"public", {
|
|
143
164
|
assemblyId: string;
|
|
@@ -150,9 +171,9 @@ export declare const getAssemblyStatus: import("convex/server").RegisteredQuery<
|
|
|
150
171
|
templateId?: string | undefined;
|
|
151
172
|
notifyUrl?: string | undefined;
|
|
152
173
|
numExpectedUploadFiles?: number | undefined;
|
|
153
|
-
fields?: any;
|
|
154
|
-
uploads?: any;
|
|
155
|
-
results?: any;
|
|
174
|
+
fields?: Record<string, any> | undefined;
|
|
175
|
+
uploads?: any[] | undefined;
|
|
176
|
+
results?: Record<string, any[]> | undefined;
|
|
156
177
|
error?: any;
|
|
157
178
|
raw?: any;
|
|
158
179
|
userId?: string | undefined;
|
|
@@ -173,9 +194,9 @@ export declare const listAssemblies: import("convex/server").RegisteredQuery<"pu
|
|
|
173
194
|
templateId?: string | undefined;
|
|
174
195
|
notifyUrl?: string | undefined;
|
|
175
196
|
numExpectedUploadFiles?: number | undefined;
|
|
176
|
-
fields?: any;
|
|
177
|
-
uploads?: any;
|
|
178
|
-
results?: any;
|
|
197
|
+
fields?: Record<string, any> | undefined;
|
|
198
|
+
uploads?: any[] | undefined;
|
|
199
|
+
results?: Record<string, any[]> | undefined;
|
|
179
200
|
error?: any;
|
|
180
201
|
raw?: any;
|
|
181
202
|
userId?: string | undefined;
|
|
@@ -190,23 +211,23 @@ export declare const listResults: import("convex/server").RegisteredQuery<"publi
|
|
|
190
211
|
}, Promise<{
|
|
191
212
|
_id: import("convex/values").GenericId<"results">;
|
|
192
213
|
_creationTime: number;
|
|
193
|
-
|
|
194
|
-
sslUrl?: string | undefined;
|
|
214
|
+
mime?: string | undefined;
|
|
195
215
|
name?: string | undefined;
|
|
196
216
|
size?: number | undefined;
|
|
197
|
-
|
|
217
|
+
sslUrl?: string | undefined;
|
|
218
|
+
resultId?: string | undefined;
|
|
198
219
|
assemblyId: string;
|
|
199
220
|
raw: any;
|
|
200
221
|
stepName: string;
|
|
201
222
|
createdAt: number;
|
|
202
223
|
}[]>>;
|
|
203
224
|
export declare const storeAssemblyMetadata: import("convex/server").RegisteredMutation<"public", {
|
|
204
|
-
fields?: any;
|
|
225
|
+
fields?: Record<string, any> | undefined;
|
|
205
226
|
userId?: string | undefined;
|
|
206
227
|
assemblyId: string;
|
|
207
228
|
}, Promise<{
|
|
208
229
|
userId: string | undefined;
|
|
209
|
-
fields: any;
|
|
230
|
+
fields: Record<string, any> | undefined;
|
|
210
231
|
_id: import("convex/values").GenericId<"assemblies">;
|
|
211
232
|
_creationTime: number;
|
|
212
233
|
status?: string | undefined;
|
|
@@ -215,12 +236,13 @@ export declare const storeAssemblyMetadata: import("convex/server").RegisteredMu
|
|
|
215
236
|
templateId?: string | undefined;
|
|
216
237
|
notifyUrl?: string | undefined;
|
|
217
238
|
numExpectedUploadFiles?: number | undefined;
|
|
218
|
-
uploads?: any;
|
|
219
|
-
results?: any;
|
|
239
|
+
uploads?: any[] | undefined;
|
|
240
|
+
results?: Record<string, any[]> | undefined;
|
|
220
241
|
error?: any;
|
|
221
242
|
raw?: any;
|
|
222
243
|
assemblyId: string;
|
|
223
244
|
createdAt: number;
|
|
224
245
|
updatedAt: number;
|
|
225
246
|
} | null>>;
|
|
247
|
+
export {};
|
|
226
248
|
//# sourceMappingURL=lib.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../src/component/lib.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../src/component/lib.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,KAAK,EAAK,MAAM,eAAe,CAAC;AAoB9C,KAAK,oBAAoB,GAAG;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AA8GF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yTAkBpB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAE/C,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;8JAY1B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE3D,eAAO,MAAM,kBAAkB;;;;;;wCAG7B,CAAC;AAaH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;4DAkEzB,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;iBA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