@propxchain/core-client 0.15.0-canary.53 → 0.16.0-canary.55

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.
@@ -1 +1 @@
1
- {"version":3,"file":"verifyAuditLog.d.ts","sourceRoot":"","sources":["../../src/audit/verifyAuditLog.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,KAAK,mBAAmB,EAAqB,MAAM,iBAAiB,CAAC;AAiC9E,kEAAkE;AAClE,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9B,QAAQ,EAAE,UAAU,CAAC;IACrB,WAAW,EAAE,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC;IAC/B,OAAO,EAAE,UAAU,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,+EAA+E;IAC/E,OAAO,EAAE,UAAU,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,uBAAuB,CAAC;IAC7B;;;;OAIG;IACH,0BAA0B,CAAC,EAAE,MAAM,CAAC;CACrC;AAiBD,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,YAAY,CAAC,CAkEvB"}
1
+ {"version":3,"file":"verifyAuditLog.d.ts","sourceRoot":"","sources":["../../src/audit/verifyAuditLog.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,KAAK,mBAAmB,EAAqB,MAAM,iBAAiB,CAAC;AAiC9E,kEAAkE;AAClE,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9B,QAAQ,EAAE,UAAU,CAAC;IACrB,WAAW,EAAE,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC;IAC/B,OAAO,EAAE,UAAU,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,+EAA+E;IAC/E,OAAO,EAAE,UAAU,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,uBAAuB,CAAC;IAC7B;;;;OAIG;IACH,0BAA0B,CAAC,EAAE,MAAM,CAAC;CACrC;AAkBD,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,YAAY,CAAC,CAkEvB"}
@@ -7,18 +7,20 @@
7
7
  // 3. confirm the response's stated head matches the certified head;
8
8
  // 4. recompute the chain from the events and confirm it matches.
9
9
  //
10
- // Uses the @dfinity/* family (agent, principal, certificate-verification)
11
- // throughout — that is the lineage certificate-verification depends on, so the
12
- // HashTree/Principal types line up. The rest of core-client uses @icp-sdk;
13
- // this leaf module's boundary is plain Uint8Array/string, so the split is
14
- // contained.
10
+ // Uses @icp-sdk/core (agent, principal) with @dfinity/certificate-verification
11
+ // 4.x, which depends on it, so the HashTree/Principal types line up. 4.x is
12
+ // required: the IC now publishes a subnet's canister ranges under
13
+ // /canister_ranges/<subnet>/... in the delegation (and drops them from
14
+ // /subnet/<id>/canister_ranges). 3.x only reads the old path and fails with
15
+ // "Could not find canister ranges for subnet" on those certificates; 4.x reads
16
+ // both. This leaf module's boundary is plain Uint8Array/string.
15
17
  //
16
18
  // Live verification keeps the certificate-freshness window tight. Forensic
17
19
  // verification of a sealed historical bundle (ADR 0013, proof model ii)
18
20
  // relaxes it by design — the bundle proves a fact as-of the certificate's
19
21
  // /time, not a current one.
20
- import { lookup_path, lookupResultToBuffer } from "@dfinity/agent";
21
- import { Principal } from "@dfinity/principal";
22
+ import { lookup_path, lookupResultToBuffer } from "@icp-sdk/core/agent";
23
+ import { Principal } from "@icp-sdk/core/principal";
22
24
  import { recomputeHeadHash } from "./auditChain.js";
23
25
  let cachedVerify;
24
26
  async function loadVerifyCertification() {
@@ -33,10 +35,11 @@ async function loadVerifyCertification() {
33
35
  return fn;
34
36
  }
35
37
  const FIVE_MINUTES_MS = 5 * 60 * 1000;
36
- function toArrayBuffer(u8) {
38
+ /** Detached copy, so a view into a larger buffer never leaks neighbouring bytes. */
39
+ function toBytes(u8) {
37
40
  const copy = new Uint8Array(u8.length);
38
41
  copy.set(u8);
39
- return copy.buffer;
42
+ return copy;
40
43
  }
41
44
  function equalBytes(a, b) {
42
45
  if (a.length !== b.length)
@@ -58,9 +61,9 @@ export async function verifyCertifiedAuditLog(opts) {
58
61
  const verifyCertification = await loadVerifyCertification();
59
62
  tree = await verifyCertification({
60
63
  canisterId: Principal.fromText(opts.canisterId),
61
- encodedCertificate: toArrayBuffer(log.certificate[0]),
62
- encodedTree: toArrayBuffer(log.witness),
63
- rootKey: toArrayBuffer(opts.rootKey),
64
+ encodedCertificate: toBytes(log.certificate[0]),
65
+ encodedTree: toBytes(log.witness),
66
+ rootKey: toBytes(opts.rootKey),
64
67
  maxCertificateTimeOffsetMs: opts.maxCertificateTimeOffsetMs ?? FIVE_MINUTES_MS,
65
68
  });
66
69
  }
@@ -74,7 +77,7 @@ export async function verifyCertifiedAuditLog(opts) {
74
77
  // 2. Read the certified headHash for this transaction from the witness tree.
75
78
  // The path segment is the UTF-8 bytes of the transactionId — exactly the key
76
79
  // ledger_manager certified (Text.encodeUtf8(transactionId)).
77
- const lookup = lookup_path([toArrayBuffer(new TextEncoder().encode(transactionId))], tree);
80
+ const lookup = lookup_path([new TextEncoder().encode(transactionId)], tree);
78
81
  const certifiedBuf = lookupResultToBuffer(lookup);
79
82
  if (!certifiedBuf) {
80
83
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"verifyAuditLog.js","sourceRoot":"","sources":["../../src/aud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AM,CAAC,aAAa,CAAC,CAAC,EACzC,IAAI,CACL,CAAC;IACF,MAAM,YAAY,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAClD,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO;YACL,QAAQ,EAAE,KAAK;YACf,MAAM,EAAE,gDAAgD;YACxD,UAAU;SACX,CAAC;IACJ,CAAC;IACD,MAAM,aAAa,GAAG,IAAI,UAAU,CAAC,YAAY,CAAC,CAAC;IAEnD,gEAAgE;IAChE,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7C,OAAO;YACL,QAAQ,EAAE,KAAK;YACf,MAAM,EAAE,kDAAkD;YAC1D,UAAU;SACX,CAAC;IACJ,CAAC;IAED,wEAAwE;IACxE,MAAM,UAAU,GAAG,MAAM,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACvD,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,aAAa,CAAC,EAAE,CAAC;QAC3C,OAAO;YACL,QAAQ,EAAE,KAAK;YACf,MAAM,EACJ,uEAAuE;YACzE,UAAU;SACX,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AACxC,CAAC"}
@@ -6,6 +6,28 @@ export type AMLStatus = { 'verified' : null } |
6
6
  { 'pending' : null } |
7
7
  { 'rejected' : null } |
8
8
  { 'not_started' : null };
9
+ export interface AlterationDocument {
10
+ 'kindDetails' : [] | [string],
11
+ 'kind' : [] | [AlterationDocumentKind],
12
+ 'document' : TA6Document,
13
+ 'relatesTo' : [] | [AlterationKind],
14
+ }
15
+ export type AlterationDocumentKind = { 'BuildingRegsCompletion' : null } |
16
+ { 'ListedBuildingConsent' : null } |
17
+ { 'CompetentPersonCertificate' : null } |
18
+ { 'ConservationAreaConsent' : null } |
19
+ { 'BuildingRegsApproval' : null } |
20
+ { 'Other' : null } |
21
+ { 'PlanningPermission' : null };
22
+ export type AlterationKind = { 'InternalWallsRemoved' : null } |
23
+ { 'ChangeOfUse' : null } |
24
+ { 'LoftConversion' : null } |
25
+ { 'Extension' : null } |
26
+ { 'Other' : null } |
27
+ { 'StructuralRoofWorks' : null } |
28
+ { 'Conservatory' : null } |
29
+ { 'WindowsPost2002' : null } |
30
+ { 'GarageConversion' : null };
9
31
  export interface AlterationTypes {
10
32
  'conservatory' : boolean,
11
33
  'otherDetails' : [] | [string],
@@ -380,7 +402,7 @@ export interface Section5Alterations {
380
402
  'q5_3NonResidentialUse' : TA6Response,
381
403
  'q5_8ConservationArea' : TA6Response,
382
404
  'q5_9TreePreservationOrder' : TA6Response,
383
- 'q5_2Documents' : Array<TA6Document>,
405
+ 'q5_2Documents' : Array<AlterationDocument>,
384
406
  'q5_4Breaches' : TA6Response,
385
407
  'q5_5UnresolvedIssues' : TA6Response,
386
408
  'q5_1Alterations' : AlterationTypes,
@@ -558,12 +558,38 @@ export const idlFactory = ({ IDL }) => {
558
558
  'garageConversion' : IDL.Bool,
559
559
  'extension' : IDL.Bool,
560
560
  });
561
+ const AlterationDocumentKind = IDL.Variant({
562
+ 'BuildingRegsCompletion' : IDL.Null,
563
+ 'ListedBuildingConsent' : IDL.Null,
564
+ 'CompetentPersonCertificate' : IDL.Null,
565
+ 'ConservationAreaConsent' : IDL.Null,
566
+ 'BuildingRegsApproval' : IDL.Null,
567
+ 'Other' : IDL.Null,
568
+ 'PlanningPermission' : IDL.Null,
569
+ });
570
+ const AlterationKind = IDL.Variant({
571
+ 'InternalWallsRemoved' : IDL.Null,
572
+ 'ChangeOfUse' : IDL.Null,
573
+ 'LoftConversion' : IDL.Null,
574
+ 'Extension' : IDL.Null,
575
+ 'Other' : IDL.Null,
576
+ 'StructuralRoofWorks' : IDL.Null,
577
+ 'Conservatory' : IDL.Null,
578
+ 'WindowsPost2002' : IDL.Null,
579
+ 'GarageConversion' : IDL.Null,
580
+ });
581
+ const AlterationDocument = IDL.Record({
582
+ 'kindDetails' : IDL.Opt(IDL.Text),
583
+ 'kind' : IDL.Opt(AlterationDocumentKind),
584
+ 'document' : TA6Document,
585
+ 'relatesTo' : IDL.Opt(AlterationKind),
586
+ });
561
587
  const Section5Alterations = IDL.Record({
562
588
  'q5_6Solar' : IDL.Opt(SolarPower),
563
589
  'q5_3NonResidentialUse' : TA6Response,
564
590
  'q5_8ConservationArea' : TA6Response,
565
591
  'q5_9TreePreservationOrder' : TA6Response,
566
- 'q5_2Documents' : IDL.Vec(TA6Document),
592
+ 'q5_2Documents' : IDL.Vec(AlterationDocument),
567
593
  'q5_4Breaches' : TA6Response,
568
594
  'q5_5UnresolvedIssues' : TA6Response,
569
595
  'q5_1Alterations' : AlterationTypes,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@propxchain/core-client",
3
- "version": "0.15.0-canary.53",
3
+ "version": "0.16.0-canary.55",
4
4
  "description": "Typed TypeScript client for the PropXchain core canisters on the Internet Computer. Includes a deterministic mock mode for local development and tests.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -40,10 +40,10 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@dfinity/agent": "^1.4.0",
43
- "@dfinity/certificate-verification": "^3.1.0",
43
+ "@dfinity/certificate-verification": "^4.0.0",
44
44
  "@dfinity/principal": "^1.4.0",
45
45
  "@icp-sdk/auth": "^7.0.0",
46
- "@icp-sdk/core": "^5.4.0"
46
+ "@icp-sdk/core": "^6.0.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/node": "^22.10.2",
@@ -7,20 +7,22 @@
7
7
  // 3. confirm the response's stated head matches the certified head;
8
8
  // 4. recompute the chain from the events and confirm it matches.
9
9
  //
10
- // Uses the @dfinity/* family (agent, principal, certificate-verification)
11
- // throughout — that is the lineage certificate-verification depends on, so the
12
- // HashTree/Principal types line up. The rest of core-client uses @icp-sdk;
13
- // this leaf module's boundary is plain Uint8Array/string, so the split is
14
- // contained.
10
+ // Uses @icp-sdk/core (agent, principal) with @dfinity/certificate-verification
11
+ // 4.x, which depends on it, so the HashTree/Principal types line up. 4.x is
12
+ // required: the IC now publishes a subnet's canister ranges under
13
+ // /canister_ranges/<subnet>/... in the delegation (and drops them from
14
+ // /subnet/<id>/canister_ranges). 3.x only reads the old path and fails with
15
+ // "Could not find canister ranges for subnet" on those certificates; 4.x reads
16
+ // both. This leaf module's boundary is plain Uint8Array/string.
15
17
  //
16
18
  // Live verification keeps the certificate-freshness window tight. Forensic
17
19
  // verification of a sealed historical bundle (ADR 0013, proof model ii)
18
20
  // relaxes it by design — the bundle proves a fact as-of the certificate's
19
21
  // /time, not a current one.
20
22
 
21
- import { lookup_path, lookupResultToBuffer } from "@dfinity/agent";
22
- import type { HashTree } from "@dfinity/agent";
23
- import { Principal } from "@dfinity/principal";
23
+ import { lookup_path, lookupResultToBuffer } from "@icp-sdk/core/agent";
24
+ import type { HashTree } from "@icp-sdk/core/agent";
25
+ import { Principal } from "@icp-sdk/core/principal";
24
26
  import { type CertifiedAuditEvent, recomputeHeadHash } from "./auditChain.js";
25
27
 
26
28
  // @dfinity/certificate-verification ships an ESM .d.ts (named exports, no
@@ -30,9 +32,9 @@ import { type CertifiedAuditEvent, recomputeHeadHash } from "./auditChain.js";
30
32
  // verifier works in Node, browser bundlers, and typecheck alike.
31
33
  interface VerifyCertificationParams {
32
34
  canisterId: Principal;
33
- encodedCertificate: ArrayBuffer;
34
- encodedTree: ArrayBuffer;
35
- rootKey: ArrayBuffer;
35
+ encodedCertificate: Uint8Array;
36
+ encodedTree: Uint8Array;
37
+ rootKey: Uint8Array;
36
38
  maxCertificateTimeOffsetMs: number;
37
39
  }
38
40
  type VerifyCertificationFn = (p: VerifyCertificationParams) => Promise<HashTree>;
@@ -84,10 +86,11 @@ export interface VerifyOptions {
84
86
 
85
87
  const FIVE_MINUTES_MS = 5 * 60 * 1000;
86
88
 
87
- function toArrayBuffer(u8: Uint8Array): ArrayBuffer {
89
+ /** Detached copy, so a view into a larger buffer never leaks neighbouring bytes. */
90
+ function toBytes(u8: Uint8Array): Uint8Array {
88
91
  const copy = new Uint8Array(u8.length);
89
92
  copy.set(u8);
90
- return copy.buffer;
93
+ return copy;
91
94
  }
92
95
 
93
96
  function equalBytes(a: Uint8Array, b: Uint8Array): boolean {
@@ -113,9 +116,9 @@ export async function verifyCertifiedAuditLog(
113
116
  const verifyCertification = await loadVerifyCertification();
114
117
  tree = await verifyCertification({
115
118
  canisterId: Principal.fromText(opts.canisterId),
116
- encodedCertificate: toArrayBuffer(log.certificate[0]),
117
- encodedTree: toArrayBuffer(log.witness),
118
- rootKey: toArrayBuffer(opts.rootKey),
119
+ encodedCertificate: toBytes(log.certificate[0]),
120
+ encodedTree: toBytes(log.witness),
121
+ rootKey: toBytes(opts.rootKey),
119
122
  maxCertificateTimeOffsetMs:
120
123
  opts.maxCertificateTimeOffsetMs ?? FIVE_MINUTES_MS,
121
124
  });
@@ -131,7 +134,7 @@ export async function verifyCertifiedAuditLog(
131
134
  // The path segment is the UTF-8 bytes of the transactionId — exactly the key
132
135
  // ledger_manager certified (Text.encodeUtf8(transactionId)).
133
136
  const lookup = lookup_path(
134
- [toArrayBuffer(new TextEncoder().encode(transactionId))],
137
+ [new TextEncoder().encode(transactionId)],
135
138
  tree,
136
139
  );
137
140
  const certifiedBuf = lookupResultToBuffer(lookup);
@@ -364,7 +364,7 @@ type Section6Guarantees =
364
364
  type Section5Alterations =
365
365
  record {
366
366
  q5_1Alterations: AlterationTypes;
367
- q5_2Documents: vec TA6Document;
367
+ q5_2Documents: vec AlterationDocument;
368
368
  q5_3NonResidentialUse: TA6Response;
369
369
  q5_4Breaches: TA6Response;
370
370
  q5_5UnresolvedIssues: TA6Response;
@@ -878,6 +878,35 @@ type AlterationTypes =
878
878
  structuralRoofWorks: bool;
879
879
  windowsPost2002: bool;
880
880
  };
881
+ type AlterationKind =
882
+ variant {
883
+ ChangeOfUse;
884
+ Conservatory;
885
+ Extension;
886
+ GarageConversion;
887
+ InternalWallsRemoved;
888
+ LoftConversion;
889
+ Other;
890
+ StructuralRoofWorks;
891
+ WindowsPost2002;
892
+ };
893
+ type AlterationDocumentKind =
894
+ variant {
895
+ BuildingRegsApproval;
896
+ BuildingRegsCompletion;
897
+ CompetentPersonCertificate;
898
+ ConservationAreaConsent;
899
+ ListedBuildingConsent;
900
+ Other;
901
+ PlanningPermission;
902
+ };
903
+ type AlterationDocument =
904
+ record {
905
+ document: TA6Document;
906
+ kind: opt AlterationDocumentKind;
907
+ kindDetails: opt text;
908
+ relatesTo: opt AlterationKind;
909
+ };
881
910
  type AMLStatus =
882
911
  variant {
883
912
  not_started;
@@ -1019,6 +1048,7 @@ service : {
1019
1048
  /// create. Counterpart to `removeParty` (which is seller/admin-driven and
1020
1049
  /// gated against primary parties) — this is the "I want out" path for a
1021
1050
  /// joined buyer or any other access-list member.
1051
+ ///
1022
1052
  /// Gates:
1023
1053
  /// - Anonymous callers rejected outright.
1024
1054
  /// - Seller / createdBy cannot leave their own transaction (they
@@ -1026,6 +1056,7 @@ service : {
1026
1056
  /// - Caller must currently have access to the transaction.
1027
1057
  /// - Locked after contract exchange (same posture as assignBuyer):
1028
1058
  /// once the deal is signed nobody walks away by toggling a button.
1059
+ ///
1029
1060
  /// Effects:
1030
1061
  /// - Caller is removed from `accessList`.
1031
1062
  /// - If the caller is the assigned buyer (`txn.buyer == msg.caller`),
@@ -1035,6 +1066,7 @@ service : {
1035
1066
  /// reusable by a new joiner.
1036
1067
  /// - Audit event `buyer_left` (or `party_left` for non-buyer leavers)
1037
1068
  /// is logged via the existing ledger pattern.
1069
+ ///
1038
1070
  /// Concurrency: uses the same acquireTxLock/finally releaseTxLock
1039
1071
  /// posture as assignBuyer so a leave can't race against an in-flight
1040
1072
  /// stage write.
@@ -1052,6 +1084,7 @@ service : {
1052
1084
  /// 2. Stale-pin txs where the org's pinned principal changed after the
1053
1085
  /// tx was created (e.g. admin password reset → new ICP key, or org
1054
1086
  /// ownership transferred to a different admin).
1087
+ ///
1055
1088
  /// Idempotent over the target: re-running with the same developerPrincipal
1056
1089
  /// returns an error (already at target), so admin-driven backfill scripts
1057
1090
  /// don't silently re-touch state. Always rejects:
@@ -6,6 +6,28 @@ export type AMLStatus = { 'verified' : null } |
6
6
  { 'pending' : null } |
7
7
  { 'rejected' : null } |
8
8
  { 'not_started' : null };
9
+ export interface AlterationDocument {
10
+ 'kindDetails' : [] | [string],
11
+ 'kind' : [] | [AlterationDocumentKind],
12
+ 'document' : TA6Document,
13
+ 'relatesTo' : [] | [AlterationKind],
14
+ }
15
+ export type AlterationDocumentKind = { 'BuildingRegsCompletion' : null } |
16
+ { 'ListedBuildingConsent' : null } |
17
+ { 'CompetentPersonCertificate' : null } |
18
+ { 'ConservationAreaConsent' : null } |
19
+ { 'BuildingRegsApproval' : null } |
20
+ { 'Other' : null } |
21
+ { 'PlanningPermission' : null };
22
+ export type AlterationKind = { 'InternalWallsRemoved' : null } |
23
+ { 'ChangeOfUse' : null } |
24
+ { 'LoftConversion' : null } |
25
+ { 'Extension' : null } |
26
+ { 'Other' : null } |
27
+ { 'StructuralRoofWorks' : null } |
28
+ { 'Conservatory' : null } |
29
+ { 'WindowsPost2002' : null } |
30
+ { 'GarageConversion' : null };
9
31
  export interface AlterationTypes {
10
32
  'conservatory' : boolean,
11
33
  'otherDetails' : [] | [string],
@@ -380,7 +402,7 @@ export interface Section5Alterations {
380
402
  'q5_3NonResidentialUse' : TA6Response,
381
403
  'q5_8ConservationArea' : TA6Response,
382
404
  'q5_9TreePreservationOrder' : TA6Response,
383
- 'q5_2Documents' : Array<TA6Document>,
405
+ 'q5_2Documents' : Array<AlterationDocument>,
384
406
  'q5_4Breaches' : TA6Response,
385
407
  'q5_5UnresolvedIssues' : TA6Response,
386
408
  'q5_1Alterations' : AlterationTypes,
@@ -558,12 +558,38 @@ export const idlFactory = ({ IDL }) => {
558
558
  'garageConversion' : IDL.Bool,
559
559
  'extension' : IDL.Bool,
560
560
  });
561
+ const AlterationDocumentKind = IDL.Variant({
562
+ 'BuildingRegsCompletion' : IDL.Null,
563
+ 'ListedBuildingConsent' : IDL.Null,
564
+ 'CompetentPersonCertificate' : IDL.Null,
565
+ 'ConservationAreaConsent' : IDL.Null,
566
+ 'BuildingRegsApproval' : IDL.Null,
567
+ 'Other' : IDL.Null,
568
+ 'PlanningPermission' : IDL.Null,
569
+ });
570
+ const AlterationKind = IDL.Variant({
571
+ 'InternalWallsRemoved' : IDL.Null,
572
+ 'ChangeOfUse' : IDL.Null,
573
+ 'LoftConversion' : IDL.Null,
574
+ 'Extension' : IDL.Null,
575
+ 'Other' : IDL.Null,
576
+ 'StructuralRoofWorks' : IDL.Null,
577
+ 'Conservatory' : IDL.Null,
578
+ 'WindowsPost2002' : IDL.Null,
579
+ 'GarageConversion' : IDL.Null,
580
+ });
581
+ const AlterationDocument = IDL.Record({
582
+ 'kindDetails' : IDL.Opt(IDL.Text),
583
+ 'kind' : IDL.Opt(AlterationDocumentKind),
584
+ 'document' : TA6Document,
585
+ 'relatesTo' : IDL.Opt(AlterationKind),
586
+ });
561
587
  const Section5Alterations = IDL.Record({
562
588
  'q5_6Solar' : IDL.Opt(SolarPower),
563
589
  'q5_3NonResidentialUse' : TA6Response,
564
590
  'q5_8ConservationArea' : TA6Response,
565
591
  'q5_9TreePreservationOrder' : TA6Response,
566
- 'q5_2Documents' : IDL.Vec(TA6Document),
592
+ 'q5_2Documents' : IDL.Vec(AlterationDocument),
567
593
  'q5_4Breaches' : TA6Response,
568
594
  'q5_5UnresolvedIssues' : TA6Response,
569
595
  'q5_1Alterations' : AlterationTypes,