Skip to content

Commit 13571c2

Browse files
committed
fix: handle applyInstantJson file refs and add build example
1 parent 1b21976 commit 13571c2

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

src/dws/build.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ async function processActionFileReferences(action: Action): Promise<FileReferenc
8888
const fileReference = await processFileReference(action.file)
8989
action.file = fileReference.key
9090
return fileReference
91+
} else if (action.type === 'applyInstantJson' && 'file' in action && typeof action.file === 'string') {
92+
const fileReference = await processFileReference(action.file)
93+
action.file = fileReference.key
94+
return fileReference
9195
}
9296

9397
// No need to parse files for the other actions

tests/build-api-examples.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,27 @@ export const applyXfdfExample: BuildAPIArgs = {
290290
outputPath: 'output_pdf.pdf',
291291
}
292292

293+
// Example with applying Instant JSON
294+
export const applyInstantJsonExample: BuildAPIArgs = {
295+
instructions: {
296+
parts: [
297+
{
298+
file: 'example.pdf',
299+
},
300+
],
301+
actions: [
302+
{
303+
type: 'applyInstantJson',
304+
file: 'example.json',
305+
},
306+
],
307+
output: {
308+
type: 'pdf',
309+
},
310+
},
311+
outputPath: 'output_pdf.pdf',
312+
}
313+
293314
// Example with redactions using preset
294315
export const redactionsPresetExample: BuildAPIArgs = {
295316
instructions: {

0 commit comments

Comments
 (0)