From 7749d8d904034844819448dfc33fcf55c716222d Mon Sep 17 00:00:00 2001 From: Valery Buchinsky Date: Fri, 15 Mar 2024 12:46:07 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=B7=EF=B8=8F=20[placeholder-pdf-lib]?= =?UTF-8?q?=20Either=20pdfDoc=20or=20pdfPage=20is=20required,=20not=20both?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dist/pdflibAddPlaceholder.d.ts | 13 +++++++++--- .../dist/pdflibAddPlaceholder.d.ts.map | 2 +- .../dist/pdflibAddPlaceholder.js | 20 ++++++++++++++++--- .../src/pdflibAddPlaceholder.js | 20 ++++++++++++++++--- 4 files changed, 45 insertions(+), 10 deletions(-) diff --git a/packages/placeholder-pdf-lib/dist/pdflibAddPlaceholder.d.ts b/packages/placeholder-pdf-lib/dist/pdflibAddPlaceholder.d.ts index b2603c6..5737c7a 100644 --- a/packages/placeholder-pdf-lib/dist/pdflibAddPlaceholder.d.ts +++ b/packages/placeholder-pdf-lib/dist/pdflibAddPlaceholder.d.ts @@ -1,9 +1,9 @@ export function pdflibAddPlaceholder({ pdfDoc, pdfPage, reason, contactInfo, name, location, signingTime, signatureLength, byteRangePlaceholder, subFilter, widgetRect, appName, }: InputType): void; export type PDFDocument = import('pdf-lib').PDFDocument; export type PDFPage = import('pdf-lib').PDFPage; -export type InputType = { - pdfDoc: PDFDocument; - pdfPage: PDFPage; +export type CommonInputType = { + pdfDoc?: PDFDocument; + pdfPage?: PDFPage; reason: string; contactInfo: string; name: string; @@ -24,4 +24,11 @@ export type InputType = { */ appName?: string; }; +export type DocInputType = { + pdfDoc: PDFDocument; +}; +export type PageInputType = { + pdfPage: PDFPage; +}; +export type InputType = CommonInputType & (DocInputType | PageInputType); //# sourceMappingURL=pdflibAddPlaceholder.d.ts.map \ No newline at end of file diff --git a/packages/placeholder-pdf-lib/dist/pdflibAddPlaceholder.d.ts.map b/packages/placeholder-pdf-lib/dist/pdflibAddPlaceholder.d.ts.map index 6ceaf8c..a675bad 100644 --- a/packages/placeholder-pdf-lib/dist/pdflibAddPlaceholder.d.ts.map +++ b/packages/placeholder-pdf-lib/dist/pdflibAddPlaceholder.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"pdflibAddPlaceholder.d.ts","sourceRoot":"","sources":["../src/pdflibAddPlaceholder.js"],"names":[],"mappings":"AA4CO,oLAHI,SAAS,GACP,IAAI,CAmHhB;0BAhJY,OAAO,SAAS,EAAE,WAAW;sBAI7B,OAAO,SAAS,EAAE,OAAO;;YAKxB,WAAW;aACX,OAAO;YACP,MAAM;iBACN,MAAM;UACN,MAAM;cACN,MAAM;kBACN,IAAI;sBACJ,MAAM;2BACN,MAAM;;;;gBACN,MAAM;;;;iBACN,MAAM,EAAE;;;;cACR,MAAM"} \ No newline at end of file +{"version":3,"file":"pdflibAddPlaceholder.d.ts","sourceRoot":"","sources":["../src/pdflibAddPlaceholder.js"],"names":[],"mappings":"AA0DO,oLAHI,SAAS,GACP,IAAI,CAmHhB;0BA9JY,OAAO,SAAS,EAAE,WAAW;sBAI7B,OAAO,SAAS,EAAE,OAAO;;aAKxB,WAAW;cACX,OAAO;YACP,MAAM;iBACN,MAAM;UACN,MAAM;cACN,MAAM;kBACN,IAAI;sBACJ,MAAM;2BACN,MAAM;;;;gBACN,MAAM;;;;iBACN,MAAM,EAAE;;;;cACR,MAAM;;;YAKP,WAAW;;;aAKX,OAAO;;wBAIR,eAAe,GAAG,CAAC,YAAY,GAAG,aAAa,CAAC"} \ No newline at end of file diff --git a/packages/placeholder-pdf-lib/dist/pdflibAddPlaceholder.js b/packages/placeholder-pdf-lib/dist/pdflibAddPlaceholder.js index 45a683a..9c87b66 100644 --- a/packages/placeholder-pdf-lib/dist/pdflibAddPlaceholder.js +++ b/packages/placeholder-pdf-lib/dist/pdflibAddPlaceholder.js @@ -15,9 +15,9 @@ var _pdfLib = require("pdf-lib"); */ /** - * @typedef {object} InputType - * @property {PDFDocument} pdfDoc - * @property {PDFPage} pdfPage + * @typedef {object} CommonInputType + * @property {PDFDocument} [pdfDoc] + * @property {PDFPage} [pdfPage] * @property {string} reason * @property {string} contactInfo * @property {string} name @@ -30,6 +30,20 @@ var _pdfLib = require("pdf-lib"); * @property {string} [appName] Name of the application generating the signature */ +/** +* @typedef {object} DocInputType +* @property {PDFDocument} pdfDoc +*/ + +/** +* @typedef {object} PageInputType +* @property {PDFPage} pdfPage +*/ + +/** +* @typedef {CommonInputType & (DocInputType | PageInputType)} InputType +*/ + /** * Adds a signature placeholder to a PDF-LIB PDFDocument. * diff --git a/packages/placeholder-pdf-lib/src/pdflibAddPlaceholder.js b/packages/placeholder-pdf-lib/src/pdflibAddPlaceholder.js index b213936..7758c9f 100644 --- a/packages/placeholder-pdf-lib/src/pdflibAddPlaceholder.js +++ b/packages/placeholder-pdf-lib/src/pdflibAddPlaceholder.js @@ -19,9 +19,9 @@ import { */ /** - * @typedef {object} InputType - * @property {PDFDocument} pdfDoc - * @property {PDFPage} pdfPage + * @typedef {object} CommonInputType + * @property {PDFDocument} [pdfDoc] + * @property {PDFPage} [pdfPage] * @property {string} reason * @property {string} contactInfo * @property {string} name @@ -34,6 +34,20 @@ import { * @property {string} [appName] Name of the application generating the signature */ +/** +* @typedef {object} DocInputType +* @property {PDFDocument} pdfDoc +*/ + +/** +* @typedef {object} PageInputType +* @property {PDFPage} pdfPage +*/ + +/** +* @typedef {CommonInputType & (DocInputType | PageInputType)} InputType +*/ + /** * Adds a signature placeholder to a PDF-LIB PDFDocument. *