@coopenomics/docs-factory 1.2.0 → 1.4.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.
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  import { createHash } from 'node:crypto';
2
2
  import moment from 'moment-timezone';
3
- import { RegistratorContract, SovietContract, DraftContract, Cooperative as Cooperative$1 } from 'cooptypes';
3
+ import { RegistratorContract, SovietContract, DraftContract } from 'cooptypes';
4
4
  import Ajv from 'ajv';
5
5
  import addFormats from 'ajv-formats';
6
6
  import localize_ru from 'ajv-i18n/localize/ru';
7
7
  import { Buffer as Buffer$1 } from 'node:buffer';
8
- import { Registry as Registry$1 } from '@coopenomics/docs-templates';
8
+ import { Registry as Registry$1, UdataKey } from '@coopenomics/docs-templates';
9
9
  import fs from 'node:fs';
10
10
  import os from 'node:os';
11
11
  import path from 'node:path';
@@ -2616,9 +2616,23 @@ const registry_id$M = Registry$1.CapitalizationPropertyInvestStatement.registry_
2616
2616
  const Schema$M = {
2617
2617
  type: "object",
2618
2618
  properties: {
2619
- meta: IMetaJSONSchema
2620
- },
2621
- required: ["meta"],
2619
+ meta: IMetaJSONSchema,
2620
+ coop: CooperativeSchema,
2621
+ vars: VarsSchema,
2622
+ common_user: CommonUserSchema,
2623
+ contributor_contract_number: { type: "string" },
2624
+ contributor_contract_created_at: { type: "string" },
2625
+ blagorost_agreement_number: { type: "string" },
2626
+ blagorost_agreement_created_at: { type: "string" },
2627
+ property_hash: { type: "string" },
2628
+ property_short_hash: { type: "string" },
2629
+ property_name: { type: "string" },
2630
+ property_description: { type: "string" },
2631
+ property_quantity: { type: "string" },
2632
+ property_unit: { type: "string" },
2633
+ property_amount: { type: "string" }
2634
+ },
2635
+ required: ["meta", "coop", "vars", "common_user", "contributor_contract_number", "contributor_contract_created_at", "blagorost_agreement_number", "blagorost_agreement_created_at", "property_hash", "property_short_hash", "property_name", "property_description", "property_quantity", "property_unit", "property_amount"],
2622
2636
  additionalProperties: true
2623
2637
  };
2624
2638
  const Template$M = {
@@ -2640,9 +2654,24 @@ const registry_id$L = Registry$1.CapitalizationPropertyInvestDecision.registry_i
2640
2654
  const Schema$L = {
2641
2655
  type: "object",
2642
2656
  properties: {
2643
- meta: IMetaJSONSchema
2644
- },
2645
- required: ["meta"],
2657
+ meta: IMetaJSONSchema,
2658
+ coop: CooperativeSchema,
2659
+ vars: VarsSchema,
2660
+ decision: decisionSchema,
2661
+ common_user: CommonUserSchema,
2662
+ contributor_contract_number: { type: "string" },
2663
+ contributor_contract_created_at: { type: "string" },
2664
+ blagorost_agreement_number: { type: "string" },
2665
+ blagorost_agreement_created_at: { type: "string" },
2666
+ property_hash: { type: "string" },
2667
+ property_short_hash: { type: "string" },
2668
+ property_name: { type: "string" },
2669
+ property_description: { type: "string" },
2670
+ property_quantity: { type: "string" },
2671
+ property_unit: { type: "string" },
2672
+ property_amount: { type: "string" }
2673
+ },
2674
+ required: ["meta", "coop", "vars", "decision", "common_user", "contributor_contract_number", "contributor_contract_created_at", "blagorost_agreement_number", "blagorost_agreement_created_at", "property_hash", "property_short_hash", "property_name", "property_description", "property_quantity", "property_unit", "property_amount"],
2646
2675
  additionalProperties: true
2647
2676
  };
2648
2677
  const Template$L = {
@@ -2664,9 +2693,24 @@ const registry_id$K = Registry$1.CapitalizationPropertyInvestAct.registry_id;
2664
2693
  const Schema$K = {
2665
2694
  type: "object",
2666
2695
  properties: {
2667
- meta: IMetaJSONSchema
2668
- },
2669
- required: ["meta"],
2696
+ meta: IMetaJSONSchema,
2697
+ coop: CooperativeSchema,
2698
+ vars: VarsSchema,
2699
+ decision: decisionSchema,
2700
+ common_user: CommonUserSchema,
2701
+ contributor_contract_number: { type: "string" },
2702
+ contributor_contract_created_at: { type: "string" },
2703
+ blagorost_agreement_number: { type: "string" },
2704
+ blagorost_agreement_created_at: { type: "string" },
2705
+ property_hash: { type: "string" },
2706
+ property_short_hash: { type: "string" },
2707
+ property_name: { type: "string" },
2708
+ property_description: { type: "string" },
2709
+ property_quantity: { type: "string" },
2710
+ property_unit: { type: "string" },
2711
+ property_amount: { type: "string" }
2712
+ },
2713
+ required: ["meta", "coop", "vars", "decision", "common_user", "contributor_contract_number", "contributor_contract_created_at", "blagorost_agreement_number", "blagorost_agreement_created_at", "property_hash", "property_short_hash", "property_name", "property_description", "property_quantity", "property_unit", "property_amount"],
2670
2714
  additionalProperties: true
2671
2715
  };
2672
2716
  const Template$K = {
@@ -5031,7 +5075,7 @@ function latestMinorOf(versions, major) {
5031
5075
 
5032
5076
  const name = "@coopenomics/docs-factory";
5033
5077
  const type = "module";
5034
- const version = "1.2.0";
5078
+ const version = "1.4.0";
5035
5079
  const description = "Фабрика документов цифрового кооператива: сборка документов по шаблонам, сборщики всех видов документов, версии сборщиков";
5036
5080
  const author = "Alex Ant <chairman.voskhod@gmail.com>";
5037
5081
  const license = "MIT";
@@ -7465,8 +7509,8 @@ const Factory$19 = defineBuilder()({
7465
7509
  vars: () => f.getVars(data.coopname, data.block_num),
7466
7510
  coop: () => f.getCooperative(data.coopname, data.block_num),
7467
7511
  userData: () => f.getUser(data.username, data.block_num),
7468
- blagorostAgreementUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_AGREEMENT_NUMBER),
7469
- blagorostAgreementCreatedAtUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_AGREEMENT_CREATED_AT),
7512
+ blagorostAgreementUdata: udata(UdataKey.BLAGOROST_AGREEMENT_NUMBER),
7513
+ blagorostAgreementCreatedAtUdata: udata(UdataKey.BLAGOROST_AGREEMENT_CREATED_AT),
7470
7514
  docData: () => f.loadDocData(data)
7471
7515
  };
7472
7516
  },
@@ -7505,7 +7549,7 @@ const Factory$18 = defineBuilder()({
7505
7549
  coop: () => f.getCooperative(data.coopname, data.block_num),
7506
7550
  vars: () => f.getVars(data.coopname, data.block_num),
7507
7551
  userData: () => f.getUser(data.username, data.block_num),
7508
- contributorContractUdata: () => f.getUdata({ coopname: data.coopname, username: data.username, key: Cooperative$1.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER, block_num: data.block_num })
7552
+ contributorContractUdata: () => f.getUdata({ coopname: data.coopname, username: data.username, key: UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER, block_num: data.block_num })
7509
7553
  }),
7510
7554
  assemble: ({ data, meta, reads: { coop, vars, userData, contributorContractUdata } }) => {
7511
7555
  if (!vars.generation_contract_template?.protocol_number || !vars.generation_contract_template?.protocol_day_month_year)
@@ -7540,10 +7584,10 @@ const Factory$17 = defineBuilder()({
7540
7584
  coop: () => f.getCooperative(data.coopname, data.block_num),
7541
7585
  vars: () => f.getVars(data.coopname, data.block_num),
7542
7586
  userData: () => f.getUser(data.username, data.block_num),
7543
- generatorAgreementUdata: udata(Cooperative$1.Model.UdataKey.GENERATOR_AGREEMENT_NUMBER),
7544
- generatorAgreementCreatedAtUdata: udata(Cooperative$1.Model.UdataKey.GENERATOR_AGREEMENT_CREATED_AT),
7545
- contributorContractUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER),
7546
- contributorContractCreatedAtUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT)
7587
+ generatorAgreementUdata: udata(UdataKey.GENERATOR_AGREEMENT_NUMBER),
7588
+ generatorAgreementCreatedAtUdata: udata(UdataKey.GENERATOR_AGREEMENT_CREATED_AT),
7589
+ contributorContractUdata: udata(UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER),
7590
+ contributorContractCreatedAtUdata: udata(UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT)
7547
7591
  };
7548
7592
  },
7549
7593
  assemble: ({ data, meta, reads: { coop, vars, userData, generatorAgreementUdata, generatorAgreementCreatedAtUdata, contributorContractUdata, contributorContractCreatedAtUdata } }) => {
@@ -7587,10 +7631,10 @@ const Factory$16 = defineBuilder()({
7587
7631
  coop: () => f.getCooperative(data.coopname, data.block_num),
7588
7632
  vars: () => f.getVars(data.coopname, data.block_num),
7589
7633
  userData: () => f.getUser(data.username, data.block_num),
7590
- generatorAgreementUdata: udata(Cooperative$1.Model.UdataKey.GENERATOR_AGREEMENT_NUMBER),
7591
- generatorAgreementCreatedAtUdata: udata(Cooperative$1.Model.UdataKey.GENERATOR_AGREEMENT_CREATED_AT),
7592
- contributorContractUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER),
7593
- contributorContractCreatedAtUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT)
7634
+ generatorAgreementUdata: udata(UdataKey.GENERATOR_AGREEMENT_NUMBER),
7635
+ generatorAgreementCreatedAtUdata: udata(UdataKey.GENERATOR_AGREEMENT_CREATED_AT),
7636
+ contributorContractUdata: udata(UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER),
7637
+ contributorContractCreatedAtUdata: udata(UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT)
7594
7638
  };
7595
7639
  },
7596
7640
  assemble: ({ data, meta, reads: { coop, vars, userData, generatorAgreementUdata, generatorAgreementCreatedAtUdata, contributorContractUdata, contributorContractCreatedAtUdata } }) => {
@@ -7636,11 +7680,11 @@ const Factory$15 = defineBuilder()({
7636
7680
  coop: () => f.getCooperative(data.coopname, data.block_num),
7637
7681
  vars: () => f.getVars(data.coopname, data.block_num),
7638
7682
  userData: () => f.getUser(data.username, data.block_num),
7639
- storageAgreementUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_STORAGE_AGREEMENT_NUMBER),
7640
- storageAgreementCreatedAtUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_STORAGE_AGREEMENT_CREATED_AT),
7641
- contributorContractUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER),
7642
- generatorAgreementUdata: udata(Cooperative$1.Model.UdataKey.GENERATOR_AGREEMENT_NUMBER),
7643
- generatorAgreementCreatedAtUdata: udata(Cooperative$1.Model.UdataKey.GENERATOR_AGREEMENT_CREATED_AT)
7683
+ storageAgreementUdata: udata(UdataKey.BLAGOROST_STORAGE_AGREEMENT_NUMBER),
7684
+ storageAgreementCreatedAtUdata: udata(UdataKey.BLAGOROST_STORAGE_AGREEMENT_CREATED_AT),
7685
+ contributorContractUdata: udata(UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER),
7686
+ generatorAgreementUdata: udata(UdataKey.GENERATOR_AGREEMENT_NUMBER),
7687
+ generatorAgreementCreatedAtUdata: udata(UdataKey.GENERATOR_AGREEMENT_CREATED_AT)
7644
7688
  };
7645
7689
  },
7646
7690
  assemble: ({ data, meta, reads: { coop, vars, userData, storageAgreementUdata, storageAgreementCreatedAtUdata, contributorContractUdata, generatorAgreementUdata, generatorAgreementCreatedAtUdata } }) => {
@@ -7689,9 +7733,9 @@ const Factory$14 = defineBuilder()({
7689
7733
  coop: () => f.getCooperative(data.coopname, data.block_num),
7690
7734
  vars: () => f.getVars(data.coopname, data.block_num),
7691
7735
  userData: () => f.getUser(data.username, data.block_num),
7692
- blagorostAgreementUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_AGREEMENT_NUMBER),
7693
- contributorContractUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER),
7694
- contributorContractCreatedAtUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT)
7736
+ blagorostAgreementUdata: udata(UdataKey.BLAGOROST_AGREEMENT_NUMBER),
7737
+ contributorContractUdata: udata(UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER),
7738
+ contributorContractCreatedAtUdata: udata(UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT)
7695
7739
  };
7696
7740
  },
7697
7741
  assemble: ({ data, meta, reads: { coop, vars, userData, blagorostAgreementUdata, contributorContractUdata, contributorContractCreatedAtUdata } }) => {
@@ -7890,10 +7934,10 @@ const Factory$Z = defineBuilder()({
7890
7934
  coop: () => f.getCooperative(data.coopname, data.block_num),
7891
7935
  vars: () => f.getVars(data.coopname, data.block_num),
7892
7936
  userData: () => f.getUser(data.username, data.block_num),
7893
- contributorContractUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER),
7894
- contributorContractCreatedAtUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT),
7895
- blagorostAgreementUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_AGREEMENT_NUMBER),
7896
- blagorostAgreementCreatedAtUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_AGREEMENT_CREATED_AT)
7937
+ contributorContractUdata: udata(UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER),
7938
+ contributorContractCreatedAtUdata: udata(UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT),
7939
+ blagorostAgreementUdata: udata(UdataKey.BLAGOROST_AGREEMENT_NUMBER),
7940
+ blagorostAgreementCreatedAtUdata: udata(UdataKey.BLAGOROST_AGREEMENT_CREATED_AT)
7897
7941
  };
7898
7942
  },
7899
7943
  assemble: ({ data, meta, reads: { coop, vars, userData, contributorContractUdata, contributorContractCreatedAtUdata, blagorostAgreementUdata, blagorostAgreementCreatedAtUdata } }) => {
@@ -7937,10 +7981,10 @@ const Factory$Y = defineBuilder()({
7937
7981
  return {
7938
7982
  vars: () => f.getVars(data.coopname, data.block_num),
7939
7983
  userData: () => f.getUser(data.username, data.block_num),
7940
- contributorContractUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER),
7941
- contributorContractCreatedAtUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT),
7942
- generatorAgreementUdata: udata(Cooperative$1.Model.UdataKey.GENERATOR_AGREEMENT_NUMBER),
7943
- generatorAgreementCreatedAtUdata: udata(Cooperative$1.Model.UdataKey.GENERATOR_AGREEMENT_CREATED_AT)
7984
+ contributorContractUdata: udata(UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER),
7985
+ contributorContractCreatedAtUdata: udata(UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT),
7986
+ generatorAgreementUdata: udata(UdataKey.GENERATOR_AGREEMENT_NUMBER),
7987
+ generatorAgreementCreatedAtUdata: udata(UdataKey.GENERATOR_AGREEMENT_CREATED_AT)
7944
7988
  };
7945
7989
  },
7946
7990
  assemble: ({ data, meta, reads: { vars, userData, contributorContractUdata, contributorContractCreatedAtUdata, generatorAgreementUdata, generatorAgreementCreatedAtUdata } }) => {
@@ -8002,10 +8046,10 @@ const Factory$W = defineBuilder()({
8002
8046
  coop: () => f.getCooperative(data.coopname, data.block_num),
8003
8047
  vars: () => f.getVars(data.coopname, data.block_num),
8004
8048
  userData: () => f.getUser(data.username, data.block_num),
8005
- contributorContractUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER),
8006
- contributorContractCreatedAtUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT),
8007
- blagorostAgreementUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_AGREEMENT_NUMBER),
8008
- blagorostAgreementCreatedAtUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_AGREEMENT_CREATED_AT)
8049
+ contributorContractUdata: udata(UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER),
8050
+ contributorContractCreatedAtUdata: udata(UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT),
8051
+ blagorostAgreementUdata: udata(UdataKey.BLAGOROST_AGREEMENT_NUMBER),
8052
+ blagorostAgreementCreatedAtUdata: udata(UdataKey.BLAGOROST_AGREEMENT_CREATED_AT)
8009
8053
  };
8010
8054
  },
8011
8055
  assemble: ({ data, meta, reads: { coop, vars, userData, contributorContractUdata, contributorContractCreatedAtUdata, blagorostAgreementUdata, blagorostAgreementCreatedAtUdata } }) => {
@@ -8051,10 +8095,10 @@ const Factory$V = defineBuilder()({
8051
8095
  coop: () => f.getCooperative(data.coopname, data.block_num),
8052
8096
  vars: () => f.getVars(data.coopname, data.block_num),
8053
8097
  userData: () => f.getUser(data.username, data.block_num),
8054
- contributorContractUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER),
8055
- contributorContractCreatedAtUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT),
8056
- blagorostAgreementUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_AGREEMENT_NUMBER),
8057
- blagorostAgreementCreatedAtUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_AGREEMENT_CREATED_AT)
8098
+ contributorContractUdata: udata(UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER),
8099
+ contributorContractCreatedAtUdata: udata(UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT),
8100
+ blagorostAgreementUdata: udata(UdataKey.BLAGOROST_AGREEMENT_NUMBER),
8101
+ blagorostAgreementCreatedAtUdata: udata(UdataKey.BLAGOROST_AGREEMENT_CREATED_AT)
8058
8102
  };
8059
8103
  },
8060
8104
  derive: ({ data, f, meta, reads: { coop } }) => ({
@@ -8104,10 +8148,10 @@ const Factory$U = defineBuilder()({
8104
8148
  coop: () => f.getCooperative(data.coopname, data.block_num),
8105
8149
  vars: () => f.getVars(data.coopname, data.block_num),
8106
8150
  userData: () => f.getUser(data.username, data.block_num),
8107
- contributorContractUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER),
8108
- contributorContractCreatedAtUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT),
8109
- blagorostAgreementUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_AGREEMENT_NUMBER),
8110
- blagorostAgreementCreatedAtUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_AGREEMENT_CREATED_AT)
8151
+ contributorContractUdata: udata(UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER),
8152
+ contributorContractCreatedAtUdata: udata(UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT),
8153
+ blagorostAgreementUdata: udata(UdataKey.BLAGOROST_AGREEMENT_NUMBER),
8154
+ blagorostAgreementCreatedAtUdata: udata(UdataKey.BLAGOROST_AGREEMENT_CREATED_AT)
8111
8155
  };
8112
8156
  },
8113
8157
  derive: ({ data, f, reads: { coop } }) => ({
@@ -8212,16 +8256,74 @@ const _1062_GenerationPropertyInvestAct = {
8212
8256
  Template: GenerationPropertyInvestAct
8213
8257
  };
8214
8258
 
8259
+ async function getBlagorostContractRef(sources, data) {
8260
+ const read = (key) => sources.udata({ coopname: data.coopname, username: data.username, key, block_num: data.block_num });
8261
+ const [contractNumber, contractCreatedAt, agreementNumber, agreementCreatedAt] = await Promise.all([
8262
+ read(UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER),
8263
+ read(UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT),
8264
+ read(UdataKey.BLAGOROST_AGREEMENT_NUMBER),
8265
+ read(UdataKey.BLAGOROST_AGREEMENT_CREATED_AT)
8266
+ ]);
8267
+ if (!contractNumber?.value)
8268
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u0434\u043E\u0433\u043E\u0432\u043E\u0440\u0430 \u0423\u0425\u0414 \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B \u0432 Udata");
8269
+ if (!contractCreatedAt?.value)
8270
+ throw new Error("\u0414\u0430\u0442\u0430 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0434\u043E\u0433\u043E\u0432\u043E\u0440\u0430 \u0423\u0425\u0414 \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u0432 Udata");
8271
+ if (!agreementNumber?.value)
8272
+ throw new Error("\u0414\u0430\u043D\u043D\u044B\u0435 \u0441\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u044F \u0431\u043B\u0430\u0433\u043E\u0440\u043E\u0441\u0442\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B \u0432 Udata");
8273
+ if (!agreementCreatedAt?.value)
8274
+ throw new Error("\u0414\u0430\u0442\u0430 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0441\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u044F \u0431\u043B\u0430\u0433\u043E\u0440\u043E\u0441\u0442\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u0432 Udata");
8275
+ return {
8276
+ contributor_contract_number: String(contractNumber.value),
8277
+ contributor_contract_created_at: String(contractCreatedAt.value),
8278
+ blagorost_agreement_number: String(agreementNumber.value),
8279
+ blagorost_agreement_created_at: String(agreementCreatedAt.value)
8280
+ };
8281
+ }
8282
+ function propertyPositionFields(data) {
8283
+ return {
8284
+ property_hash: data.property_hash,
8285
+ property_short_hash: shortHash(data.property_hash),
8286
+ property_name: data.property_name,
8287
+ property_description: data.property_description,
8288
+ property_quantity: data.property_quantity,
8289
+ property_unit: data.property_unit,
8290
+ property_amount: formatAsset(data.property_amount)
8291
+ };
8292
+ }
8293
+
8215
8294
  const Factory$O = defineBuilder()({
8216
8295
  registry_id: registry_id$M,
8217
8296
  version: "1.0",
8218
8297
  reads: () => ({}),
8298
+ // Заглушка 1.0 собирала только мету и документов в цепях не дала; модель шаблона
8299
+ // с версии 1.1 шире (позиция имущества, реквизиты договоров). Код версии заморожен.
8300
+ // @ts-expect-error модель 1.1 требует полей, которых у заглушки нет
8219
8301
  assemble: ({ meta }) => ({ meta })
8220
8302
  });
8303
+ const Factory_1_1$2 = defineBuilder()({
8304
+ registry_id: registry_id$M,
8305
+ version: "1.1",
8306
+ reads: ({ data, f, s }) => ({
8307
+ coop: () => f.getCooperative(data.coopname, data.block_num),
8308
+ vars: () => f.getVars(data.coopname, data.block_num),
8309
+ userData: () => f.getUser(data.username, data.block_num),
8310
+ contract: () => getBlagorostContractRef(s, data)
8311
+ }),
8312
+ assemble: ({ data, meta, reads: { coop, vars, userData, contract } }) => ({
8313
+ meta,
8314
+ coop,
8315
+ vars,
8316
+ common_user: commonUser(userData),
8317
+ ...contract,
8318
+ ...propertyPositionFields(data)
8319
+ }),
8320
+ signer: ({ reads: { userData } }) => commonUser(userData).full_name_or_short_name
8321
+ });
8221
8322
 
8222
8323
  const _1070_CapitalizationPropertyInvestStatement = {
8223
8324
  __proto__: null,
8224
8325
  Factory: Factory$O,
8326
+ Factory_1_1: Factory_1_1$2,
8225
8327
  Template: CapitalizationPropertyInvestStatement
8226
8328
  };
8227
8329
 
@@ -8229,12 +8331,38 @@ const Factory$N = defineBuilder()({
8229
8331
  registry_id: registry_id$L,
8230
8332
  version: "1.0",
8231
8333
  reads: () => ({}),
8334
+ // Заглушка 1.0 собирала только мету и документов в цепях не дала; модель шаблона
8335
+ // с версии 1.1 шире (позиция имущества, реквизиты договоров). Код версии заморожен.
8336
+ // @ts-expect-error модель 1.1 требует полей, которых у заглушки нет
8232
8337
  assemble: ({ meta }) => ({ meta })
8233
8338
  });
8339
+ const Factory_1_1$1 = defineBuilder()({
8340
+ registry_id: registry_id$L,
8341
+ version: "1.1",
8342
+ reads: ({ data, f, s }) => ({
8343
+ coop: () => f.getCooperative(data.coopname, data.block_num),
8344
+ vars: () => f.getVars(data.coopname, data.block_num),
8345
+ userData: () => f.getUser(data.username, data.block_num),
8346
+ contract: () => getBlagorostContractRef(s, data)
8347
+ }),
8348
+ derive: ({ data, f, meta, reads: { coop } }) => ({
8349
+ decision: () => f.getDecision(coop, data.coopname, data.decision_id, meta.created_at, meta.timezone)
8350
+ }),
8351
+ assemble: ({ data, meta, reads: { coop, vars, userData, contract }, derived: { decision } }) => ({
8352
+ meta,
8353
+ coop,
8354
+ vars,
8355
+ decision,
8356
+ common_user: commonUser(userData),
8357
+ ...contract,
8358
+ ...propertyPositionFields(data)
8359
+ })
8360
+ });
8234
8361
 
8235
8362
  const _1071_CapitalizationPropertyInvestDecision = {
8236
8363
  __proto__: null,
8237
8364
  Factory: Factory$N,
8365
+ Factory_1_1: Factory_1_1$1,
8238
8366
  Template: CapitalizationPropertyInvestDecision
8239
8367
  };
8240
8368
 
@@ -8242,12 +8370,39 @@ const Factory$M = defineBuilder()({
8242
8370
  registry_id: registry_id$K,
8243
8371
  version: "1.0",
8244
8372
  reads: () => ({}),
8373
+ // Заглушка 1.0 собирала только мету и документов в цепях не дала; модель шаблона
8374
+ // с версии 1.1 шире (позиция имущества, реквизиты договоров). Код версии заморожен.
8375
+ // @ts-expect-error модель 1.1 требует полей, которых у заглушки нет
8245
8376
  assemble: ({ meta }) => ({ meta })
8246
8377
  });
8378
+ const Factory_1_1 = defineBuilder()({
8379
+ registry_id: registry_id$K,
8380
+ version: "1.1",
8381
+ reads: ({ data, f, s }) => ({
8382
+ coop: () => f.getCooperative(data.coopname, data.block_num),
8383
+ vars: () => f.getVars(data.coopname, data.block_num),
8384
+ userData: () => f.getUser(data.username, data.block_num),
8385
+ contract: () => getBlagorostContractRef(s, data)
8386
+ }),
8387
+ derive: ({ data, f, reads: { coop } }) => ({
8388
+ decision: () => f.getApprovedDecision(coop, data.coopname, data.decision_id)
8389
+ }),
8390
+ assemble: ({ data, meta, reads: { coop, vars, userData, contract }, derived: { decision } }) => ({
8391
+ meta,
8392
+ coop,
8393
+ vars,
8394
+ decision,
8395
+ common_user: commonUser(userData),
8396
+ ...contract,
8397
+ ...propertyPositionFields(data)
8398
+ }),
8399
+ signer: ({ reads: { userData } }) => commonUser(userData).full_name_or_short_name
8400
+ });
8247
8401
 
8248
8402
  const _1072_CapitalizationPropertyInvestAct = {
8249
8403
  __proto__: null,
8250
8404
  Factory: Factory$M,
8405
+ Factory_1_1: Factory_1_1,
8251
8406
  Template: CapitalizationPropertyInvestAct
8252
8407
  };
8253
8408
 
@@ -8260,8 +8415,8 @@ const Factory$L = defineBuilder()({
8260
8415
  coop: () => f.getCooperative(data.coopname, data.block_num),
8261
8416
  vars: () => f.getVars(data.coopname, data.block_num),
8262
8417
  userData: () => f.getUser(data.username, data.block_num),
8263
- contributorContractUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER),
8264
- contributorContractCreatedAtUdata: udata(Cooperative$1.Model.UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT)
8418
+ contributorContractUdata: udata(UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_NUMBER),
8419
+ contributorContractCreatedAtUdata: udata(UdataKey.BLAGOROST_CONTRIBUTOR_CONTRACT_CREATED_AT)
8265
8420
  };
8266
8421
  },
8267
8422
  assemble: ({ data, meta, reads: { coop, vars, userData, contributorContractUdata, contributorContractCreatedAtUdata } }) => {
@@ -8802,8 +8957,8 @@ const Factory$t = defineBuilder()({
8802
8957
  vars: () => f.getVars(data.coopname, data.block_num),
8803
8958
  coop: () => f.getCooperative(data.coopname, data.block_num),
8804
8959
  user: () => f.getUser(data.username, data.block_num),
8805
- generatorAgreementUdata: udata(Cooperative$1.Model.UdataKey.GENERATOR_AGREEMENT_NUMBER),
8806
- generatorAgreementCreatedAtUdata: udata(Cooperative$1.Model.UdataKey.GENERATOR_AGREEMENT_CREATED_AT),
8960
+ generatorAgreementUdata: udata(UdataKey.GENERATOR_AGREEMENT_NUMBER),
8961
+ generatorAgreementCreatedAtUdata: udata(UdataKey.GENERATOR_AGREEMENT_CREATED_AT),
8807
8962
  docData: () => f.loadDocData(data)
8808
8963
  };
8809
8964
  },
@@ -8882,8 +9037,8 @@ const Factory$q = defineBuilder()({
8882
9037
  coop: () => f.getCooperative(data.coopname, data.block_num),
8883
9038
  vars: () => f.getVars(data.coopname, data.block_num),
8884
9039
  userData: () => f.getUser(data.username, data.block_num),
8885
- numberUdata: () => data.marketplace_agreement_number ? Promise.resolve(null) : udata(Cooperative$1.Model.UdataKey.MARKETPLACE_AGREEMENT_NUMBER),
8886
- createdAtUdata: () => data.marketplace_agreement_created_at ? Promise.resolve(null) : udata(Cooperative$1.Model.UdataKey.MARKETPLACE_AGREEMENT_CREATED_AT)
9040
+ numberUdata: () => data.marketplace_agreement_number ? Promise.resolve(null) : udata(UdataKey.MARKETPLACE_AGREEMENT_NUMBER),
9041
+ createdAtUdata: () => data.marketplace_agreement_created_at ? Promise.resolve(null) : udata(UdataKey.MARKETPLACE_AGREEMENT_CREATED_AT)
8887
9042
  };
8888
9043
  },
8889
9044
  assemble: ({ data, meta, reads: { coop, vars, userData, numberUdata, createdAtUdata } }) => {
@@ -9258,8 +9413,8 @@ const Factory$f = defineBuilder()({
9258
9413
  coop: () => f.getCooperative(data.coopname, data.block_num),
9259
9414
  vars: () => f.getVars(data.coopname, data.block_num),
9260
9415
  userData: () => f.getUser(data.username, data.block_num),
9261
- numberRow: () => data.agreement_number ? Promise.resolve(null) : udata(Cooperative$1.Model.UdataKey.EDUCATION_PARENT_AGREEMENT_NUMBER),
9262
- createdAtRow: () => data.agreement_created_at ? Promise.resolve(null) : udata(Cooperative$1.Model.UdataKey.EDUCATION_PARENT_AGREEMENT_CREATED_AT)
9416
+ numberRow: () => data.agreement_number ? Promise.resolve(null) : udata(UdataKey.EDUCATION_PARENT_AGREEMENT_NUMBER),
9417
+ createdAtRow: () => data.agreement_created_at ? Promise.resolve(null) : udata(UdataKey.EDUCATION_PARENT_AGREEMENT_CREATED_AT)
9263
9418
  };
9264
9419
  },
9265
9420
  assemble: ({ data, meta, reads: { coop, vars, userData, numberRow, createdAtRow } }) => {
@@ -9294,8 +9449,8 @@ const Factory$e = defineBuilder()({
9294
9449
  coop: () => f.getCooperative(data.coopname, data.block_num),
9295
9450
  vars: () => f.getVars(data.coopname, data.block_num),
9296
9451
  userData: () => f.getUser(data.username, data.block_num),
9297
- numberRow: () => data.agreement_number ? Promise.resolve(null) : udata(Cooperative$1.Model.UdataKey.EDUCATION_TEACHER_AGREEMENT_NUMBER),
9298
- createdAtRow: () => data.agreement_created_at ? Promise.resolve(null) : udata(Cooperative$1.Model.UdataKey.EDUCATION_TEACHER_AGREEMENT_CREATED_AT)
9452
+ numberRow: () => data.agreement_number ? Promise.resolve(null) : udata(UdataKey.EDUCATION_TEACHER_AGREEMENT_NUMBER),
9453
+ createdAtRow: () => data.agreement_created_at ? Promise.resolve(null) : udata(UdataKey.EDUCATION_TEACHER_AGREEMENT_CREATED_AT)
9299
9454
  };
9300
9455
  },
9301
9456
  assemble: ({ data, meta, reads: { coop, vars, userData, numberRow, createdAtRow } }) => {
@@ -9330,8 +9485,8 @@ const Factory$d = defineBuilder()({
9330
9485
  coop: () => f.getCooperative(data.coopname, data.block_num),
9331
9486
  vars: () => f.getVars(data.coopname, data.block_num),
9332
9487
  userData: () => f.getUser(data.username, data.block_num),
9333
- numberRow: () => data.contract_number ? Promise.resolve(null) : udata(Cooperative$1.Model.UdataKey.EDUCATION_CONTRACT_NUMBER),
9334
- createdAtRow: () => data.contract_created_at ? Promise.resolve(null) : udata(Cooperative$1.Model.UdataKey.EDUCATION_CONTRACT_CREATED_AT)
9488
+ numberRow: () => data.contract_number ? Promise.resolve(null) : udata(UdataKey.EDUCATION_CONTRACT_NUMBER),
9489
+ createdAtRow: () => data.contract_created_at ? Promise.resolve(null) : udata(UdataKey.EDUCATION_CONTRACT_CREATED_AT)
9335
9490
  };
9336
9491
  },
9337
9492
  assemble: ({ data, meta, reads: { coop, vars, userData, numberRow, createdAtRow } }) => {
@@ -9359,8 +9514,8 @@ const _3006_EducationParticipationContract = {
9359
9514
 
9360
9515
  async function getEducationContractRef(sources, data) {
9361
9516
  const [number, createdAt] = await Promise.all([
9362
- sources.udata({ coopname: data.coopname, username: data.username, key: Cooperative$1.Model.UdataKey.EDUCATION_CONTRACT_NUMBER, block_num: data.block_num }),
9363
- sources.udata({ coopname: data.coopname, username: data.username, key: Cooperative$1.Model.UdataKey.EDUCATION_CONTRACT_CREATED_AT, block_num: data.block_num })
9517
+ sources.udata({ coopname: data.coopname, username: data.username, key: UdataKey.EDUCATION_CONTRACT_NUMBER, block_num: data.block_num }),
9518
+ sources.udata({ coopname: data.coopname, username: data.username, key: UdataKey.EDUCATION_CONTRACT_CREATED_AT, block_num: data.block_num })
9364
9519
  ]);
9365
9520
  if (!number?.value || !createdAt?.value)
9366
9521
  throw new Error("\u041D\u043E\u043C\u0435\u0440 \u0438 \u0434\u0430\u0442\u0430 \u0434\u043E\u0433\u043E\u0432\u043E\u0440\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u044F \u0432 \u0445\u043E\u0437\u044F\u0439\u0441\u0442\u0432\u0435\u043D\u043D\u043E\u0439 \u0434\u0435\u044F\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u0438 \u043F\u0440\u0435\u043F\u043E\u0434\u0430\u0432\u0430\u0442\u0435\u043B\u044F \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B \u0432 Udata");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coopenomics/docs-factory",
3
3
  "type": "module",
4
- "version": "1.2.0",
4
+ "version": "1.4.0",
5
5
  "description": "Фабрика документов цифрового кооператива: сборка документов по шаблонам, сборщики всех видов документов, версии сборщиков",
6
6
  "author": "Alex Ant <chairman.voskhod@gmail.com>",
7
7
  "license": "MIT",
@@ -50,7 +50,7 @@
50
50
  "pdf-lib": "^1.17.1",
51
51
  "pg": "^8.16.3",
52
52
  "uuid": "^11.0.0",
53
- "@coopenomics/docs-templates": "1.2.0"
53
+ "@coopenomics/docs-templates": "1.4.0"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@antfu/eslint-config": "^2.17.0",