@pdfme/generator 3.1.5-dev.9 → 3.2.0

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 (31) hide show
  1. package/dist/cjs/__tests__/assets/templates/index.js +7 -1
  2. package/dist/cjs/__tests__/assets/templates/index.js.map +1 -1
  3. package/dist/cjs/__tests__/integration1.test.js +7 -1
  4. package/dist/cjs/__tests__/integration1.test.js.map +1 -1
  5. package/dist/cjs/__tests__/integration2.test.js +7 -1
  6. package/dist/cjs/__tests__/integration2.test.js.map +1 -1
  7. package/dist/cjs/__tests__/integration3.test.js +31 -4
  8. package/dist/cjs/__tests__/integration3.test.js.map +1 -1
  9. package/dist/cjs/__tests__/integration4.test.js +7 -1
  10. package/dist/cjs/__tests__/integration4.test.js.map +1 -1
  11. package/dist/cjs/__tests__/utils.js +2 -0
  12. package/dist/cjs/__tests__/utils.js.map +1 -1
  13. package/dist/cjs/src/generate.js +9 -2
  14. package/dist/cjs/src/generate.js.map +1 -1
  15. package/dist/esm/__tests__/assets/templates/index.js +6 -0
  16. package/dist/esm/__tests__/assets/templates/index.js.map +1 -1
  17. package/dist/esm/__tests__/integration1.test.js +7 -1
  18. package/dist/esm/__tests__/integration1.test.js.map +1 -1
  19. package/dist/esm/__tests__/integration2.test.js +7 -1
  20. package/dist/esm/__tests__/integration2.test.js.map +1 -1
  21. package/dist/esm/__tests__/integration3.test.js +33 -6
  22. package/dist/esm/__tests__/integration3.test.js.map +1 -1
  23. package/dist/esm/__tests__/integration4.test.js +7 -1
  24. package/dist/esm/__tests__/integration4.test.js.map +1 -1
  25. package/dist/esm/__tests__/utils.js +2 -0
  26. package/dist/esm/__tests__/utils.js.map +1 -1
  27. package/dist/esm/src/generate.js +9 -2
  28. package/dist/esm/src/generate.js.map +1 -1
  29. package/dist/types/__tests__/assets/templates/index.d.ts +92 -0
  30. package/package.json +3 -3
  31. package/src/generate.ts +11 -4
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.other = exports.textType = exports.business = exports.barcode = exports.envelope = exports.label = void 0;
3
+ exports.shape = exports.other = exports.textType = exports.business = exports.barcode = exports.envelope = exports.label = void 0;
4
4
  const レターパック = require('./レターパック.json');
5
5
  const レターパックライト = require('./レターパックライト.json');
6
6
  const レターパックプラス = require('./レターパックプラス.json');
@@ -43,6 +43,8 @@ const verticalAlignmentTop = require('./verticalAlignmentTop.json');
43
43
  const verticalAlignmentMiddle = require('./verticalAlignmentMiddle.json');
44
44
  const verticalAlignmentBottom = require('./verticalAlignmentBottom.json');
45
45
  const test = require('./test.json');
46
+ const shapes = require('./shapes.json');
47
+ const pet = require('./pet.json');
46
48
  exports.label = {
47
49
  宛名8面,
48
50
  シンプルラベル24面,
@@ -97,5 +99,9 @@ exports.other = {
97
99
  canvasPdf,
98
100
  background,
99
101
  rotation,
102
+ pet,
103
+ };
104
+ exports.shape = {
105
+ shapes,
100
106
  };
101
107
  //# sourceMappingURL=index.js.map
@@ -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,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AO,CAAC,gCAAgC,CAAa,CAAC;AACtF,MAAM,uBAAuB,GAAG,OAAO,CAAC,gCAAgC,CAAa,CAAC;AACtF,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAa,CAAC;AAChD,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAa,CAAC;AACpD,MAAM,GAAG,GAAG,OAAO,CAAC,YAAY,CAAa,CAAC;AAEjC,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;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;IACR,GAAG;CACJ,CAAC;AAEW,QAAA,KAAK,GAAG;IACnB,MAAM;CACP,CAAC"}
@@ -8,6 +8,7 @@ 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
+ const PERFORMANCE_THRESHOLD = parseFloat(process.env.PERFORMANCE_THRESHOLD || '1.5');
11
12
  describe('generate integration test(label, envelope)', () => {
12
13
  describe.each([templates_1.label, templates_1.envelope])('%s', (templateData) => {
13
14
  const entries = Object.entries(templateData);
@@ -31,7 +32,12 @@ describe('generate integration test(label, envelope)', () => {
31
32
  });
32
33
  const hrend = process.hrtime(hrstart);
33
34
  const execSeconds = hrend[0] + hrend[1] / 1000000000;
34
- expect(execSeconds).toBeLessThan(1.5);
35
+ if (process.env.CI) {
36
+ expect(execSeconds).toBeLessThan(PERFORMANCE_THRESHOLD);
37
+ }
38
+ else if (execSeconds >= PERFORMANCE_THRESHOLD) {
39
+ console.warn(`Warning: Execution time for ${key} is ${execSeconds} seconds, which is above the threshold of ${PERFORMANCE_THRESHOLD} seconds.`);
40
+ }
35
41
  const tmpFile = (0, utils_1.getPdfTmpPath)(`${key}.pdf`);
36
42
  const assertFile = (0, utils_1.getPdfAssertPath)(`${key}.pdf`);
37
43
  (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,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YAEnC,wCAAwC;YACxC,IAAI,CAAC,YAAY,GAAG,EAAE,EAAE,KAAK,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,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,6 +8,7 @@ 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
+ const PERFORMANCE_THRESHOLD = parseFloat(process.env.PERFORMANCE_THRESHOLD || '2.0');
11
12
  describe('generate integration test(barcode, business)', () => {
12
13
  describe.each([templates_1.barcode, templates_1.business])('%s', (templateData) => {
13
14
  const entries = Object.entries(templateData);
@@ -31,7 +32,12 @@ describe('generate integration test(barcode, business)', () => {
31
32
  });
32
33
  const hrend = process.hrtime(hrstart);
33
34
  const execSeconds = hrend[0] + hrend[1] / 1000000000;
34
- expect(execSeconds).toBeLessThan(2);
35
+ if (process.env.CI) {
36
+ expect(execSeconds).toBeLessThan(PERFORMANCE_THRESHOLD);
37
+ }
38
+ else if (execSeconds >= PERFORMANCE_THRESHOLD) {
39
+ console.warn(`Warning: Execution time for ${key} is ${execSeconds} seconds, which is above the threshold of ${PERFORMANCE_THRESHOLD} seconds.`);
40
+ }
35
41
  const tmpFile = (0, utils_1.getPdfTmpPath)(`${key}.pdf`);
36
42
  const assertFile = (0, utils_1.getPdfAssertPath)(`${key}.pdf`);
37
43
  (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,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A,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,20 @@ 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(other)', () => {
12
- describe.each([templates_1.other])('%s', (templateData) => {
11
+ const signature = {
12
+ pdf: schemas_1.image.pdf,
13
+ ui: () => { },
14
+ propPanel: {
15
+ ...schemas_1.image.propPanel,
16
+ defaultSchema: {
17
+ ...schemas_1.image.propPanel.defaultSchema,
18
+ type: 'signature',
19
+ },
20
+ },
21
+ };
22
+ const PERFORMANCE_THRESHOLD = parseFloat(process.env.PERFORMANCE_THRESHOLD || '1.5');
23
+ describe('generate integration test(other, shape)', () => {
24
+ describe.each([templates_1.other, templates_1.shape])('%s', (templateData) => {
13
25
  const entries = Object.entries(templateData);
14
26
  for (let l = 0; l < entries.length; l += 1) {
15
27
  const [key, template] = entries[l];
@@ -26,12 +38,27 @@ describe('generate integration test(other)', () => {
26
38
  const pdf = await (0, generate_1.default)({
27
39
  inputs,
28
40
  template,
29
- plugins: { text: schemas_1.text, image: schemas_1.image },
41
+ plugins: {
42
+ text: schemas_1.text,
43
+ image: schemas_1.image,
44
+ line: schemas_1.line,
45
+ rectangle: schemas_1.rectangle,
46
+ ellipse: schemas_1.ellipse,
47
+ signature,
48
+ qrcode: schemas_1.barcodes.qrcode,
49
+ readOnlyText: schemas_1.readOnlyText,
50
+ readOnlySvg: schemas_1.readOnlySvg,
51
+ },
30
52
  options: { font },
31
53
  });
32
54
  const hrend = process.hrtime(hrstart);
33
55
  const execSeconds = hrend[0] + hrend[1] / 1000000000;
34
- expect(execSeconds).toBeLessThan(1.5);
56
+ if (process.env.CI) {
57
+ expect(execSeconds).toBeLessThan(PERFORMANCE_THRESHOLD);
58
+ }
59
+ else if (execSeconds >= PERFORMANCE_THRESHOLD) {
60
+ console.warn(`Warning: Execution time for ${key} is ${execSeconds} seconds, which is above the threshold of ${PERFORMANCE_THRESHOLD} seconds.`);
61
+ }
35
62
  const tmpFile = (0, utils_1.getPdfTmpPath)(`${key}.pdf`);
36
63
  const assertFile = (0, utils_1.getPdfAssertPath)(`${key}.pdf`);
37
64
  (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,kDAA2C;AAC3C,4CAA6C;AAC7C,mCAA2E;AAE3E,QAAQ,CAAC,kCAAkC,EAAE,GAAG,EAAE;IAChD,QAAQ,CAAC,IAAI,CAAC,CAAC,iBAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE,EAAE;QAC5C,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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BAAqB,EAAE;oBAC/C,OAAO,CAAC,IAAI,CAAC,+BAA+B,GAAG,OAAO,WAAW,6CAA6C,qBAAqB,WAAW,CAAC,CAAC;iBACjJ;gBAED,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,6 +8,7 @@ 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
+ const PERFORMANCE_THRESHOLD = parseFloat(process.env.PERFORMANCE_THRESHOLD || '2.5');
11
12
  describe('generate integration test(slower)', () => {
12
13
  describe.each([templates_1.textType])('%s', (templateData) => {
13
14
  const entries = Object.entries(templateData);
@@ -31,7 +32,12 @@ describe('generate integration test(slower)', () => {
31
32
  });
32
33
  const hrend = process.hrtime(hrstart);
33
34
  const execSeconds = hrend[0] + hrend[1] / 1000000000;
34
- expect(execSeconds).toBeLessThan(2.5);
35
+ if (process.env.CI) {
36
+ expect(execSeconds).toBeLessThan(PERFORMANCE_THRESHOLD);
37
+ }
38
+ else if (execSeconds >= PERFORMANCE_THRESHOLD) {
39
+ console.warn(`Warning: Execution time for ${key} is ${execSeconds} seconds, which is above the threshold of ${PERFORMANCE_THRESHOLD} seconds.`);
40
+ }
35
41
  const tmpFile = (0, utils_1.getPdfTmpPath)(`${key}.pdf`);
36
42
  const assertFile = (0, utils_1.getPdfAssertPath)(`${key}.pdf`);
37
43
  (0, fs_1.writeFileSync)(tmpFile, pdf);
@@ -1 +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;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,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E,EAAE,IAAI,EAAE;iBAClB,CAAC,CAAC;gBAEH,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBACtC,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC;gBACrD,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE;oBAClB,MAAM,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC;iBACzD;qBAAM,IAAI,WAAW,IAAI,qBAAqB,EAAE;oBAC/C,OAAO,CAAC,IAAI,CAAC,+BAA+B,GAAG,OAAO,WAAW,6CAA6C,qBAAqB,WAAW,CAAC,CAAC;iBACjJ;gBAED,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"}
@@ -30,6 +30,7 @@ const PDFParser = require('pdf2json');
30
30
  const SauceHanSansJPData = (0, fs_1.readFileSync)(path.join(__dirname, `/assets/fonts/SauceHanSansJP.ttf`));
31
31
  const SauceHanSerifJPData = (0, fs_1.readFileSync)(path.join(__dirname, `/assets/fonts/SauceHanSerifJP.ttf`));
32
32
  const NotoSerifJPRegularData = (0, fs_1.readFileSync)(path.join(__dirname, `/assets/fonts/NotoSerifJP-Regular.otf`));
33
+ const NotoSansJPRegularData = (0, fs_1.readFileSync)(path.join(__dirname, `/assets/fonts/NotoSansJP-Regular.otf`));
33
34
  const GloriaHallelujahRegularData = (0, fs_1.readFileSync)(path.join(__dirname, `/assets/fonts/GloriaHallelujah-Regular.ttf`));
34
35
  const GreatVibesRegularData = (0, fs_1.readFileSync)(path.join(__dirname, `/assets/fonts/GreatVibes-Regular.ttf`));
35
36
  const JuliusSansOneRegularData = (0, fs_1.readFileSync)(path.join(__dirname, `/assets/fonts/JuliusSansOne-Regular.ttf`));
@@ -37,6 +38,7 @@ const getFont = () => ({
37
38
  SauceHanSansJP: { fallback: true, data: SauceHanSansJPData },
38
39
  SauceHanSerifJP: { data: SauceHanSerifJPData },
39
40
  'NotoSerifJP-Regular': { data: NotoSerifJPRegularData },
41
+ 'NotoSansJP-Regular': { data: NotoSansJPRegularData },
40
42
  'GloriaHallelujah-Regular': { data: GloriaHallelujahRegularData },
41
43
  'GreatVibes-Regular': { data: GreatVibesRegularData },
42
44
  'JuliusSansOne-Regular': { data: JuliusSansOneRegularData },
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../__tests__/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAAkC;AAClC,2CAA6B;AAG7B,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACtC,MAAM,kBAAkB,GAAG,IAAA,iBAAY,EAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,kCAAkC,CAAC,CAAC,CAAC;AAClG,MAAM,mBAAmB,GAAG,IAAA,iBAAY,EAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,mCAAmC,CAAC,CAAC,CAAC;AACpG,MAAM,sBAAsB,GAAG,IAAA,iBAAY,EACzC,I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AQ,CAAC,CAAC;AAAlE,QAAA,aAAa,iBAAqD;AACxE,MAAM,gBAAgB,GAAG,CAAC,QAAgB,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAAxE,QAAA,gBAAgB,oBAAwD"}
@@ -29,11 +29,17 @@ 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
+ if (inputs.length === 0) {
33
+ throw new Error('inputs should not be empty');
34
+ }
32
35
  const { pdfDoc, embeddedPages, embedPdfBoxes, renderObj, readOnlySchemaKeys } = await (0, helper_js_1.preprocessing)({ template, userPlugins });
36
+ const keys = readOnlySchemaKeys.concat(Object.keys(inputs[0]));
37
+ if (template.columns) {
38
+ keys.sort((a, b) => (template.columns ?? []).indexOf(a) - (template.columns ?? []).indexOf(b));
39
+ }
33
40
  const _cache = new Map();
34
41
  for (let i = 0; i < inputs.length; i += 1) {
35
42
  const inputObj = inputs[i];
36
- const keys = Object.keys(inputObj).concat(readOnlySchemaKeys);
37
43
  for (let j = 0; j < embeddedPages.length; j += 1) {
38
44
  const embeddedPage = embeddedPages[j];
39
45
  const { width: pageWidth, height: pageHeight } = embeddedPage;
@@ -51,7 +57,8 @@ const generate = async (props) => {
51
57
  if (!render) {
52
58
  continue;
53
59
  }
54
- await render({ key, value: inputObj[key], schema, pdfLib, pdfDoc, page, options, _cache });
60
+ const value = schema.readOnly ? schema.readOnlyValue || '' : inputObj[key];
61
+ await render({ key, value, schema, pdfLib, pdfDoc, page, options, _cache });
55
62
  }
56
63
  }
57
64
  }
@@ -1 +1 @@
1
- {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/generate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAyC;AAEzC,0CAAmD;AACnD,2CAA8E;AAE9E,MAAM,QAAQ,GAAG,KAAK,EAAE,KAAo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I,CAAC,EAAE;gBACvC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;gBACpB,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;gBACtC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;gBAC9B,IAAI,CAAC,MAAM,EAAE;oBACX,SAAS;iBACV;gBAED,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBACtC,IAAI,CAAC,MAAM,EAAE;oBACX,SAAS;iBACV;gBACD,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;gBAC3E,MAAM,MAAM,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;aAC7E;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"}
@@ -40,6 +40,8 @@ const verticalAlignmentTop = require('./verticalAlignmentTop.json');
40
40
  const verticalAlignmentMiddle = require('./verticalAlignmentMiddle.json');
41
41
  const verticalAlignmentBottom = require('./verticalAlignmentBottom.json');
42
42
  const test = require('./test.json');
43
+ const shapes = require('./shapes.json');
44
+ const pet = require('./pet.json');
43
45
  export const label = {
44
46
  宛名8面,
45
47
  シンプルラベル24面,
@@ -94,5 +96,9 @@ export const other = {
94
96
  canvasPdf,
95
97
  background,
96
98
  rotation,
99
+ pet,
100
+ };
101
+ export const shape = {
102
+ shapes,
97
103
  };
98
104
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,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AAC,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,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"}
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,CAA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c;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;IACR,GAAG;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,MAAM;CACP,CAAC"}
@@ -3,6 +3,7 @@ import generate from '../src/generate';
3
3
  import { label, envelope } from './assets/templates';
4
4
  import { text, image } from '@pdfme/schemas';
5
5
  import { getFont, getPdf, getPdfTmpPath, getPdfAssertPath } from './utils';
6
+ const PERFORMANCE_THRESHOLD = parseFloat(process.env.PERFORMANCE_THRESHOLD || '1.5');
6
7
  describe('generate integration test(label, envelope)', () => {
7
8
  describe.each([label, envelope])('%s', (templateData) => {
8
9
  const entries = Object.entries(templateData);
@@ -26,7 +27,12 @@ describe('generate integration test(label, envelope)', () => {
26
27
  });
27
28
  const hrend = process.hrtime(hrstart);
28
29
  const execSeconds = hrend[0] + hrend[1] / 1000000000;
29
- expect(execSeconds).toBeLessThan(1.5);
30
+ if (process.env.CI) {
31
+ expect(execSeconds).toBeLessThan(PERFORMANCE_THRESHOLD);
32
+ }
33
+ else if (execSeconds >= PERFORMANCE_THRESHOLD) {
34
+ console.warn(`Warning: Execution time for ${key} is ${execSeconds} seconds, which is above the threshold of ${PERFORMANCE_THRESHOLD} seconds.`);
35
+ }
30
36
  const tmpFile = getPdfTmpPath(`${key}.pdf`);
31
37
  const assertFile = getPdfAss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} from '@pdfme/schemas';
5
5
  import { getFont, getPdf, getPdfTmpPath, getPdfAssertPath } from './utils';
6
+ const PERFORMANCE_THRESHOLD = parseFloat(process.env.PERFORMANCE_THRESHOLD || '2.0');
6
7
  describe('generate integration test(barcode, business)', () => {
7
8
  describe.each([barcode, business])('%s', (templateData) => {
8
9
  const entries = Object.entries(templateData);
@@ -26,7 +27,12 @@ describe('generate integration test(barcode, business)', () => {
26
27
  });
27
28
  const hrend = process.hrtime(hrstart);
28
29
  const execSeconds = hrend[0] + hrend[1] / 1000000000;
29
- expect(execSeconds).toBeLessThan(2);
30
+ if (process.env.CI) {
31
+ expect(execSeconds).toBeLessThan(PERFORMANCE_THRESHOLD);
32
+ }
33
+ else if (execSeconds >= PERFORMANCE_THRESHOLD) {
34
+ console.warn(`Warning: Execution time for ${key} is ${execSeconds} seconds, which is above the threshold of ${PERFORMANCE_THRESHOLD} seconds.`);
35
+ }
30
36
  const tmpFile = getPdfTmpPath(`${key}.pdf`);
31
37
  const assertFile = getPdfAssertPath(`${key}.pdf`);
32
38
  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,EAA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GAAG,OAAO,WAAW,6CAA6C,qBAAqB,WAAW,CAAC,CAAC;iBACjJ;gBAED,MAAM,OAAO,GAAG,aAAa,CAAC,GAAG,GAAG,MAAM,CAAC,CAAC;gBAC5C,MAAM,UAAU,GAAG,gBAAgB,CAAC,GAAG,GAAG,MAAM,CAAC,CAAC;gBAElD,aAAa,CAAC,OAAO,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"}
@@ -1,10 +1,22 @@
1
1
  import { writeFileSync } from 'fs';
2
2
  import generate from '../src/generate';
3
- import { other } from './assets/templates';
4
- import { text, image } from '@pdfme/schemas';
3
+ import { other, shape } from './assets/templates';
4
+ import { text, image, line, rectangle, ellipse, readOnlyText, barcodes, readOnlySvg, } from '@pdfme/schemas';
5
5
  import { getFont, getPdf, getPdfTmpPath, getPdfAssertPath } from './utils';
6
- describe('generate integration test(other)', () => {
7
- describe.each([other])('%s', (templateData) => {
6
+ const signature = {
7
+ pdf: image.pdf,
8
+ ui: () => { },
9
+ propPanel: {
10
+ ...image.propPanel,
11
+ defaultSchema: {
12
+ ...image.propPanel.defaultSchema,
13
+ type: 'signature',
14
+ },
15
+ },
16
+ };
17
+ const PERFORMANCE_THRESHOLD = parseFloat(process.env.PERFORMANCE_THRESHOLD || '1.5');
18
+ describe('generate integration test(other, shape)', () => {
19
+ describe.each([other, shape])('%s', (templateData) => {
8
20
  const entries = Object.entries(templateData);
9
21
  for (let l = 0; l < entries.length; l += 1) {
10
22
  const [key, template] = entries[l];
@@ -21,12 +33,27 @@ describe('generate integration test(other)', () => {
21
33
  const pdf = await generate({
22
34
  inputs,
23
35
  template,
24
- plugins: { text, image },
36
+ plugins: {
37
+ text,
38
+ image,
39
+ line,
40
+ rectangle,
41
+ ellipse,
42
+ signature,
43
+ qrcode: barcodes.qrcode,
44
+ readOnlyText,
45
+ readOnlySvg,
46
+ },
25
47
  options: { font },
26
48
  });
27
49
  const hrend = process.hrtime(hrstart);
28
50
  const execSeconds = hrend[0] + hrend[1] / 1000000000;
29
- expect(execSeconds).toBeLessThan(1.5);
51
+ if (process.env.CI) {
52
+ expect(execSeconds).toBeLessThan(PERFORMANCE_THRESHOLD);
53
+ }
54
+ else if (execSeconds >= PERFORMANCE_THRESHOLD) {
55
+ console.warn(`Warning: Execution time for ${key} is ${execSeconds} seconds, which is above the threshold of ${PERFORMANCE_THRESHOLD} seconds.`);
56
+ }
30
57
  const tmpFile = getPdfTmpPath(`${key}.pdf`);
31
58
  const assertFile = getPdfAssertPath(`${key}.pdf`);
32
59
  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,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3E,QAAQ,CAAC,kCAAkC,EAAE,GAAG,EAAE;IAChD,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE,EAAE;QAC5C,MAAM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,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBACtC,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC;gBACrD,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE;oBAClB,MAAM,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC;iBACzD;qBAAM,IAAI,WAAW,IAAI,qBAAqB,EAAE;oBAC/C,OAAO,CAAC,IAAI,CAAC,+BAA+B,GAAG,OAAO,WAAW,6CAA6C,qBAAqB,WAAW,CAAC,CAAC;iBACjJ;gBAED,MAAM,OAAO,GAAG,aAAa,CAAC,GAAG,GAAG,MAAM,CAAC,CAAC;gBAC5C,MAAM,UAAU,GAAG,gBAAgB,CAAC,GAAG,GAAG,MAAM,CAAC,CAAC;gBAElD,aAAa,CAAC,OAAO,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"}
@@ -3,6 +3,7 @@ import generate from '../src/generate';
3
3
  import { textType } from './assets/templates';
4
4
  import { text, image, barcodes } from '@pdfme/schemas';
5
5
  import { getFont, getPdf, getPdfTmpPath, getPdfAssertPath } from './utils';
6
+ const PERFORMANCE_THRESHOLD = parseFloat(process.env.PERFORMANCE_THRESHOLD || '2.5');
6
7
  describe('generate integration test(slower)', () => {
7
8
  describe.each([textType])('%s', (templateData) => {
8
9
  const entries = Object.entries(templateData);
@@ -26,7 +27,12 @@ describe('generate integration test(slower)', () => {
26
27
  });
27
28
  const hrend = process.hrtime(hrstart);
28
29
  const execSeconds = hrend[0] + hrend[1] / 1000000000;
29
- expect(execSeconds).toBeLessThan(2.5);
30
+ if (process.env.CI) {
31
+ expect(execSeconds).toBeLessThan(PERFORMANCE_THRESHOLD);
32
+ }
33
+ else if (execSeconds >= PERFORMANCE_THRESHOLD) {
34
+ console.warn(`Warning: Execution time for ${key} is ${execSeconds} seconds, which is above the threshold of ${PERFORMANCE_THRESHOLD} seconds.`);
35
+ }
30
36
  const tmpFile = getPdfTmpPath(`${key}.pdf`);
31
37
  const assertFile = getPdfAssertPath(`${key}.pdf`);
32
38
  writeFileSync(tmpFile, pdf);
@@ -1 +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,QAA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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"}
@@ -4,6 +4,7 @@ const PDFParser = require('pdf2json');
4
4
  const SauceHanSansJPData = readFileSync(path.join(__dirname, `/assets/fonts/SauceHanSansJP.ttf`));
5
5
  const SauceHanSerifJPData = readFileSync(path.join(__dirname, `/assets/fonts/SauceHanSerifJP.ttf`));
6
6
  const NotoSerifJPRegularData = readFileSync(path.join(__dirname, `/assets/fonts/NotoSerifJP-Regular.otf`));
7
+ const NotoSansJPRegularData = readFileSync(path.join(__dirname, `/assets/fonts/NotoSansJP-Regular.otf`));
7
8
  const GloriaHallelujahRegularData = readFileSync(path.join(__dirname, `/assets/fonts/GloriaHallelujah-Regular.ttf`));
8
9
  const GreatVibesRegularData = readFileSync(path.join(__dirname, `/assets/fonts/GreatVibes-Regular.ttf`));
9
10
  const JuliusSansOneRegularData = readFileSync(path.join(__dirname, `/assets/fonts/JuliusSansOne-Regular.ttf`));
@@ -11,6 +12,7 @@ export const getFont = () => ({
11
12
  SauceHanSansJP: { fallback: true, data: SauceHanSansJPData },
12
13
  SauceHanSerifJP: { data: SauceHanSerifJPData },
13
14
  'NotoSerifJP-Regular': { data: NotoSerifJPRegularData },
15
+ 'NotoSansJP-Regular': { data: NotoSansJPRegularData },
14
16
  'GloriaHallelujah-Regular': { data: GloriaHallelujahRegularData },
15
17
  'GreatVibes-Regular': { data: GreatVibesRegularData },
16
18
  'JuliusSansOne-Regular': { data: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C,EAAE,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;QAC7C,SAAS,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,QAAgB,EAAE,EAAE,CACnD,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI,QAAQ,EAAE,CAAC,CAAC;AAEzD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAAgB,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC/E,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAAgB,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC"}
@@ -4,11 +4,17 @@ import { drawEmbeddedPage, preprocessing, postProcessing } from './helper.js';
4
4
  const generate = async (props) => {
5
5
  checkGenerateProps(props);
6
6
  const { inputs, template, options = {}, plugins: userPlugins = {} } = props;
7
+ if (inputs.length === 0) {
8
+ throw new Error('inputs should not be empty');
9
+ }
7
10
  const { pdfDoc, embeddedPages, embedPdfBoxes, renderObj, readOnlySchemaKeys } = await preprocessing({ template, userPlugins });
11
+ const keys = readOnlySchemaKeys.concat(Object.keys(inputs[0]));
12
+ if (template.columns) {
13
+ keys.sort((a, b) => (template.columns ?? []).indexOf(a) - (template.columns ?? []).indexOf(b));
14
+ }
8
15
  const _cache = new Map();
9
16
  for (let i = 0; i < inputs.length; i += 1) {
10
17
  const inputObj = inputs[i];
11
- const keys = Object.keys(inputObj).concat(readOnlySchemaKeys);
12
18
  for (let j = 0; j < embeddedPages.length; j += 1) {
13
19
  const embeddedPage = embeddedPages[j];
14
20
  const { width: pageWidth, height: pageHeight } = embeddedPage;
@@ -26,7 +32,8 @@ const generate = async (props) => {
26
32
  if (!render) {
27
33
  continue;
28
34
  }
29
- await render({ key, value: inputObj[key], schema, pdfLib, pdfDoc, page, options, _cache });
35
+ const value = schema.readOnly ? schema.readOnlyValue || '' : inputObj[key];
36
+ await render({ key, value, schema, pdfLib, pdfDoc, page, options, _cache });
30
37
  }
31
38
  }
32
39
  }
@@ -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,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,KAAK,CAAC;IAE5E,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,kBAAkB,EAAE,GAC3E,MAAM,aAAa,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC;IAEjD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;IAEzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;QACzC,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QAC3B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAC9D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;YAChD,MAAM,YAAY,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;YACtC,MAAM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CAAC;AACvB,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -3,6 +3,7 @@ export declare const label: {
3
3
  schemas: Record<string, import("zod").objectOutputType<{
4
4
  type: import("zod").ZodString;
5
5
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
6
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
6
7
  position: import("zod").ZodObject<{
7
8
  x: import("zod").ZodNumber;
8
9
  y: import("zod").ZodNumber;
@@ -26,6 +27,7 @@ export declare const label: {
26
27
  schemas: Record<string, import("zod").objectOutputType<{
27
28
  type: import("zod").ZodString;
28
29
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
30
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
29
31
  position: import("zod").ZodObject<{
30
32
  x: import("zod").ZodNumber;
31
33
  y: import("zod").ZodNumber;
@@ -49,6 +51,7 @@ export declare const label: {
49
51
  schemas: Record<string, import("zod").objectOutputType<{
50
52
  type: import("zod").ZodString;
51
53
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
54
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
52
55
  position: import("zod").ZodObject<{
53
56
  x: import("zod").ZodNumber;
54
57
  y: import("zod").ZodNumber;
@@ -72,6 +75,7 @@ export declare const label: {
72
75
  schemas: Record<string, import("zod").objectOutputType<{
73
76
  type: import("zod").ZodString;
74
77
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
78
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
75
79
  position: import("zod").ZodObject<{
76
80
  x: import("zod").ZodNumber;
77
81
  y: import("zod").ZodNumber;
@@ -95,6 +99,7 @@ export declare const label: {
95
99
  schemas: Record<string, import("zod").objectOutputType<{
96
100
  type: import("zod").ZodString;
97
101
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
102
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
98
103
  position: import("zod").ZodObject<{
99
104
  x: import("zod").ZodNumber;
100
105
  y: import("zod").ZodNumber;
@@ -118,6 +123,7 @@ export declare const label: {
118
123
  schemas: Record<string, import("zod").objectOutputType<{
119
124
  type: import("zod").ZodString;
120
125
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
126
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
121
127
  position: import("zod").ZodObject<{
122
128
  x: import("zod").ZodNumber;
123
129
  y: import("zod").ZodNumber;
@@ -141,6 +147,7 @@ export declare const label: {
141
147
  schemas: Record<string, import("zod").objectOutputType<{
142
148
  type: import("zod").ZodString;
143
149
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
150
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
144
151
  position: import("zod").ZodObject<{
145
152
  x: import("zod").ZodNumber;
146
153
  y: import("zod").ZodNumber;
@@ -164,6 +171,7 @@ export declare const label: {
164
171
  schemas: Record<string, import("zod").objectOutputType<{
165
172
  type: import("zod").ZodString;
166
173
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
174
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
167
175
  position: import("zod").ZodObject<{
168
176
  x: import("zod").ZodNumber;
169
177
  y: import("zod").ZodNumber;
@@ -187,6 +195,7 @@ export declare const label: {
187
195
  schemas: Record<string, import("zod").objectOutputType<{
188
196
  type: import("zod").ZodString;
189
197
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
198
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
190
199
  position: import("zod").ZodObject<{
191
200
  x: import("zod").ZodNumber;
192
201
  y: import("zod").ZodNumber;
@@ -210,6 +219,7 @@ export declare const label: {
210
219
  schemas: Record<string, import("zod").objectOutputType<{
211
220
  type: import("zod").ZodString;
212
221
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
222
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
213
223
  position: import("zod").ZodObject<{
214
224
  x: import("zod").ZodNumber;
215
225
  y: import("zod").ZodNumber;
@@ -233,6 +243,7 @@ export declare const label: {
233
243
  schemas: Record<string, import("zod").objectOutputType<{
234
244
  type: import("zod").ZodString;
235
245
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
246
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
236
247
  position: import("zod").ZodObject<{
237
248
  x: import("zod").ZodNumber;
238
249
  y: import("zod").ZodNumber;
@@ -256,6 +267,7 @@ export declare const label: {
256
267
  schemas: Record<string, import("zod").objectOutputType<{
257
268
  type: import("zod").ZodString;
258
269
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
270
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
259
271
  position: import("zod").ZodObject<{
260
272
  x: import("zod").ZodNumber;
261
273
  y: import("zod").ZodNumber;
@@ -279,6 +291,7 @@ export declare const label: {
279
291
  schemas: Record<string, import("zod").objectOutputType<{
280
292
  type: import("zod").ZodString;
281
293
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
294
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
282
295
  position: import("zod").ZodObject<{
283
296
  x: import("zod").ZodNumber;
284
297
  y: import("zod").ZodNumber;
@@ -302,6 +315,7 @@ export declare const label: {
302
315
  schemas: Record<string, import("zod").objectOutputType<{
303
316
  type: import("zod").ZodString;
304
317
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
318
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
305
319
  position: import("zod").ZodObject<{
306
320
  x: import("zod").ZodNumber;
307
321
  y: import("zod").ZodNumber;
@@ -325,6 +339,7 @@ export declare const label: {
325
339
  schemas: Record<string, import("zod").objectOutputType<{
326
340
  type: import("zod").ZodString;
327
341
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
342
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
328
343
  position: import("zod").ZodObject<{
329
344
  x: import("zod").ZodNumber;
330
345
  y: import("zod").ZodNumber;
@@ -350,6 +365,7 @@ export declare const envelope: {
350
365
  schemas: Record<string, import("zod").objectOutputType<{
351
366
  type: import("zod").ZodString;
352
367
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
368
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
353
369
  position: import("zod").ZodObject<{
354
370
  x: import("zod").ZodNumber;
355
371
  y: import("zod").ZodNumber;
@@ -373,6 +389,7 @@ export declare const envelope: {
373
389
  schemas: Record<string, import("zod").objectOutputType<{
374
390
  type: import("zod").ZodString;
375
391
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
392
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
376
393
  position: import("zod").ZodObject<{
377
394
  x: import("zod").ZodNumber;
378
395
  y: import("zod").ZodNumber;
@@ -396,6 +413,7 @@ export declare const envelope: {
396
413
  schemas: Record<string, import("zod").objectOutputType<{
397
414
  type: import("zod").ZodString;
398
415
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
416
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
399
417
  position: import("zod").ZodObject<{
400
418
  x: import("zod").ZodNumber;
401
419
  y: import("zod").ZodNumber;
@@ -421,6 +439,7 @@ export declare const barcode: {
421
439
  schemas: Record<string, import("zod").objectOutputType<{
422
440
  type: import("zod").ZodString;
423
441
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
442
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
424
443
  position: import("zod").ZodObject<{
425
444
  x: import("zod").ZodNumber;
426
445
  y: import("zod").ZodNumber;
@@ -444,6 +463,7 @@ export declare const barcode: {
444
463
  schemas: Record<string, import("zod").objectOutputType<{
445
464
  type: import("zod").ZodString;
446
465
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
466
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
447
467
  position: import("zod").ZodObject<{
448
468
  x: import("zod").ZodNumber;
449
469
  y: import("zod").ZodNumber;
@@ -467,6 +487,7 @@ export declare const barcode: {
467
487
  schemas: Record<string, import("zod").objectOutputType<{
468
488
  type: import("zod").ZodString;
469
489
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
490
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
470
491
  position: import("zod").ZodObject<{
471
492
  x: import("zod").ZodNumber;
472
493
  y: import("zod").ZodNumber;
@@ -490,6 +511,7 @@ export declare const barcode: {
490
511
  schemas: Record<string, import("zod").objectOutputType<{
491
512
  type: import("zod").ZodString;
492
513
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
514
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
493
515
  position: import("zod").ZodObject<{
494
516
  x: import("zod").ZodNumber;
495
517
  y: import("zod").ZodNumber;
@@ -513,6 +535,7 @@ export declare const barcode: {
513
535
  schemas: Record<string, import("zod").objectOutputType<{
514
536
  type: import("zod").ZodString;
515
537
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
538
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
516
539
  position: import("zod").ZodObject<{
517
540
  x: import("zod").ZodNumber;
518
541
  y: import("zod").ZodNumber;
@@ -538,6 +561,7 @@ export declare const business: {
538
561
  schemas: Record<string, import("zod").objectOutputType<{
539
562
  type: import("zod").ZodString;
540
563
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
564
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
541
565
  position: import("zod").ZodObject<{
542
566
  x: import("zod").ZodNumber;
543
567
  y: import("zod").ZodNumber;
@@ -561,6 +585,7 @@ export declare const business: {
561
585
  schemas: Record<string, import("zod").objectOutputType<{
562
586
  type: import("zod").ZodString;
563
587
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
588
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
564
589
  position: import("zod").ZodObject<{
565
590
  x: import("zod").ZodNumber;
566
591
  y: import("zod").ZodNumber;
@@ -584,6 +609,7 @@ export declare const business: {
584
609
  schemas: Record<string, import("zod").objectOutputType<{
585
610
  type: import("zod").ZodString;
586
611
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
612
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
587
613
  position: import("zod").ZodObject<{
588
614
  x: import("zod").ZodNumber;
589
615
  y: import("zod").ZodNumber;
@@ -607,6 +633,7 @@ export declare const business: {
607
633
  schemas: Record<string, import("zod").objectOutputType<{
608
634
  type: import("zod").ZodString;
609
635
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
636
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
610
637
  position: import("zod").ZodObject<{
611
638
  x: import("zod").ZodNumber;
612
639
  y: import("zod").ZodNumber;
@@ -630,6 +657,7 @@ export declare const business: {
630
657
  schemas: Record<string, import("zod").objectOutputType<{
631
658
  type: import("zod").ZodString;
632
659
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
660
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
633
661
  position: import("zod").ZodObject<{
634
662
  x: import("zod").ZodNumber;
635
663
  y: import("zod").ZodNumber;
@@ -653,6 +681,7 @@ export declare const business: {
653
681
  schemas: Record<string, import("zod").objectOutputType<{
654
682
  type: import("zod").ZodString;
655
683
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
684
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
656
685
  position: import("zod").ZodObject<{
657
686
  x: import("zod").ZodNumber;
658
687
  y: import("zod").ZodNumber;
@@ -676,6 +705,7 @@ export declare const business: {
676
705
  schemas: Record<string, import("zod").objectOutputType<{
677
706
  type: import("zod").ZodString;
678
707
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
708
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
679
709
  position: import("zod").ZodObject<{
680
710
  x: import("zod").ZodNumber;
681
711
  y: import("zod").ZodNumber;
@@ -699,6 +729,7 @@ export declare const business: {
699
729
  schemas: Record<string, import("zod").objectOutputType<{
700
730
  type: import("zod").ZodString;
701
731
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
732
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
702
733
  position: import("zod").ZodObject<{
703
734
  x: import("zod").ZodNumber;
704
735
  y: import("zod").ZodNumber;
@@ -722,6 +753,7 @@ export declare const business: {
722
753
  schemas: Record<string, import("zod").objectOutputType<{
723
754
  type: import("zod").ZodString;
724
755
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
756
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
725
757
  position: import("zod").ZodObject<{
726
758
  x: import("zod").ZodNumber;
727
759
  y: import("zod").ZodNumber;
@@ -747,6 +779,7 @@ export declare const textType: {
747
779
  schemas: Record<string, import("zod").objectOutputType<{
748
780
  type: import("zod").ZodString;
749
781
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
782
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
750
783
  position: import("zod").ZodObject<{
751
784
  x: import("zod").ZodNumber;
752
785
  y: import("zod").ZodNumber;
@@ -770,6 +803,7 @@ export declare const textType: {
770
803
  schemas: Record<string, import("zod").objectOutputType<{
771
804
  type: import("zod").ZodString;
772
805
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
806
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
773
807
  position: import("zod").ZodObject<{
774
808
  x: import("zod").ZodNumber;
775
809
  y: import("zod").ZodNumber;
@@ -793,6 +827,7 @@ export declare const textType: {
793
827
  schemas: Record<string, import("zod").objectOutputType<{
794
828
  type: import("zod").ZodString;
795
829
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
830
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
796
831
  position: import("zod").ZodObject<{
797
832
  x: import("zod").ZodNumber;
798
833
  y: import("zod").ZodNumber;
@@ -816,6 +851,7 @@ export declare const textType: {
816
851
  schemas: Record<string, import("zod").objectOutputType<{
817
852
  type: import("zod").ZodString;
818
853
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
854
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
819
855
  position: import("zod").ZodObject<{
820
856
  x: import("zod").ZodNumber;
821
857
  y: import("zod").ZodNumber;
@@ -839,6 +875,7 @@ export declare const textType: {
839
875
  schemas: Record<string, import("zod").objectOutputType<{
840
876
  type: import("zod").ZodString;
841
877
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
878
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
842
879
  position: import("zod").ZodObject<{
843
880
  x: import("zod").ZodNumber;
844
881
  y: import("zod").ZodNumber;
@@ -864,6 +901,7 @@ export declare const other: {
864
901
  schemas: Record<string, import("zod").objectOutputType<{
865
902
  type: import("zod").ZodString;
866
903
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
904
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
867
905
  position: import("zod").ZodObject<{
868
906
  x: import("zod").ZodNumber;
869
907
  y: import("zod").ZodNumber;
@@ -887,6 +925,7 @@ export declare const other: {
887
925
  schemas: Record<string, import("zod").objectOutputType<{
888
926
  type: import("zod").ZodString;
889
927
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
928
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
890
929
  position: import("zod").ZodObject<{
891
930
  x: import("zod").ZodNumber;
892
931
  y: import("zod").ZodNumber;
@@ -910,6 +949,7 @@ export declare const other: {
910
949
  schemas: Record<string, import("zod").objectOutputType<{
911
950
  type: import("zod").ZodString;
912
951
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
952
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
913
953
  position: import("zod").ZodObject<{
914
954
  x: import("zod").ZodNumber;
915
955
  y: import("zod").ZodNumber;
@@ -933,6 +973,7 @@ export declare const other: {
933
973
  schemas: Record<string, import("zod").objectOutputType<{
934
974
  type: import("zod").ZodString;
935
975
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
976
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
936
977
  position: import("zod").ZodObject<{
937
978
  x: import("zod").ZodNumber;
938
979
  y: import("zod").ZodNumber;
@@ -956,6 +997,57 @@ export declare const other: {
956
997
  schemas: Record<string, import("zod").objectOutputType<{
957
998
  type: import("zod").ZodString;
958
999
  readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
1000
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
1001
+ position: import("zod").ZodObject<{
1002
+ x: import("zod").ZodNumber;
1003
+ y: import("zod").ZodNumber;
1004
+ }, "strip", import("zod").ZodTypeAny, {
1005
+ x: number;
1006
+ y: number;
1007
+ }, {
1008
+ x: number;
1009
+ y: number;
1010
+ }>;
1011
+ width: import("zod").ZodNumber;
1012
+ height: import("zod").ZodNumber;
1013
+ rotate: import("zod").ZodOptional<import("zod").ZodNumber>;
1014
+ opacity: import("zod").ZodOptional<import("zod").ZodNumber>;
1015
+ }, import("zod").ZodTypeAny, "passthrough">>[];
1016
+ basePdf: (string | ArrayBuffer | Uint8Array) & (string | ArrayBuffer | Uint8Array | undefined);
1017
+ sampledata?: Record<string, string>[] | undefined;
1018
+ columns?: string[] | undefined;
1019
+ };
1020
+ pet: {
1021
+ schemas: Record<string, import("zod").objectOutputType<{
1022
+ type: import("zod").ZodString;
1023
+ readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
1024
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
1025
+ position: import("zod").ZodObject<{
1026
+ x: import("zod").ZodNumber;
1027
+ y: import("zod").ZodNumber;
1028
+ }, "strip", import("zod").ZodTypeAny, {
1029
+ x: number;
1030
+ y: number;
1031
+ }, {
1032
+ x: number;
1033
+ y: number;
1034
+ }>;
1035
+ width: import("zod").ZodNumber;
1036
+ height: import("zod").ZodNumber;
1037
+ rotate: import("zod").ZodOptional<import("zod").ZodNumber>;
1038
+ opacity: import("zod").ZodOptional<import("zod").ZodNumber>;
1039
+ }, import("zod").ZodTypeAny, "passthrough">>[];
1040
+ basePdf: (string | ArrayBuffer | Uint8Array) & (string | ArrayBuffer | Uint8Array | undefined);
1041
+ sampledata?: Record<string, string>[] | undefined;
1042
+ columns?: string[] | undefined;
1043
+ };
1044
+ };
1045
+ export declare const shape: {
1046
+ shapes: {
1047
+ schemas: Record<string, import("zod").objectOutputType<{
1048
+ type: import("zod").ZodString;
1049
+ readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
1050
+ readOnlyValue: import("zod").ZodOptional<import("zod").ZodString>;
959
1051
  position: import("zod").ZodObject<{
960
1052
  x: import("zod").ZodNumber;
961
1053
  y: import("zod").ZodNumber;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdfme/generator",
3
- "version": "3.1.5-dev.9",
3
+ "version": "3.2.0",
4
4
  "sideEffects": false,
5
5
  "author": "hand-dot",
6
6
  "license": "MIT",
@@ -32,7 +32,7 @@
32
32
  }
33
33
  },
34
34
  "scripts": {
35
- "develop": "tsc -p tsconfig.esm.json -w",
35
+ "dev": "tsc -p tsconfig.esm.json -w",
36
36
  "build": "npm-run-all --parallel build:cjs build:esm",
37
37
  "build:cjs": "tsc -p tsconfig.cjs.json",
38
38
  "build:esm": "tsc -p tsconfig.esm.json",
@@ -43,7 +43,7 @@
43
43
  "prettier": "prettier --write 'src/**/*.ts'"
44
44
  },
45
45
  "dependencies": {
46
- "@pdfme/pdf-lib": "^1.17.3",
46
+ "@pdfme/pdf-lib": "^1.18.3",
47
47
  "atob": "^2.1.2",
48
48
  "fontkit": "^2.0.2"
49
49
  },
package/src/generate.ts CHANGED
@@ -7,14 +7,21 @@ const generate = async (props: GenerateProps) => {
7
7
  checkGenerateProps(props);
8
8
  const { inputs, template, options = {}, plugins: userPlugins = {} } = props;
9
9
 
10
+ if (inputs.length === 0) {
11
+ throw new Error('inputs should not be empty');
12
+ }
13
+
10
14
  const { pdfDoc, embeddedPages, embedPdfBoxes, renderObj, readOnlySchemaKeys } =
11
15
  await preprocessing({ template, userPlugins });
12
16
 
13
- const _cache = new Map();
17
+ const keys = readOnlySchemaKeys.concat(Object.keys(inputs[0]));
18
+ if (template.columns) {
19
+ keys.sort((a, b) => (template.columns ?? []).indexOf(a) - (template.columns ?? []).indexOf(b));
20
+ }
14
21
 
22
+ const _cache = new Map();
15
23
  for (let i = 0; i < inputs.length; i += 1) {
16
24
  const inputObj = inputs[i];
17
- const keys = Object.keys(inputObj).concat(readOnlySchemaKeys);
18
25
  for (let j = 0; j < embeddedPages.length; j += 1) {
19
26
  const embeddedPage = embeddedPages[j];
20
27
  const { width: pageWidth, height: pageHeight } = embeddedPage;
@@ -35,8 +42,8 @@ const generate = async (props: GenerateProps) => {
35
42
  if (!render) {
36
43
  continue;
37
44
  }
38
-
39
- await render({ key, value: inputObj[key], schema, pdfLib, pdfDoc, page, options, _cache });
45
+ const value = schema.readOnly ? schema.readOnlyValue || '' : inputObj[key];
46
+ await render({ key, value, schema, pdfLib, pdfDoc, page, options, _cache });
40
47
  }
41
48
  }
42
49
  }