@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
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transloadit/convex",
|
|
3
3
|
"description": "Transloadit component for Convex",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "yarn@4.5.0",
|
|
7
7
|
"repository": {
|
|
@@ -22,18 +22,27 @@
|
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "tsc -p tsconfig.build.json && node scripts/emit-package-json.ts",
|
|
24
24
|
"build:watch": "tsc -p tsconfig.build.json --watch",
|
|
25
|
+
"changeset": "changeset",
|
|
26
|
+
"changeset:version": "changeset version",
|
|
25
27
|
"typecheck": "tsc --noEmit",
|
|
26
28
|
"test": "vitest run --typecheck",
|
|
27
29
|
"test:watch": "vitest --typecheck",
|
|
30
|
+
"verify": "yarn check && yarn verify:local",
|
|
31
|
+
"verify:local": "node scripts/verify.ts --mode local",
|
|
32
|
+
"verify:cloud": "node scripts/verify.ts --mode cloud",
|
|
33
|
+
"verify:real": "yarn verify:cloud",
|
|
34
|
+
"verify:browser": "yarn verify:local",
|
|
35
|
+
"verify:convex": "yarn verify:cloud",
|
|
36
|
+
"deploy:cloud": "node scripts/deploy-cloud.ts",
|
|
37
|
+
"example:dev": "yarn build && node ./node_modules/next/dist/bin/next dev example",
|
|
38
|
+
"example:build": "yarn build && node ./node_modules/next/dist/bin/next build example",
|
|
39
|
+
"example:start": "yarn build && node ./node_modules/next/dist/bin/next start example",
|
|
28
40
|
"lint": "biome check .",
|
|
29
41
|
"format": "biome format . --write",
|
|
30
42
|
"check": "yarn format && yarn lint && yarn typecheck && yarn test",
|
|
31
43
|
"prepack": "yarn build",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"tunnel": "node scripts/start-webhook-tunnel.ts",
|
|
35
|
-
"qa:full": "dotenv -q -- node scripts/qa-full.ts",
|
|
36
|
-
"qa:full:verbose": "dotenv -q -- node scripts/qa-full.ts --verbose"
|
|
44
|
+
"template:ensure": "node scripts/ensure-template.ts",
|
|
45
|
+
"tunnel": "node scripts/start-webhook-tunnel.ts"
|
|
37
46
|
},
|
|
38
47
|
"files": [
|
|
39
48
|
"dist",
|
|
@@ -56,10 +65,18 @@
|
|
|
56
65
|
"types": "./dist/component/lib.d.ts",
|
|
57
66
|
"default": "./dist/component/lib.js"
|
|
58
67
|
},
|
|
68
|
+
"./test": {
|
|
69
|
+
"types": "./dist/test/index.d.ts",
|
|
70
|
+
"default": "./dist/test/index.js"
|
|
71
|
+
},
|
|
59
72
|
"./convex.config": {
|
|
60
73
|
"@convex-dev/component-source": "./src/component/convex.config.ts",
|
|
61
74
|
"types": "./dist/component/convex.config.d.ts",
|
|
62
75
|
"default": "./dist/component/convex.config.js"
|
|
76
|
+
},
|
|
77
|
+
"./debug": {
|
|
78
|
+
"types": "./dist/debug/index.d.ts",
|
|
79
|
+
"default": "./dist/debug/index.js"
|
|
63
80
|
}
|
|
64
81
|
},
|
|
65
82
|
"peerDependencies": {
|
|
@@ -72,19 +89,40 @@
|
|
|
72
89
|
}
|
|
73
90
|
},
|
|
74
91
|
"dependencies": {
|
|
75
|
-
"
|
|
92
|
+
"@transloadit/utils": "^4.1.9",
|
|
93
|
+
"@transloadit/zod": "^4.1.9",
|
|
94
|
+
"tus-js-client": "^4.3.1"
|
|
76
95
|
},
|
|
77
96
|
"devDependencies": {
|
|
78
|
-
"@
|
|
97
|
+
"@auth/core": "^0.37.0",
|
|
98
|
+
"@biomejs/biome": "^2.3.11",
|
|
99
|
+
"@changesets/cli": "^2.27.12",
|
|
100
|
+
"@convex-dev/auth": "^0.0.90",
|
|
79
101
|
"@edge-runtime/vm": "^5.0.0",
|
|
80
|
-
"@
|
|
81
|
-
"@
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
102
|
+
"@playwright/test": "^1.57.0",
|
|
103
|
+
"@testing-library/dom": "^10.4.1",
|
|
104
|
+
"@testing-library/react": "^16.3.0",
|
|
105
|
+
"@types/node": "^25.0.8",
|
|
106
|
+
"@types/react": "^19.2.8",
|
|
107
|
+
"@types/react-dom": "^19",
|
|
108
|
+
"@uppy/core": "^5.2.0",
|
|
109
|
+
"@uppy/dashboard": "^5.1.0",
|
|
110
|
+
"@uppy/react": "^5.1.1",
|
|
111
|
+
"@uppy/tus": "^5.1.0",
|
|
112
|
+
"convex": "^1.31.4",
|
|
113
|
+
"convex-test": "^0.0.41",
|
|
114
|
+
"dotenv": "^17.2.3",
|
|
115
|
+
"esbuild": "^0.27.2",
|
|
116
|
+
"jsdom": "^26.1.0",
|
|
117
|
+
"next": "^16.1.3",
|
|
118
|
+
"react": "^19.2.3",
|
|
119
|
+
"react-dom": "^19.2.3",
|
|
85
120
|
"typescript": "^5.9.3",
|
|
86
|
-
"vitest": "
|
|
121
|
+
"vitest": "^4.0.17"
|
|
122
|
+
},
|
|
123
|
+
"resolutions": {
|
|
124
|
+
"preact": "10.28.2"
|
|
87
125
|
},
|
|
88
126
|
"types": "./dist/client/index.d.ts",
|
|
89
127
|
"module": "./dist/client/index.js"
|
|
90
|
-
}
|
|
128
|
+
}
|
package/src/client/index.ts
CHANGED
|
@@ -1,7 +1,72 @@
|
|
|
1
|
+
import type { AssemblyStatus } from "@transloadit/zod/v3/assemblyStatus";
|
|
2
|
+
import type { AssemblyInstructionsInput } from "@transloadit/zod/v3/template";
|
|
1
3
|
import { actionGeneric, mutationGeneric, queryGeneric } from "convex/server";
|
|
2
4
|
import { type Infer, v } from "convex/values";
|
|
3
|
-
import type { ComponentApi } from "../component/_generated/component.
|
|
4
|
-
import type { RunActionCtx, RunMutationCtx, RunQueryCtx } from "./types.
|
|
5
|
+
import type { ComponentApi } from "../component/_generated/component.ts";
|
|
6
|
+
import type { RunActionCtx, RunMutationCtx, RunQueryCtx } from "./types.ts";
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
assemblyStatusErrCodeSchema,
|
|
10
|
+
assemblyStatusOkCodeSchema,
|
|
11
|
+
assemblyStatusResultsSchema,
|
|
12
|
+
assemblyStatusSchema,
|
|
13
|
+
isAssemblyBusy,
|
|
14
|
+
isAssemblyBusyStatus,
|
|
15
|
+
isAssemblyErrorStatus,
|
|
16
|
+
isAssemblyOkStatus,
|
|
17
|
+
isAssemblySysError,
|
|
18
|
+
isAssemblyTerminal,
|
|
19
|
+
isAssemblyTerminalError,
|
|
20
|
+
isAssemblyTerminalOk,
|
|
21
|
+
isAssemblyTerminalOkStatus,
|
|
22
|
+
} from "@transloadit/zod/v3/assemblyStatus";
|
|
23
|
+
export type {
|
|
24
|
+
ParsedWebhookRequest,
|
|
25
|
+
VerifiedWebhookRequest,
|
|
26
|
+
WebhookActionArgs,
|
|
27
|
+
} from "../component/apiUtils.ts";
|
|
28
|
+
export {
|
|
29
|
+
buildWebhookQueueArgs,
|
|
30
|
+
handleWebhookRequest,
|
|
31
|
+
parseAndVerifyTransloaditWebhook,
|
|
32
|
+
parseTransloaditWebhook,
|
|
33
|
+
} from "../component/apiUtils.ts";
|
|
34
|
+
export type {
|
|
35
|
+
NormalizedAssemblyUrls,
|
|
36
|
+
TransloaditAssembly,
|
|
37
|
+
} from "../shared/assemblyUrls.ts";
|
|
38
|
+
export {
|
|
39
|
+
ASSEMBLY_STATUS_COMPLETED,
|
|
40
|
+
ASSEMBLY_STATUS_UPLOADING,
|
|
41
|
+
getAssemblyStage,
|
|
42
|
+
isAssemblyCompletedStatus,
|
|
43
|
+
isAssemblyUploadingStatus,
|
|
44
|
+
normalizeAssemblyUploadUrls,
|
|
45
|
+
parseAssemblyFields,
|
|
46
|
+
parseAssemblyResults,
|
|
47
|
+
parseAssemblyStatus,
|
|
48
|
+
parseAssemblyUrls,
|
|
49
|
+
} from "../shared/assemblyUrls.ts";
|
|
50
|
+
export { pollAssembly } from "../shared/pollAssembly.ts";
|
|
51
|
+
export type {
|
|
52
|
+
ImageResizeResult,
|
|
53
|
+
ResultByRobot,
|
|
54
|
+
ResultForRobot,
|
|
55
|
+
StoreResult,
|
|
56
|
+
TransloaditResult,
|
|
57
|
+
VideoEncodeResult,
|
|
58
|
+
VideoThumbsResult,
|
|
59
|
+
} from "../shared/resultTypes.ts";
|
|
60
|
+
export {
|
|
61
|
+
getResultOriginalKey,
|
|
62
|
+
getResultUrl,
|
|
63
|
+
} from "../shared/resultUtils.ts";
|
|
64
|
+
export type {
|
|
65
|
+
TusMetadataOptions,
|
|
66
|
+
TusUploadConfig,
|
|
67
|
+
} from "../shared/tusUpload.ts";
|
|
68
|
+
export { buildTusUploadConfig } from "../shared/tusUpload.ts";
|
|
69
|
+
export type { AssemblyStatus, AssemblyInstructionsInput };
|
|
5
70
|
|
|
6
71
|
export interface TransloaditConfig {
|
|
7
72
|
authKey: string;
|
|
@@ -30,9 +95,9 @@ export const vAssemblyResponse = v.object({
|
|
|
30
95
|
templateId: v.optional(v.string()),
|
|
31
96
|
notifyUrl: v.optional(v.string()),
|
|
32
97
|
numExpectedUploadFiles: v.optional(v.number()),
|
|
33
|
-
fields: v.optional(v.any()),
|
|
34
|
-
uploads: v.optional(v.any()),
|
|
35
|
-
results: v.optional(v.any()),
|
|
98
|
+
fields: v.optional(v.record(v.string(), v.any())),
|
|
99
|
+
uploads: v.optional(v.array(v.any())),
|
|
100
|
+
results: v.optional(v.record(v.string(), v.array(v.any()))),
|
|
36
101
|
error: v.optional(v.any()),
|
|
37
102
|
raw: v.optional(v.any()),
|
|
38
103
|
createdAt: v.number(),
|
|
@@ -60,15 +125,18 @@ export type AssemblyResultResponse = Infer<typeof vAssemblyResultResponse>;
|
|
|
60
125
|
|
|
61
126
|
export const vCreateAssemblyArgs = v.object({
|
|
62
127
|
templateId: v.optional(v.string()),
|
|
63
|
-
steps: v.optional(v.any()),
|
|
64
|
-
fields: v.optional(v.any()),
|
|
128
|
+
steps: v.optional(v.record(v.string(), v.any())),
|
|
129
|
+
fields: v.optional(v.record(v.string(), v.any())),
|
|
65
130
|
notifyUrl: v.optional(v.string()),
|
|
66
131
|
numExpectedUploadFiles: v.optional(v.number()),
|
|
67
132
|
expires: v.optional(v.string()),
|
|
68
|
-
additionalParams: v.optional(v.any()),
|
|
133
|
+
additionalParams: v.optional(v.record(v.string(), v.any())),
|
|
69
134
|
userId: v.optional(v.string()),
|
|
70
135
|
});
|
|
71
136
|
|
|
137
|
+
/**
|
|
138
|
+
* @deprecated Prefer `makeTransloaditAPI` or `Transloadit` for new code.
|
|
139
|
+
*/
|
|
72
140
|
export class TransloaditClient {
|
|
73
141
|
declare component: TransloaditComponent;
|
|
74
142
|
declare config: TransloaditConfig;
|
|
@@ -79,12 +147,8 @@ export class TransloaditClient {
|
|
|
79
147
|
) {
|
|
80
148
|
this.component = component;
|
|
81
149
|
this.config = {
|
|
82
|
-
authKey:
|
|
83
|
-
|
|
84
|
-
requireEnv(["TRANSLOADIT_AUTH_KEY", "TRANSLOADIT_KEY"]),
|
|
85
|
-
authSecret:
|
|
86
|
-
config?.authSecret ??
|
|
87
|
-
requireEnv(["TRANSLOADIT_AUTH_SECRET", "TRANSLOADIT_SECRET"]),
|
|
150
|
+
authKey: config?.authKey ?? requireEnv(["TRANSLOADIT_KEY"]),
|
|
151
|
+
authSecret: config?.authSecret ?? requireEnv(["TRANSLOADIT_SECRET"]),
|
|
88
152
|
};
|
|
89
153
|
}
|
|
90
154
|
|
|
@@ -102,17 +166,22 @@ export class TransloaditClient {
|
|
|
102
166
|
});
|
|
103
167
|
}
|
|
104
168
|
|
|
105
|
-
async
|
|
169
|
+
async handleWebhook(
|
|
106
170
|
ctx: RunActionCtx,
|
|
107
|
-
args:
|
|
171
|
+
args: {
|
|
172
|
+
payload: unknown;
|
|
173
|
+
rawBody?: string;
|
|
174
|
+
signature?: string;
|
|
175
|
+
verifySignature?: boolean;
|
|
176
|
+
},
|
|
108
177
|
) {
|
|
109
|
-
return ctx.runAction(this.component.lib.
|
|
178
|
+
return ctx.runAction(this.component.lib.handleWebhook, {
|
|
110
179
|
...args,
|
|
111
|
-
config: this.config,
|
|
180
|
+
config: { authSecret: this.config.authSecret },
|
|
112
181
|
});
|
|
113
182
|
}
|
|
114
183
|
|
|
115
|
-
async
|
|
184
|
+
async queueWebhook(
|
|
116
185
|
ctx: RunActionCtx,
|
|
117
186
|
args: {
|
|
118
187
|
payload: unknown;
|
|
@@ -121,12 +190,19 @@ export class TransloaditClient {
|
|
|
121
190
|
verifySignature?: boolean;
|
|
122
191
|
},
|
|
123
192
|
) {
|
|
124
|
-
return ctx.runAction(this.component.lib.
|
|
193
|
+
return ctx.runAction(this.component.lib.queueWebhook, {
|
|
125
194
|
...args,
|
|
126
195
|
config: { authSecret: this.config.authSecret },
|
|
127
196
|
});
|
|
128
197
|
}
|
|
129
198
|
|
|
199
|
+
async refreshAssembly(ctx: RunActionCtx, assemblyId: string) {
|
|
200
|
+
return ctx.runAction(this.component.lib.refreshAssembly, {
|
|
201
|
+
assemblyId,
|
|
202
|
+
config: this.config,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
|
|
130
206
|
async getAssemblyStatus(ctx: RunQueryCtx, assemblyId: string) {
|
|
131
207
|
return ctx.runQuery(this.component.lib.getAssemblyStatus, { assemblyId });
|
|
132
208
|
}
|
|
@@ -157,17 +233,25 @@ export class TransloaditClient {
|
|
|
157
233
|
}
|
|
158
234
|
}
|
|
159
235
|
|
|
236
|
+
export class Transloadit extends TransloaditClient {}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* @deprecated Prefer `new Transloadit(...)` or `makeTransloaditAPI(...)`.
|
|
240
|
+
*/
|
|
241
|
+
export function createTransloadit(
|
|
242
|
+
component: TransloaditComponent,
|
|
243
|
+
config?: Partial<TransloaditConfig>,
|
|
244
|
+
) {
|
|
245
|
+
return new Transloadit(component, config);
|
|
246
|
+
}
|
|
247
|
+
|
|
160
248
|
export function makeTransloaditAPI(
|
|
161
249
|
component: TransloaditComponent,
|
|
162
250
|
config?: Partial<TransloaditConfig>,
|
|
163
251
|
) {
|
|
164
252
|
const resolvedConfig: TransloaditConfig = {
|
|
165
|
-
authKey:
|
|
166
|
-
|
|
167
|
-
requireEnv(["TRANSLOADIT_AUTH_KEY", "TRANSLOADIT_KEY"]),
|
|
168
|
-
authSecret:
|
|
169
|
-
config?.authSecret ??
|
|
170
|
-
requireEnv(["TRANSLOADIT_AUTH_SECRET", "TRANSLOADIT_SECRET"]),
|
|
253
|
+
authKey: config?.authKey ?? requireEnv(["TRANSLOADIT_KEY"]),
|
|
254
|
+
authSecret: config?.authSecret ?? requireEnv(["TRANSLOADIT_SECRET"]),
|
|
171
255
|
};
|
|
172
256
|
|
|
173
257
|
return {
|
|
@@ -184,38 +268,57 @@ export function makeTransloaditAPI(
|
|
|
184
268
|
});
|
|
185
269
|
},
|
|
186
270
|
}),
|
|
187
|
-
|
|
188
|
-
args:
|
|
271
|
+
handleWebhook: actionGeneric({
|
|
272
|
+
args: {
|
|
273
|
+
payload: v.any(),
|
|
274
|
+
rawBody: v.optional(v.string()),
|
|
275
|
+
signature: v.optional(v.string()),
|
|
276
|
+
},
|
|
189
277
|
returns: v.object({
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
278
|
+
assemblyId: v.string(),
|
|
279
|
+
resultCount: v.number(),
|
|
280
|
+
ok: v.optional(v.string()),
|
|
281
|
+
status: v.optional(v.string()),
|
|
193
282
|
}),
|
|
194
283
|
handler: async (ctx, args) => {
|
|
195
|
-
return ctx.runAction(component.lib.
|
|
284
|
+
return ctx.runAction(component.lib.handleWebhook, {
|
|
196
285
|
...args,
|
|
197
|
-
config: resolvedConfig,
|
|
286
|
+
config: { authSecret: resolvedConfig.authSecret },
|
|
198
287
|
});
|
|
199
288
|
},
|
|
200
289
|
}),
|
|
201
|
-
|
|
290
|
+
queueWebhook: actionGeneric({
|
|
202
291
|
args: {
|
|
203
292
|
payload: v.any(),
|
|
204
293
|
rawBody: v.optional(v.string()),
|
|
205
294
|
signature: v.optional(v.string()),
|
|
206
|
-
verifySignature: v.optional(v.boolean()),
|
|
207
295
|
},
|
|
208
296
|
returns: v.object({
|
|
209
297
|
assemblyId: v.string(),
|
|
210
|
-
|
|
298
|
+
queued: v.boolean(),
|
|
211
299
|
}),
|
|
212
300
|
handler: async (ctx, args) => {
|
|
213
|
-
return ctx.runAction(component.lib.
|
|
301
|
+
return ctx.runAction(component.lib.queueWebhook, {
|
|
214
302
|
...args,
|
|
215
303
|
config: { authSecret: resolvedConfig.authSecret },
|
|
216
304
|
});
|
|
217
305
|
},
|
|
218
306
|
}),
|
|
307
|
+
refreshAssembly: actionGeneric({
|
|
308
|
+
args: { assemblyId: v.string() },
|
|
309
|
+
returns: v.object({
|
|
310
|
+
assemblyId: v.string(),
|
|
311
|
+
resultCount: v.number(),
|
|
312
|
+
ok: v.optional(v.string()),
|
|
313
|
+
status: v.optional(v.string()),
|
|
314
|
+
}),
|
|
315
|
+
handler: async (ctx, args) => {
|
|
316
|
+
return ctx.runAction(component.lib.refreshAssembly, {
|
|
317
|
+
...args,
|
|
318
|
+
config: resolvedConfig,
|
|
319
|
+
});
|
|
320
|
+
},
|
|
321
|
+
}),
|
|
219
322
|
getAssemblyStatus: queryGeneric({
|
|
220
323
|
args: { assemblyId: v.string() },
|
|
221
324
|
returns: v.union(vAssemblyResponse, v.null()),
|
|
@@ -249,7 +352,7 @@ export function makeTransloaditAPI(
|
|
|
249
352
|
args: {
|
|
250
353
|
assemblyId: v.string(),
|
|
251
354
|
userId: v.optional(v.string()),
|
|
252
|
-
fields: v.optional(v.any()),
|
|
355
|
+
fields: v.optional(v.record(v.string(), v.any())),
|
|
253
356
|
},
|
|
254
357
|
returns: v.union(vAssemblyResponse, v.null()),
|
|
255
358
|
handler: async (ctx, args) => {
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type * as apiUtils from "../apiUtils.
|
|
12
|
-
import type * as lib from "../lib.
|
|
11
|
+
import type * as apiUtils from "../apiUtils.ts";
|
|
12
|
+
import type * as lib from "../lib.ts";
|
|
13
13
|
|
|
14
14
|
import type { ApiFromModules, FilterApi, FunctionReference } from "convex/server";
|
|
15
15
|
import { anyApi, componentsGeneric } from "convex/server";
|
|
@@ -60,24 +60,43 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
60
60
|
{ assemblyId: string; data: any },
|
|
61
61
|
Name
|
|
62
62
|
>;
|
|
63
|
-
|
|
63
|
+
handleWebhook: FunctionReference<
|
|
64
64
|
"action",
|
|
65
65
|
"internal",
|
|
66
66
|
{
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
payload: any;
|
|
68
|
+
rawBody?: string;
|
|
69
|
+
signature?: string;
|
|
70
|
+
verifySignature?: boolean;
|
|
71
|
+
config?: { authSecret: string };
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
assemblyId: string;
|
|
75
|
+
resultCount: number;
|
|
76
|
+
ok?: string;
|
|
77
|
+
status?: string;
|
|
76
78
|
},
|
|
77
|
-
{ params: string; signature: string; url: string },
|
|
78
79
|
Name
|
|
79
80
|
>;
|
|
80
|
-
|
|
81
|
+
processWebhook: FunctionReference<
|
|
82
|
+
"action",
|
|
83
|
+
"internal",
|
|
84
|
+
{
|
|
85
|
+
payload: any;
|
|
86
|
+
rawBody?: string;
|
|
87
|
+
signature?: string;
|
|
88
|
+
verifySignature?: boolean;
|
|
89
|
+
authSecret?: string;
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
assemblyId: string;
|
|
93
|
+
resultCount: number;
|
|
94
|
+
ok?: string;
|
|
95
|
+
status?: string;
|
|
96
|
+
},
|
|
97
|
+
Name
|
|
98
|
+
>;
|
|
99
|
+
queueWebhook: FunctionReference<
|
|
81
100
|
"action",
|
|
82
101
|
"internal",
|
|
83
102
|
{
|
|
@@ -87,7 +106,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
87
106
|
verifySignature?: boolean;
|
|
88
107
|
config?: { authSecret: string };
|
|
89
108
|
},
|
|
90
|
-
{ assemblyId: string;
|
|
109
|
+
{ assemblyId: string; queued: boolean },
|
|
110
|
+
Name
|
|
111
|
+
>;
|
|
112
|
+
refreshAssembly: FunctionReference<
|
|
113
|
+
"action",
|
|
114
|
+
"internal",
|
|
115
|
+
{ assemblyId: string; config?: { authKey: string; authSecret: string } },
|
|
116
|
+
{
|
|
117
|
+
assemblyId: string;
|
|
118
|
+
resultCount: number;
|
|
119
|
+
ok?: string;
|
|
120
|
+
status?: string;
|
|
121
|
+
},
|
|
91
122
|
Name
|
|
92
123
|
>;
|
|
93
124
|
getAssemblyStatus: FunctionReference<
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
internalMutationGeneric,
|
|
29
29
|
internalQueryGeneric,
|
|
30
30
|
} from "convex/server";
|
|
31
|
-
import type { DataModel } from "./dataModel.
|
|
31
|
+
import type { DataModel } from "./dataModel.ts";
|
|
32
32
|
|
|
33
33
|
export const query: QueryBuilder<DataModel, "public"> = queryGeneric;
|
|
34
34
|
|