@pdfme/generator 3.1.5-dev.7 → 3.1.5-dev.9

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.
Files changed (33) hide show
  1. package/dist/cjs/__tests__/assets/templates/index.js +1 -0
  2. package/dist/cjs/__tests__/assets/templates/index.js.map +1 -1
  3. package/dist/cjs/__tests__/integration1.test.js +2 -1
  4. package/dist/cjs/__tests__/integration1.test.js.map +1 -1
  5. package/dist/cjs/__tests__/integration2.test.js +2 -1
  6. package/dist/cjs/__tests__/integration2.test.js.map +1 -1
  7. package/dist/cjs/__tests__/integration3.test.js +4 -3
  8. package/dist/cjs/__tests__/integration3.test.js.map +1 -1
  9. package/dist/cjs/__tests__/integration4.test.js +45 -0
  10. package/dist/cjs/__tests__/integration4.test.js.map +1 -0
  11. package/dist/cjs/src/generate.js +3 -7
  12. package/dist/cjs/src/generate.js.map +1 -1
  13. package/dist/cjs/src/helper.js +8 -3
  14. package/dist/cjs/src/helper.js.map +1 -1
  15. package/dist/esm/__tests__/assets/templates/index.js +1 -0
  16. package/dist/esm/__tests__/assets/templates/index.js.map +1 -1
  17. package/dist/esm/__tests__/integration1.test.js +2 -1
  18. package/dist/esm/__tests__/integration1.test.js.map +1 -1
  19. package/dist/esm/__tests__/integration2.test.js +2 -1
  20. package/dist/esm/__tests__/integration2.test.js.map +1 -1
  21. package/dist/esm/__tests__/integration3.test.js +5 -4
  22. package/dist/esm/__tests__/integration3.test.js.map +1 -1
  23. package/dist/esm/__tests__/integration4.test.js +40 -0
  24. package/dist/esm/__tests__/integration4.test.js.map +1 -0
  25. package/dist/esm/src/generate.js +3 -7
  26. package/dist/esm/src/generate.js.map +1 -1
  27. package/dist/esm/src/helper.js +8 -3
  28. package/dist/esm/src/helper.js.map +1 -1
  29. package/dist/types/__tests__/integration4.test.d.ts +1 -0
  30. package/dist/types/src/helper.d.ts +1 -0
  31. package/package.json +1 -1
  32. package/src/generate.ts +4 -8
  33. package/src/helper.ts +12 -3
@@ -83,6 +83,7 @@ exports.business = {
83
83
  履歴書,
84
84
  労働条件通知書,
85
85
  };
86
+ // These tests are slower, so we allow more time for them to pass
86
87
  exports.textType = {
87
88
  dynamicFontSizeHorizontal,
88
89
  dynamicFontSizeVertical,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../__tests__/assets/templates/index.ts"],"names":[],"mappings":";;;AAEA,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAa,CAAC;AACpD,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAa,CAAC;AAC1D,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAa,CAAC;AAC1D,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAa,CAAC;AAChD,MAAM,UAAU,GAAG,OAAO,CAAC,mBAAmB,CAAa,CAAC;AAC5D,MAAM,cAAc,GAAG,OAAO,CAAC,uBAAuB,CAAa,CAAC;AACpE,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAa,CAAC;AACtD,MAAM,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAa,CAAC;AAC9D,MAAM,UAAU,GAAG,OAAO,CAAC,mBAAmB,CAAa,CAAC;AAC5D,MAAM,UAAU,GAAG,OAAO,CAAC,mBAAmB,CAAa,CAAC;AAC5D,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAa,CAAC;AACxD,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAa,CAAC;AACpD,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAa,CAAC;AACpD,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAa,CAAC;AACpD,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAa,CAAC;AACxD,MAAM,UAAU,GAAG,OAAO,CAAC,mBAAmB,CAAa,CAAC;AAC5D,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAa,CAAC;AACpD,MAAM,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AAa,CAAC;AAChF,MAAM,uBAAuB,GAAG,OAAO,CAAC,gCAAgC,CAAa,CAAC;AACtF,MAAM,uBAAuB,GAAG,OAAO,CAAC,gCAAgC,CAAa,CAAC;AACtF,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAa,CAAC;AAEnC,QAAA,KAAK,GAAG;IACnB,IAAI;IACJ,UAAU;IACV,UAAU;IACV,WAAW;IACX,UAAU;IACV,cAAc;IACd,QAAQ;IACR,MAAM;IACN,SAAS;IACT,SAAS;IACT,OAAO;IACP,MAAM;IACN,WAAW;IACX,QAAQ;IACR,UAAU;CACX,CAAC;AAEW,QAAA,QAAQ,GAAG;IACtB,MAAM;IACN,MAAM;IACN,MAAM;CACP,CAAC;AAEW,QAAA,OAAO,GAAG;IACrB,cAAc;IACd,cAAc;IACd,iBAAiB;IACjB,iBAAiB;IACjB,QAAQ;CACT,CAAC;AAEW,QAAA,QAAQ,GAAG;IACtB,GAAG;IACH,KAAK;IACL,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,KAAK;IACL,GAAG;IACH,OAAO;CACR,CAAC;AAEW,QAAA,QAAQ,GAAG;IACtB,yBAAyB;IACzB,uBAAuB;IACvB,oBAAoB;IACpB,uBAAuB;IACvB,uBAAuB;CACxB,CAAC;AAEW,QAAA,KAAK,GAAG;IACnB,IAAI;IACJ,WAAW;IACX,SAAS;IACT,UAAU;IACV,QAAQ;CACT,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../__tests__/assets/templates/index.ts"],"names":[],"mappings":";;;AAEA,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAa,CAAC;AACpD,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAa,CAAC;AAC1D,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAa,CAAC;AAC1D,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAa,CAAC;AAChD,MAAM,UAAU,GAAG,OAAO,CAAC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,iBAAiB;IACjB,QAAQ;CACT,CAAC;AAEW,QAAA,QAAQ,GAAG;IACtB,GAAG;IACH,KAAK;IACL,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,KAAK;IACL,GAAG;IACH,OAAO;CACR,CAAC;AAEF,iEAAiE;AACpD,QAAA,QAAQ,GAAG;IACtB,yBAAyB;IACzB,uBAAuB;IACvB,oBAAoB;IACpB,uBAAuB;IACvB,uBAAuB;CACxB,CAAC;AAEW,QAAA,KAAK,GAAG;IACnB,IAAI;IACJ,WAAW;IACX,SAAS;IACT,UAAU;IACV,QAAQ;CACT,CAAC"}
@@ -30,7 +30,8 @@ describe('generate integration test(label, envelope)', () => {
30
30
  options: { font },
31
31
  });
32
32
  const hrend = process.hrtime(hrstart);
33
- expect(hrend[0]).toBeLessThanOrEqual(1);
33
+ const execSeconds = hrend[0] + hrend[1] / 1000000000;
34
+ expect(execSeconds).toBeLessThan(1.5);
34
35
  const tmpFile = (0, utils_1.getPdfTmpPath)(`${key}.pdf`);
35
36
  const assertFile = (0, utils_1.getPdfAssertPath)(`${key}.pdf`);
36
37
  (0, fs_1.writeFileSync)(tmpFile, pdf);
@@ -1 +1 @@
1
- {"version":3,"file":"integration1.test.js","sourceRoot":"","sources":["../../../__tests__/integration1.test.ts"],"names":[],"mappings":";;;;;AAAA,2BAAmC;AACnC,+DAAuC;AACvC,kDAAqD;AACrD,4CAA6C;AAC7C,mCAA2E;AAE3E,QAAQ,CAAC,4CAA4C,EAAE,GAAG,EAAE;IAC1D,QAAQ,CAAC,IAAI,CAAC,CAAC,iBAAK,EAAE,oBAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE,EAAE;QACtD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;YAC1C,MA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rend = process.hrtime(hrstart);
33
- expect(hrend[0]).toBeLessThanOrEqual(1);
33
+ const execSeconds = hrend[0] + hrend[1] / 1000000000;
34
+ expect(execSeconds).toBeLessThan(2);
34
35
  const tmpFile = (0, utils_1.getPdfTmpPath)(`${key}.pdf`);
35
36
  const assertFile = (0, utils_1.getPdfAssertPath)(`${key}.pdf`);
36
37
  (0, fs_1.writeFileSync)(tmpFile, pdf);
@@ -1 +1 @@
1
- {"version":3,"file":"integration2.test.js","sourceRoot":"","sources":["../../../__tests__/integration2.test.ts"],"names":[],"mappings":";;;;;AAAA,2BAAmC;AACnC,+DAAuC;AACvC,kDAAuD;AACvD,4CAAuD;AACvD,mCAA2E;AAE3E,QAAQ,CAAC,8CAA8C,EAAE,GAAG,EAAE;IAC5D,QAAQ,CAAC,IAAI,CAAC,CAAC,mBAAO,EAAE,oBAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE,EAAE;QACxD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;YAC1C,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YAEnC,wCAAwC;YACxC,IAAI,CAAC,YAAY,GAAG,EAAE,EAAE,KAAK,IAAI,EAAE;gBACjC,MAAM,MAAM,GAAG,QAAQ,CAAC,UAAW,CAAC;gBAEpC,MAAM,IAAI,GAAG,IAAA,eAAO,GAAE,CAAC;gBACvB,IAAI,CAAC,cAAc,CAAC,QAAQ,GAAG,KAAK,CAAC;gBACrC,IAAI,CAAC,eAAe,CAAC,QAAQ,GAAG,KAAK,CAAC;gBACtC,IAAI,CAAC,qBAAqB,CAAC,CAAC,QAAQ,GAAG,KAAK,CAAC;gBAC7C,aAAa;gBACb,IAAI,CAAC,QAAQ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AAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC;gBACrD,MAAM,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;gBAEpC,MAAM,OAAO,GAAG,IAAA,qBAAa,EAAC,GAAG,GAAG,MAAM,CAAC,CAAC;gBAC5C,MAAM,UAAU,GAAG,IAAA,wBAAgB,EAAC,GAAG,GAAG,MAAM,CAAC,CAAC;gBAElD,IAAA,kBAAa,EAAC,OAAO,EAAE,GAAG,CAAC,CAAC;gBAC5B,MAAM,GAAG,GAAQ,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,IAAA,cAAM,EAAC,OAAO,CAAC,EAAE,IAAA,cAAM,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC;gBAC1E,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC;gBACnB,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -8,8 +8,8 @@ const generate_1 = __importDefault(require("../src/generate"));
8
8
  const templates_1 = require("./assets/templates");
9
9
  const schemas_1 = require("@pdfme/schemas");
10
10
  const utils_1 = require("./utils");
11
- describe('generate integration test(textType, other)', () => {
12
- describe.each([templates_1.textType, templates_1.other])('%s', (templateData) => {
11
+ describe('generate integration test(other)', () => {
12
+ describe.each([templates_1.other])('%s', (templateData) => {
13
13
  const entries = Object.entries(templateData);
14
14
  for (let l = 0; l < entries.length; l += 1) {
15
15
  const [key, template] = entries[l];
@@ -30,7 +30,8 @@ describe('generate integration test(textType, other)', () => {
30
30
  options: { font },
31
31
  });
32
32
  const hrend = process.hrtime(hrstart);
33
- expect(hrend[0]).toBeLessThanOrEqual(1);
33
+ const execSeconds = hrend[0] + hrend[1] / 1000000000;
34
+ expect(execSeconds).toBeLessThan(1.5);
34
35
  const tmpFile = (0, utils_1.getPdfTmpPath)(`${key}.pdf`);
35
36
  const assertFile = (0, utils_1.getPdfAssertPath)(`${key}.pdf`);
36
37
  (0, fs_1.writeFileSync)(tmpFile, pdf);
@@ -1 +1 @@
1
- {"version":3,"file":"integration3.test.js","sourceRoot":"","sources":["../../../__tests__/integration3.test.ts"],"names":[],"mappings":";;;;;AAAA,2BAAmC;AACnC,+DAAuC;AACvC,kDAAqD;AACrD,4CAA6C;AAC7C,mCAA2E;AAE3E,QAAQ,CAAC,4CAA4C,EAAE,GAAG,EAAE;IAC1D,QAAQ,CAAC,IAAI,CAAC,CAAC,oBAAQ,EAAE,iBAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE,EAAE;QACtD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;YAC1C,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YAEnC,wCAAwC;YACxC,IAAI,CAAC,YAAY,GAAG,EAAE,EAAE,KAAK,IAAI,EAAE;gBACjC,MAAM,MAAM,GAAG,QAAQ,CAAC,UAAW,CAAC;gBAEpC,MAAM,IAAI,GAAG,IAAA,eAAO,GAAE,CAAC;gBACvB,IAAI,CAAC,cAAc,CAAC,QAAQ,GAAG,KAAK,CAAC;gBACrC,IAAI,CAAC,eAAe,CAAC,QAAQ,GAAG,KAAK,CAAC;gBACtC,IAAI,CAAC,qBAAqB,CAAC,CAAC,QAAQ,GAAG,KAAK,CAAC;gBAC7C,aAAa;gBACb,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC;gBAExC,MAAM,OAAO,GAAG,OAAO,CAAC,M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;gBAEtC,MAAM,OAAO,GAAG,IAAA,qBAAa,EAAC,GAAG,GAAG,MAAM,CAAC,CAAC;gBAC5C,MAAM,UAAU,GAAG,IAAA,wBAAgB,EAAC,GAAG,GAAG,MAAM,CAAC,CAAC;gBAElD,IAAA,kBAAa,EAAC,OAAO,EAAE,GAAG,CAAC,CAAC;gBAC5B,MAAM,GAAG,GAAQ,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,IAAA,cAAM,EAAC,OAAO,CAAC,EAAE,IAAA,cAAM,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC;gBAC1E,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC;gBACnB,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const fs_1 = require("fs");
7
+ const generate_1 = __importDefault(require("../src/generate"));
8
+ const templates_1 = require("./assets/templates");
9
+ const schemas_1 = require("@pdfme/schemas");
10
+ const utils_1 = require("./utils");
11
+ describe('generate integration test(slower)', () => {
12
+ describe.each([templates_1.textType])('%s', (templateData) => {
13
+ const entries = Object.entries(templateData);
14
+ for (let l = 0; l < entries.length; l += 1) {
15
+ const [key, template] = entries[l];
16
+ // eslint-disable-next-line no-loop-func
17
+ test(`snapshot ${key}`, async () => {
18
+ const inputs = template.sampledata;
19
+ const font = (0, utils_1.getFont)();
20
+ font.SauceHanSansJP.fallback = false;
21
+ font.SauceHanSerifJP.fallback = false;
22
+ font['NotoSerifJP-Regular'].fallback = false;
23
+ // @ts-ignore
24
+ font[template.fontName].fallback = true;
25
+ const hrstart = process.hrtime();
26
+ const pdf = await (0, generate_1.default)({
27
+ inputs,
28
+ template,
29
+ plugins: { text: schemas_1.text, image: schemas_1.image, ...schemas_1.barcodes },
30
+ options: { font },
31
+ });
32
+ const hrend = process.hrtime(hrstart);
33
+ const execSeconds = hrend[0] + hrend[1] / 1000000000;
34
+ expect(execSeconds).toBeLessThan(2.5);
35
+ const tmpFile = (0, utils_1.getPdfTmpPath)(`${key}.pdf`);
36
+ const assertFile = (0, utils_1.getPdfAssertPath)(`${key}.pdf`);
37
+ (0, fs_1.writeFileSync)(tmpFile, pdf);
38
+ const res = await Promise.all([(0, utils_1.getPdf)(tmpFile), (0, utils_1.getPdf)(assertFile)]);
39
+ const [a, e] = res;
40
+ expect(a.Pages).toEqual(e.Pages);
41
+ });
42
+ }
43
+ });
44
+ });
45
+ //# sourceMappingURL=integration4.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration4.test.js","sourceRoot":"","sources":["../../../__tests__/integration4.test.ts"],"names":[],"mappings":";;;;;AAAA,2BAAmC;AACnC,+DAAuC;AACvC,kDAA8C;AAC9C,4CAAuD;AACvD,mCAA2E;AAE3E,QAAQ,CAAC,mCAAmC,EAAE,GAAG,EAAE;IACjD,QAAQ,CAAC,IAAI,CAAC,CAAC,oBAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE,EAAE;QAC/C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;YAC1C,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YAEnC,wCAAwC;YACxC,IAAI,CAAC,YAAY,GAAG,EAAE,EAAE,KAAK,IAAI,EAAE;gBACjC,MAAM,MAAM,GAAG,QAAQ,CAAC,UAAW,CAAC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,CAAC,GAAG,GAAG,CAAC;gBACnB,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -29,14 +29,11 @@ const helper_js_1 = require("./helper.js");
29
29
  const generate = async (props) => {
30
30
  (0, common_1.checkGenerateProps)(props);
31
31
  const { inputs, template, options = {}, plugins: userPlugins = {} } = props;
32
- const { pdfDoc, embeddedPages, embedPdfBoxes, renderObj } = await (0, helper_js_1.preprocessing)({
33
- template,
34
- userPlugins,
35
- });
32
+ const { pdfDoc, embeddedPages, embedPdfBoxes, renderObj, readOnlySchemaKeys } = await (0, helper_js_1.preprocessing)({ template, userPlugins });
36
33
  const _cache = new Map();
37
34
  for (let i = 0; i < inputs.length; i += 1) {
38
35
  const inputObj = inputs[i];
39
- const keys = Object.keys(inputObj);
36
+ const keys = Object.keys(inputObj).concat(readOnlySchemaKeys);
40
37
  for (let j = 0; j < embeddedPages.length; j += 1) {
41
38
  const embeddedPage = embeddedPages[j];
42
39
  const { width: pageWidth, height: pageHeight } = embeddedPage;
@@ -47,7 +44,6 @@ const generate = async (props) => {
47
44
  const key = keys[l];
48
45
  const schemaObj = template.schemas[j];
49
46
  const schema = schemaObj[key];
50
- const value = inputObj[key];
51
47
  if (!schema) {
52
48
  continue;
53
49
  }
@@ -55,7 +51,7 @@ const generate = async (props) => {
55
51
  if (!render) {
56
52
  continue;
57
53
  }
58
- await render({ key, value, schema, pdfLib, pdfDoc, page, options, _cache });
54
+ await render({ key, value: inputObj[key], schema, pdfLib, pdfDoc, page, options, _cache });
59
55
  }
60
56
  }
61
57
  }
@@ -1 +1 @@
1
- {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/generate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAyC;AAEzC,0CAAmD;AACnD,2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AAM,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;aAC5F;SACF;KACF;IAED,IAAA,0BAAc,EAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IAEpC,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
@@ -62,7 +62,7 @@ const drawEmbeddedPage = (arg) => {
62
62
  exports.drawEmbeddedPage = drawEmbeddedPage;
63
63
  const preprocessing = async (arg) => {
64
64
  const { template, userPlugins } = arg;
65
- const { basePdf } = template;
65
+ const { basePdf, schemas } = template;
66
66
  const pdfDoc = await pdfLib.PDFDocument.create();
67
67
  // @ts-ignore
68
68
  pdfDoc.registerFontkit(fontkit);
@@ -71,7 +71,7 @@ const preprocessing = async (arg) => {
71
71
  const pluginValues = (Object.values(userPlugins).length > 0
72
72
  ? Object.values(userPlugins)
73
73
  : Object.values(schemas_1.builtInPlugins));
74
- const schemaTypes = template.schemas.flatMap((schemaObj) => Object.values(schemaObj).map((schema) => schema.type));
74
+ const schemaTypes = schemas.flatMap((schemaObj) => Object.values(schemaObj).map((schema) => schema.type));
75
75
  const renderObj = schemaTypes.reduce((acc, type) => {
76
76
  const render = pluginValues.find((pv) => pv.propPanel.defaultSchema.type === type);
77
77
  if (!render) {
@@ -80,7 +80,12 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
80
80
  }
81
81
  return { ...acc, [type]: render.pdf };
82
82
  }, {});
83
- return { pdfDoc, embeddedPages, embedPdfBoxes, renderObj };
83
+ const readOnlySchemaKeys = schemas.reduce((acc, schema) => {
84
+ const entries = Object.entries(schema);
85
+ const keys = entries.reduce((acc, [key, value]) => (value.readOnly ? [...acc, key] : acc), []);
86
+ return [...acc, ...keys];
87
+ }, []);
88
+ return { pdfDoc, embeddedPages, embedPdfBoxes, renderObj, readOnlySchemaKeys };
84
89
  };
85
90
  exports.preprocessing = preprocessing;
86
91
  const postProcessing = (props) => {
@@ -1 +1 @@
1
- {"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AACnC,uDAAyC;AAGzC,4CAAgD;AAChD,4CAA6F;AAC7F,0CAAuD;AACvD,iDAA2C;AAGpC,MAAM,gCAAgC,GAAG,KAAK,EAAE,GAGtD,EAAE,EAAE;IACH,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC;IAChC,IAAI,aAAa,GAAsB,EAAE,CAAC;IAC1C,IAAI,aAAa,GAAkB,EAAE,CAAC;IACtC,MAAM,WAAW,GAAG,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,IAAA,sBAAa,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IACzF,MAAM,QAAQ,GAAG,MAAM,qBAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACrD,MAAM,aAAa,GAAG,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAE1C,aAAa,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACxC,QAAQ,EAAE,CAAC,CAAC,WAAW,EAAE;QACzB,QAAQ,EAAE,CAAC,CAAC,WAAW,EAAE;QACzB,OAAO,EAAE,CAAC,CAAC,UAAU,EAAE;KACxB,CAAC,CAAC,CAAC;IAEJ,MAAM,aAAa,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QAC5C,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;QAEhD,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EA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AACzB,CAAC,CAAC;AAzBW,QAAA,cAAc,kBAyBzB"}
@@ -80,6 +80,7 @@ export const business = {
80
80
  履歴書,
81
81
  労働条件通知書,
82
82
  };
83
+ // These tests are slower, so we allow more time for them to pass
83
84
  export const textType = {
84
85
  dynamicFontSizeHorizontal,
85
86
  dynamicFontSizeVertical,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../__tests__/assets/templates/index.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAa,CAAC;AACpD,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAa,CAAC;AAC1D,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAa,CAAC;AAC1D,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAa,CAAC;AAChD,MAAM,UAAU,GAAG,OAAO,CAAC,mBAAmB,CAAa,CAAC;AAC5D,MAAM,cAAc,GAAG,OAAO,CAAC,uBAAuB,CAAa,CAAC;AACpE,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAa,CAAC;AACtD,MAAM,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAa,CAAC;AAC9D,MAAM,UAAU,GAAG,OAAO,CAAC,mBAAmB,CAAa,CAAC;AAC5D,MAAM,UAAU,GAAG,OAAO,CAAC,mBAAmB,CAAa,CAAC;AAC5D,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAa,CAAC;AACxD,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAa,CAAC;AACpD,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAa,CAAC;AACpD,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAa,CAAC;AACpD,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAa,CAAC;AACxD,MAAM,UAAU,GAAG,OAAO,CAAC,mBAAmB,CAAa,CAAC;AAC5D,MAAM,MAAM,GAAG,OAAO,CA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AAoB,GAAG,OAAO,CAAC,6BAA6B,CAAa,CAAC;AAChF,MAAM,uBAAuB,GAAG,OAAO,CAAC,gCAAgC,CAAa,CAAC;AACtF,MAAM,uBAAuB,GAAG,OAAO,CAAC,gCAAgC,CAAa,CAAC;AACtF,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAa,CAAC;AAEhD,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,IAAI;IACJ,UAAU;IACV,UAAU;IACV,WAAW;IACX,UAAU;IACV,cAAc;IACd,QAAQ;IACR,MAAM;IACN,SAAS;IACT,SAAS;IACT,OAAO;IACP,MAAM;IACN,WAAW;IACX,QAAQ;IACR,UAAU;CACX,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,MAAM;IACN,MAAM;IACN,MAAM;CACP,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,cAAc;IACd,cAAc;IACd,iBAAiB;IACjB,iBAAiB;IACjB,QAAQ;CACT,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,GAAG;IACH,KAAK;IACL,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,KAAK;IACL,GAAG;IACH,OAAO;CACR,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,yBAAyB;IACzB,uBAAuB;IACvB,oBAAoB;IACpB,uBAAuB;IACvB,uBAAuB;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,IAAI;IACJ,WAAW;IACX,SAAS;IACT,UAAU;IACV,QAAQ;CACT,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../__tests__/assets/templates/index.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAa,CAAC;AACpD,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAa,CAAC;AAC1D,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB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AAM,QAAQ,GAAG;IACtB,MAAM;IACN,MAAM;IACN,MAAM;CACP,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,cAAc;IACd,cAAc;IACd,iBAAiB;IACjB,iBAAiB;IACjB,QAAQ;CACT,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,GAAG;IACH,KAAK;IACL,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,KAAK;IACL,GAAG;IACH,OAAO;CACR,CAAC;AAEF,iEAAiE;AACjE,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,yBAAyB;IACzB,uBAAuB;IACvB,oBAAoB;IACpB,uBAAuB;IACvB,uBAAuB;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,IAAI;IACJ,WAAW;IACX,SAAS;IACT,UAAU;IACV,QAAQ;CACT,CAAC"}
@@ -25,7 +25,8 @@ describe('generate integration test(label, envelope)', () => {
25
25
  options: { font },
26
26
  });
27
27
  const hrend = process.hrtime(hrstart);
28
- expect(hrend[0]).toBeLessThanOrEqual(1);
28
+ const execSeconds = hrend[0] + hrend[1] / 1000000000;
29
+ expect(execSeconds).toBeLessThan(1.5);
29
30
  const tmpFile = getPdfTmpPath(`${key}.pdf`);
30
31
  const assertFile = getPdfAssertPath(`${key}.pdf`);
31
32
  writeFileSync(tmpFile, pdf);
@@ -1 +1 @@
1
- {"version":3,"file":"integration1.test.js","sourceRoot":"","sources":["../../../__tests__/integration1.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACnC,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAg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C;gBAC5B,MAAM,GAAG,GAAQ,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;gBAC1E,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC;gBACnB,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -25,7 +25,8 @@ describe('generate integration test(barcode, business)', () => {
25
25
  options: { font },
26
26
  });
27
27
  const hrend = process.hrtime(hrstart);
28
- expect(hrend[0]).toBeLessThanOrEqual(1);
28
+ const execSeconds = hrend[0] + hrend[1] / 1000000000;
29
+ expect(execSeconds).toBeLessThan(2);
29
30
  const tmpFile = getPdfTmpPath(`${key}.pdf`);
30
31
  const assertFile = getPdfAssertPath(`${key}.pdf`);
31
32
  writeFileSync(tmpFile, pdf);
@@ -1 +1 @@
1
- {"version":3,"file":"integration2.test.js","sourceRoot":"","sources":["../../../__tests__/integration2.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACnC,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3E,QAAQ,CAAC,8CAA8C,EAAE,GAAG,EAAE;IAC5D,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE,EAA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CAAC;gBAC1E,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC;gBACnB,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,10 +1,10 @@
1
1
  import { writeFileSync } from 'fs';
2
2
  import generate from '../src/generate';
3
- import { textType, other } from './assets/templates';
3
+ import { other } from './assets/templates';
4
4
  import { text, image } from '@pdfme/schemas';
5
5
  import { getFont, getPdf, getPdfTmpPath, getPdfAssertPath } from './utils';
6
- describe('generate integration test(textType, other)', () => {
7
- describe.each([textType, other])('%s', (templateData) => {
6
+ describe('generate integration test(other)', () => {
7
+ describe.each([other])('%s', (templateData) => {
8
8
  const entries = Object.entries(templateData);
9
9
  for (let l = 0; l < entries.length; l += 1) {
10
10
  const [key, template] = entries[l];
@@ -25,7 +25,8 @@ describe('generate integration test(textType, other)', () => {
25
25
  options: { font },
26
26
  });
27
27
  const hrend = process.hrtime(hrstart);
28
- expect(hrend[0]).toBeLessThanOrEqual(1);
28
+ const execSeconds = hrend[0] + hrend[1] / 1000000000;
29
+ expect(execSeconds).toBeLessThan(1.5);
29
30
  const tmpFile = getPdfTmpPath(`${key}.pdf`);
30
31
  const assertFile = getPdfAssertPath(`${key}.pdf`);
31
32
  writeFileSync(tmpFile, pdf);
@@ -1 +1 @@
1
- {"version":3,"file":"integration3.test.js","sourceRoot":"","sources":["../../../__tests__/integration3.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACnC,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,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,EAAE,GAAG,CAAC,CAAC;gBAC5B,MAAM,GAAG,GAAQ,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;gBAC1E,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC;gBACnB,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { writeFileSync } from 'fs';
2
+ import generate from '../src/generate';
3
+ import { textType } from './assets/templates';
4
+ import { text, image, barcodes } from '@pdfme/schemas';
5
+ import { getFont, getPdf, getPdfTmpPath, getPdfAssertPath } from './utils';
6
+ describe('generate integration test(slower)', () => {
7
+ describe.each([textType])('%s', (templateData) => {
8
+ const entries = Object.entries(templateData);
9
+ for (let l = 0; l < entries.length; l += 1) {
10
+ const [key, template] = entries[l];
11
+ // eslint-disable-next-line no-loop-func
12
+ test(`snapshot ${key}`, async () => {
13
+ const inputs = template.sampledata;
14
+ const font = getFont();
15
+ font.SauceHanSansJP.fallback = false;
16
+ font.SauceHanSerifJP.fallback = false;
17
+ font['NotoSerifJP-Regular'].fallback = false;
18
+ // @ts-ignore
19
+ font[template.fontName].fallback = true;
20
+ const hrstart = process.hrtime();
21
+ const pdf = await generate({
22
+ inputs,
23
+ template,
24
+ plugins: { text, image, ...barcodes },
25
+ options: { font },
26
+ });
27
+ const hrend = process.hrtime(hrstart);
28
+ const execSeconds = hrend[0] + hrend[1] / 1000000000;
29
+ expect(execSeconds).toBeLessThan(2.5);
30
+ const tmpFile = getPdfTmpPath(`${key}.pdf`);
31
+ const assertFile = getPdfAssertPath(`${key}.pdf`);
32
+ writeFileSync(tmpFile, pdf);
33
+ const res = await Promise.all([getPdf(tmpFile), getPdf(assertFile)]);
34
+ const [a, e] = res;
35
+ expect(a.Pages).toEqual(e.Pages);
36
+ });
37
+ }
38
+ });
39
+ });
40
+ //# sourceMappingURL=integration4.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration4.test.js","sourceRoot":"","sources":["../../../__tests__/integration4.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACnC,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3E,QAAQ,CAAC,mCAAmC,EAAE,GAAG,EAAE;IACjD,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE,EAAE;QAC/C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;YAC1C,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YAEnC,wCAAwC;YACxC,IAAI,CAAC,YAAY,GAAG,EAAE,EAAE,KAAK,IAAI,EAAE;gBACjC,MAAM,MAAM,GAAG,QAAQ,CAAC,UAAW,CAAC;gBAEpC,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;gBACvB,IAAI,CAAC,cAAc,CAAC,QAAQ,GAAG,KAAK,CAAC;gBACrC,IAAI,CAAC,eAAe,CAAC,QAAQ,GAAG,KAAK,CAAC;gBACtC,IAAI,CAAC,qBAAqB,C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const generate = async (props) => {
5
5
  checkGenerateProps(props);
6
6
  const { inputs, template, options = {}, plugins: userPlugins = {} } = props;
7
- const { pdfDoc, embeddedPages, embedPdfBoxes, renderObj } = await preprocessing({
8
- template,
9
- userPlugins,
10
- });
7
+ const { pdfDoc, embeddedPages, embedPdfBoxes, renderObj, readOnlySchemaKeys } = await preprocessing({ template, userPlugins });
11
8
  const _cache = new Map();
12
9
  for (let i = 0; i < inputs.length; i += 1) {
13
10
  const inputObj = inputs[i];
14
- const keys = Object.keys(inputObj);
11
+ const keys = Object.keys(inputObj).concat(readOnlySchemaKeys);
15
12
  for (let j = 0; j < embeddedPages.length; j += 1) {
16
13
  const embeddedPage = embeddedPages[j];
17
14
  const { width: pageWidth, height: pageHeight } = embeddedPage;
@@ -22,7 +19,6 @@ const generate = async (props) => {
22
19
  const key = keys[l];
23
20
  const schemaObj = template.schemas[j];
24
21
  const schema = schemaObj[key];
25
- const value = inputObj[key];
26
22
  if (!schema) {
27
23
  continue;
28
24
  }
@@ -30,7 +26,7 @@ const generate = async (props) => {
30
26
  if (!render) {
31
27
  continue;
32
28
  }
33
- await render({ key, value, schema, pdfLib, pdfDoc, page, options, _cache });
29
+ await render({ key, value: inputObj[key], schema, pdfLib, pdfDoc, page, options, _cache });
34
30
  }
35
31
  }
36
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/generate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE9E,MAAM,QAAQ,GAAG,KAAK,EAAE,KAAoB,EAAE,EAAE;IAC9C,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC1B,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,EAAE,EAAE,OAAO,E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E,MAAM,EAAE,CAAC,CAAC;aAC5F;SACF;KACF;IAED,cAAc,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IAEpC,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -34,7 +34,7 @@ export const drawEmbeddedPage = (arg) => {
34
34
  };
35
35
  export const preprocessing = async (arg) => {
36
36
  const { template, userPlugins } = arg;
37
- const { basePdf } = template;
37
+ const { basePdf, schemas } = template;
38
38
  const pdfDoc = await pdfLib.PDFDocument.create();
39
39
  // @ts-ignore
40
40
  pdfDoc.registerFontkit(fontkit);
@@ -43,7 +43,7 @@ export const preprocessing = async (arg) => {
43
43
  const pluginValues = (Object.values(userPlugins).length > 0
44
44
  ? Object.values(userPlugins)
45
45
  : Object.values(builtInPlugins));
46
- const schemaTypes = template.schemas.flatMap((schemaObj) => Object.values(schemaObj).map((schema) => schema.type));
46
+ const schemaTypes = schemas.flatMap((schemaObj) => Object.values(schemaObj).map((schema) => schema.type));
47
47
  const renderObj = schemaTypes.reduce((acc, type) => {
48
48
  const render = pluginValues.find((pv) => pv.propPanel.defaultSchema.type === type);
49
49
  if (!render) {
@@ -52,7 +52,12 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
52
52
  }
53
53
  return { ...acc, [type]: render.pdf };
54
54
  }, {});
55
- return { pdfDoc, embeddedPages, embedPdfBoxes, renderObj };
55
+ const readOnlySchemaKeys = schemas.reduce((acc, schema) => {
56
+ const entries = Object.entries(schema);
57
+ const keys = entries.reduce((acc, [key, value]) => (value.readOnly ? [...acc, key] : acc), []);
58
+ return [...acc, ...keys];
59
+ }, []);
60
+ return { pdfDoc, embeddedPages, embedPdfBoxes, renderObj, readOnlySchemaKeys };
56
61
  };
57
62
  export const postProcessing = (props) => {
58
63
  const { pdfDoc, options } = props;
@@ -1 +1 @@
1
- {"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/helper.ts"],"names":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AC,KAAK,CAAC,CAAC;AACzB,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -24,6 +24,7 @@ export declare const preprocessing: (arg: {
24
24
  embeddedPages: pdfLib.PDFEmbeddedPage[];
25
25
  embedPdfBoxes: EmbedPdfBox[];
26
26
  renderObj: Record<string, (arg: PDFRenderProps<Schema>) => Promise<void> | void>;
27
+ readOnlySchemaKeys: string[];
27
28
  }>;
28
29
  export declare const postProcessing: (props: {
29
30
  pdfDoc: pdfLib.PDFDocument;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdfme/generator",
3
- "version": "3.1.5-dev.7",
3
+ "version": "3.1.5-dev.9",
4
4
  "sideEffects": false,
5
5
  "author": "hand-dot",
6
6
  "license": "MIT",
package/src/generate.ts CHANGED
@@ -7,16 +7,14 @@ const generate = async (props: GenerateProps) => {
7
7
  checkGenerateProps(props);
8
8
  const { inputs, template, options = {}, plugins: userPlugins = {} } = props;
9
9
 
10
- const { pdfDoc, embeddedPages, embedPdfBoxes, renderObj } = await preprocessing({
11
- template,
12
- userPlugins,
13
- });
10
+ const { pdfDoc, embeddedPages, embedPdfBoxes, renderObj, readOnlySchemaKeys } =
11
+ await preprocessing({ template, userPlugins });
14
12
 
15
13
  const _cache = new Map();
16
14
 
17
15
  for (let i = 0; i < inputs.length; i += 1) {
18
16
  const inputObj = inputs[i];
19
- const keys = Object.keys(inputObj);
17
+ const keys = Object.keys(inputObj).concat(readOnlySchemaKeys);
20
18
  for (let j = 0; j < embeddedPages.length; j += 1) {
21
19
  const embeddedPage = embeddedPages[j];
22
20
  const { width: pageWidth, height: pageHeight } = embeddedPage;
@@ -29,8 +27,6 @@ const generate = async (props: GenerateProps) => {
29
27
  const key = keys[l];
30
28
  const schemaObj = template.schemas[j];
31
29
  const schema = schemaObj[key];
32
- const value = inputObj[key];
33
-
34
30
  if (!schema) {
35
31
  continue;
36
32
  }
@@ -40,7 +36,7 @@ const generate = async (props: GenerateProps) => {
40
36
  continue;
41
37
  }
42
38
 
43
- await render({ key, value, schema, pdfLib, pdfDoc, page, options, _cache });
39
+ await render({ key, value: inputObj[key], schema, pdfLib, pdfDoc, page, options, _cache });
44
40
  }
45
41
  }
46
42
  }
package/src/helper.ts CHANGED
@@ -55,7 +55,7 @@ export const drawEmbeddedPage = (arg: {
55
55
 
56
56
  export const preprocessing = async (arg: { template: Template; userPlugins: Plugins }) => {
57
57
  const { template, userPlugins } = arg;
58
- const { basePdf } = template;
58
+ const { basePdf, schemas } = template;
59
59
 
60
60
  const pdfDoc = await pdfLib.PDFDocument.create();
61
61
  // @ts-ignore
@@ -70,7 +70,7 @@ export const preprocessing = async (arg: { template: Template; userPlugins: Plug
70
70
  : Object.values(builtInPlugins)
71
71
  ) as Plugin<Schema>[];
72
72
 
73
- const schemaTypes = template.schemas.flatMap((schemaObj) =>
73
+ const schemaTypes = schemas.flatMap((schemaObj) =>
74
74
  Object.values(schemaObj).map((schema) => schema.type)
75
75
  );
76
76
 
@@ -84,7 +84,16 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
84
84
  return { ...acc, [type]: render.pdf };
85
85
  }, {} as Record<string, (arg: PDFRenderProps<Schema>) => Promise<void> | void>);
86
86
 
87
- return { pdfDoc, embeddedPages, embedPdfBoxes, renderObj };
87
+ const readOnlySchemaKeys = schemas.reduce((acc, schema) => {
88
+ const entries = Object.entries(schema);
89
+ const keys = entries.reduce(
90
+ (acc, [key, value]) => (value.readOnly ? [...acc, key] : acc),
91
+ [] as string[]
92
+ );
93
+ return [...acc, ...keys];
94
+ }, [] as string[]);
95
+
96
+ return { pdfDoc, embeddedPages, embedPdfBoxes, renderObj, readOnlySchemaKeys };
88
97
  };
89
98
 
90
99
  export const postProcessing = (props: {