@coopenomics/factory 2025.5.5 → 2025.5.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -574,7 +574,8 @@ const Schema$l = {
574
574
  nullable: true
575
575
  },
576
576
  signature: {
577
- type: "string"
577
+ type: "string",
578
+ nullable: true
578
579
  },
579
580
  vars: VarsSchema,
580
581
  meta: {
@@ -584,9 +585,25 @@ const Schema$l = {
584
585
  },
585
586
  required: [...IMetaJSONSchema.required],
586
587
  additionalProperties: true
588
+ },
589
+ initial: {
590
+ type: "string",
591
+ nullable: true
592
+ },
593
+ minimum: {
594
+ type: "string",
595
+ nullable: true
596
+ },
597
+ org_initial: {
598
+ type: "string",
599
+ nullable: true
600
+ },
601
+ org_minimum: {
602
+ type: "string",
603
+ nullable: true
587
604
  }
588
605
  },
589
- required: ["meta", "coop", "type", "signature"],
606
+ required: ["meta", "coop", "type"],
590
607
  additionalProperties: true
591
608
  };
592
609
  const Template$l = {
@@ -904,9 +921,10 @@ const CommonUserSchema = {
904
921
  type: "object",
905
922
  properties: {
906
923
  full_name_or_short_name: { type: "string" },
907
- birthdate_or_ogrn: { type: "string" }
924
+ birthdate_or_ogrn: { type: "string" },
925
+ abbr_full_name: { type: "string" }
908
926
  },
909
- required: ["full_name_or_short_name", "birthdate_or_ogrn"],
927
+ required: ["full_name_or_short_name", "birthdate_or_ogrn", "abbr_full_name"],
910
928
  additionalProperties: true
911
929
  };
912
930
 
@@ -2171,7 +2189,7 @@ class PDFService {
2171
2189
 
2172
2190
  const name = "@coopenomics/factory";
2173
2191
  const type = "module";
2174
- const version = "2025.5.5";
2192
+ const version = "2025.5.13";
2175
2193
  const packageManager = "pnpm@9.0.6";
2176
2194
  const description = "";
2177
2195
  const author = "Alex Ant <chairman.voskhod@gmail.com>";
@@ -2207,6 +2225,7 @@ const files = [
2207
2225
  "dist"
2208
2226
  ];
2209
2227
  const scripts = {
2228
+ prebuild: "pnpm run typecheck",
2210
2229
  build: "unbuild",
2211
2230
  dev: "concurrently -n 'GENERATOR' -c 'bgGreen.black' \"nodemon --watch src --ext ts --exec 'unbuild'\"",
2212
2231
  lint: "eslint .",
@@ -2220,7 +2239,7 @@ const dependencies = {
2220
2239
  "ajv-formats": "^3.0.1",
2221
2240
  "ajv-i18n": "^4.2.0",
2222
2241
  axios: "^1.7.2",
2223
- cooptypes: "2025.5.5",
2242
+ cooptypes: "2025.5.13",
2224
2243
  dotenv: "^16.4.5",
2225
2244
  "eosjs-ecc": "^4.0.7",
2226
2245
  handlebars: "^4.7.8",
@@ -2261,7 +2280,7 @@ const pnpm = {
2261
2280
  "vite@>=5.1.0 <=5.1.6": ">=5.1.7"
2262
2281
  }
2263
2282
  };
2264
- const gitHead = "552333faf62def272fc8309a1d5c600fe21bd16f";
2283
+ const gitHead = "a09959d75164067d5a5a507a3554787d88ed45d3";
2265
2284
  const packageJson = {
2266
2285
  name: name,
2267
2286
  type: type,
@@ -2599,6 +2618,15 @@ class DocFactory {
2599
2618
  ...restParams
2600
2619
  };
2601
2620
  }
2621
+ formatAsset(asset, precision = 2) {
2622
+ if (!asset)
2623
+ return "";
2624
+ const match = asset.match(/^(\d+\.\d+)\s+([A-Z]+)$/);
2625
+ if (!match)
2626
+ return asset;
2627
+ const [, amount, symbol] = match;
2628
+ return `${Number.parseFloat(amount).toFixed(precision)} ${symbol}`;
2629
+ }
2602
2630
  }
2603
2631
 
2604
2632
  let Factory$q = class Factory extends DocFactory {
@@ -2802,7 +2830,6 @@ let Factory$k = class Factory extends DocFactory {
2802
2830
  let branch;
2803
2831
  if (data.braname)
2804
2832
  branch = await super.getOrganization(data.braname, data.block_num);
2805
- console.log(branch);
2806
2833
  let { signature, ...modifieddata } = data;
2807
2834
  const meta = await super.getMeta({ title: template.title, ...modifieddata });
2808
2835
  const data_service = new DataService$1(this.storage, "signatures");
@@ -2824,7 +2851,19 @@ let Factory$k = class Factory extends DocFactory {
2824
2851
  }
2825
2852
  }
2826
2853
  const vars = await super.getVars(data.coopname, data.block_num);
2827
- const combinedData = { ...userData, meta, coop: extended_coop, branch, type: user.type, vars, signature };
2854
+ const combinedData = {
2855
+ ...userData,
2856
+ meta,
2857
+ coop: extended_coop,
2858
+ branch,
2859
+ type: user.type,
2860
+ vars,
2861
+ signature,
2862
+ initial: super.formatAsset(coop.initial),
2863
+ minimum: super.formatAsset(coop.minimum),
2864
+ org_initial: super.formatAsset(coop.org_initial),
2865
+ org_minimum: super.formatAsset(coop.org_minimum)
2866
+ };
2828
2867
  await super.validate(combinedData, template.model);
2829
2868
  const translation = template.translations[meta.lang];
2830
2869
  const document = await super.generatePDF(user.data, template.context, combinedData, translation, meta, data.skip_save);
package/dist/index.d.cts CHANGED
@@ -559,6 +559,7 @@ declare abstract class DocFactory<T extends IGenerate> {
559
559
  getMeta<T extends IMetaDocumentPartial>({ title, username, coopname, registry_id, links, lang, generator, version, // TODO перенести в .env
560
560
  created_at, block_num, timezone, // TODO перенести в .env
561
561
  ...restParams }: T): Promise<IMetaDocument>;
562
+ formatAsset(asset: string, precision?: number): string;
562
563
  }
563
564
 
564
565
  type dataTypes = 'individual' | 'entrepreneur' | 'organization' | 'paymentMethod' | 'vars' | 'project';
package/dist/index.d.mts CHANGED
@@ -559,6 +559,7 @@ declare abstract class DocFactory<T extends IGenerate> {
559
559
  getMeta<T extends IMetaDocumentPartial>({ title, username, coopname, registry_id, links, lang, generator, version, // TODO перенести в .env
560
560
  created_at, block_num, timezone, // TODO перенести в .env
561
561
  ...restParams }: T): Promise<IMetaDocument>;
562
+ formatAsset(asset: string, precision?: number): string;
562
563
  }
563
564
 
564
565
  type dataTypes = 'individual' | 'entrepreneur' | 'organization' | 'paymentMethod' | 'vars' | 'project';
package/dist/index.d.ts CHANGED
@@ -559,6 +559,7 @@ declare abstract class DocFactory<T extends IGenerate> {
559
559
  getMeta<T extends IMetaDocumentPartial>({ title, username, coopname, registry_id, links, lang, generator, version, // TODO перенести в .env
560
560
  created_at, block_num, timezone, // TODO перенести в .env
561
561
  ...restParams }: T): Promise<IMetaDocument>;
562
+ formatAsset(asset: string, precision?: number): string;
562
563
  }
563
564
 
564
565
  type dataTypes = 'individual' | 'entrepreneur' | 'organization' | 'paymentMethod' | 'vars' | 'project';
package/dist/index.mjs CHANGED
@@ -561,7 +561,8 @@ const Schema$l = {
561
561
  nullable: true
562
562
  },
563
563
  signature: {
564
- type: "string"
564
+ type: "string",
565
+ nullable: true
565
566
  },
566
567
  vars: VarsSchema,
567
568
  meta: {
@@ -571,9 +572,25 @@ const Schema$l = {
571
572
  },
572
573
  required: [...IMetaJSONSchema.required],
573
574
  additionalProperties: true
575
+ },
576
+ initial: {
577
+ type: "string",
578
+ nullable: true
579
+ },
580
+ minimum: {
581
+ type: "string",
582
+ nullable: true
583
+ },
584
+ org_initial: {
585
+ type: "string",
586
+ nullable: true
587
+ },
588
+ org_minimum: {
589
+ type: "string",
590
+ nullable: true
574
591
  }
575
592
  },
576
- required: ["meta", "coop", "type", "signature"],
593
+ required: ["meta", "coop", "type"],
577
594
  additionalProperties: true
578
595
  };
579
596
  const Template$l = {
@@ -891,9 +908,10 @@ const CommonUserSchema = {
891
908
  type: "object",
892
909
  properties: {
893
910
  full_name_or_short_name: { type: "string" },
894
- birthdate_or_ogrn: { type: "string" }
911
+ birthdate_or_ogrn: { type: "string" },
912
+ abbr_full_name: { type: "string" }
895
913
  },
896
- required: ["full_name_or_short_name", "birthdate_or_ogrn"],
914
+ required: ["full_name_or_short_name", "birthdate_or_ogrn", "abbr_full_name"],
897
915
  additionalProperties: true
898
916
  };
899
917
 
@@ -2158,7 +2176,7 @@ class PDFService {
2158
2176
 
2159
2177
  const name = "@coopenomics/factory";
2160
2178
  const type = "module";
2161
- const version = "2025.5.5";
2179
+ const version = "2025.5.13";
2162
2180
  const packageManager = "pnpm@9.0.6";
2163
2181
  const description = "";
2164
2182
  const author = "Alex Ant <chairman.voskhod@gmail.com>";
@@ -2194,6 +2212,7 @@ const files = [
2194
2212
  "dist"
2195
2213
  ];
2196
2214
  const scripts = {
2215
+ prebuild: "pnpm run typecheck",
2197
2216
  build: "unbuild",
2198
2217
  dev: "concurrently -n 'GENERATOR' -c 'bgGreen.black' \"nodemon --watch src --ext ts --exec 'unbuild'\"",
2199
2218
  lint: "eslint .",
@@ -2207,7 +2226,7 @@ const dependencies = {
2207
2226
  "ajv-formats": "^3.0.1",
2208
2227
  "ajv-i18n": "^4.2.0",
2209
2228
  axios: "^1.7.2",
2210
- cooptypes: "2025.5.5",
2229
+ cooptypes: "2025.5.13",
2211
2230
  dotenv: "^16.4.5",
2212
2231
  "eosjs-ecc": "^4.0.7",
2213
2232
  handlebars: "^4.7.8",
@@ -2248,7 +2267,7 @@ const pnpm = {
2248
2267
  "vite@>=5.1.0 <=5.1.6": ">=5.1.7"
2249
2268
  }
2250
2269
  };
2251
- const gitHead = "552333faf62def272fc8309a1d5c600fe21bd16f";
2270
+ const gitHead = "a09959d75164067d5a5a507a3554787d88ed45d3";
2252
2271
  const packageJson = {
2253
2272
  name: name,
2254
2273
  type: type,
@@ -2586,6 +2605,15 @@ class DocFactory {
2586
2605
  ...restParams
2587
2606
  };
2588
2607
  }
2608
+ formatAsset(asset, precision = 2) {
2609
+ if (!asset)
2610
+ return "";
2611
+ const match = asset.match(/^(\d+\.\d+)\s+([A-Z]+)$/);
2612
+ if (!match)
2613
+ return asset;
2614
+ const [, amount, symbol] = match;
2615
+ return `${Number.parseFloat(amount).toFixed(precision)} ${symbol}`;
2616
+ }
2589
2617
  }
2590
2618
 
2591
2619
  let Factory$q = class Factory extends DocFactory {
@@ -2789,7 +2817,6 @@ let Factory$k = class Factory extends DocFactory {
2789
2817
  let branch;
2790
2818
  if (data.braname)
2791
2819
  branch = await super.getOrganization(data.braname, data.block_num);
2792
- console.log(branch);
2793
2820
  let { signature, ...modifieddata } = data;
2794
2821
  const meta = await super.getMeta({ title: template.title, ...modifieddata });
2795
2822
  const data_service = new DataService$1(this.storage, "signatures");
@@ -2811,7 +2838,19 @@ let Factory$k = class Factory extends DocFactory {
2811
2838
  }
2812
2839
  }
2813
2840
  const vars = await super.getVars(data.coopname, data.block_num);
2814
- const combinedData = { ...userData, meta, coop: extended_coop, branch, type: user.type, vars, signature };
2841
+ const combinedData = {
2842
+ ...userData,
2843
+ meta,
2844
+ coop: extended_coop,
2845
+ branch,
2846
+ type: user.type,
2847
+ vars,
2848
+ signature,
2849
+ initial: super.formatAsset(coop.initial),
2850
+ minimum: super.formatAsset(coop.minimum),
2851
+ org_initial: super.formatAsset(coop.org_initial),
2852
+ org_minimum: super.formatAsset(coop.org_minimum)
2853
+ };
2815
2854
  await super.validate(combinedData, template.model);
2816
2855
  const translation = template.translations[meta.lang];
2817
2856
  const document = await super.generatePDF(user.data, template.context, combinedData, translation, meta, data.skip_save);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coopenomics/factory",
3
3
  "type": "module",
4
- "version": "2025.5.5",
4
+ "version": "2025.5.13",
5
5
  "packageManager": "pnpm@9.0.6",
6
6
  "description": "",
7
7
  "author": "Alex Ant <chairman.voskhod@gmail.com>",
@@ -36,6 +36,7 @@
36
36
  "dist"
37
37
  ],
38
38
  "scripts": {
39
+ "prebuild": "pnpm run typecheck",
39
40
  "build": "unbuild",
40
41
  "dev": "concurrently -n 'GENERATOR' -c 'bgGreen.black' \"nodemon --watch src --ext ts --exec 'unbuild'\"",
41
42
  "lint": "eslint .",
@@ -49,7 +50,7 @@
49
50
  "ajv-formats": "^3.0.1",
50
51
  "ajv-i18n": "^4.2.0",
51
52
  "axios": "^1.7.2",
52
- "cooptypes": "2025.5.5",
53
+ "cooptypes": "2025.5.13",
53
54
  "dotenv": "^16.4.5",
54
55
  "eosjs-ecc": "^4.0.7",
55
56
  "handlebars": "^4.7.8",
@@ -90,5 +91,5 @@
90
91
  "vite@>=5.1.0 <=5.1.6": ">=5.1.7"
91
92
  }
92
93
  },
93
- "gitHead": "552333faf62def272fc8309a1d5c600fe21bd16f"
94
+ "gitHead": "a09959d75164067d5a5a507a3554787d88ed45d3"
94
95
  }