@companieshouse/api-sdk-node 1.0.104 → 1.0.107

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,2 +1,2 @@
1
- import { OverseasEntity } from "./types";
2
- export declare const mapOverseasEntity: (body: OverseasEntity) => OverseasEntity;
1
+ import { OverseasEntity, OverseasEntityResource } from "./types";
2
+ export declare const mapOverseasEntity: (body: OverseasEntity) => OverseasEntityResource;
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  exports.mapOverseasEntity = void 0;
4
15
  const mapOverseasEntity = (body) => {
@@ -6,10 +17,47 @@ const mapOverseasEntity = (body) => {
6
17
  presenter: Object.assign({}, body.presenter),
7
18
  entity: Object.assign({}, body.entity),
8
19
  beneficial_owners_statement: body.beneficial_owners_statement,
9
- beneficial_owners_individual: Object.assign({}, body.beneficial_owners_individual),
10
- beneficial_owners_corporate: Object.assign({}, body.beneficial_owners_corporate),
20
+ beneficial_owners_individual: mapBeneficialOwnersIndividual(body.beneficial_owners_individual),
21
+ beneficial_owners_corporate: mapBeneficialOwnersCorporate(body.beneficial_owners_corporate),
11
22
  beneficial_owners_government_or_public_authority: Object.assign({}, body.beneficial_owners_government_or_public_authority)
12
23
  };
13
24
  };
14
25
  exports.mapOverseasEntity = mapOverseasEntity;
26
+ /**
27
+ * Convert the BeneficialOwnerIndividual array data into the Resource format that the API expects
28
+ * (just converting dates currently)
29
+ * @param boIndividuals Array of BeneficialOwnerIndividual objects
30
+ * @returns Array of BeneficialOwnerIndividualResource
31
+ */
32
+ const mapBeneficialOwnersIndividual = (boIndividuals = []) => {
33
+ const boIndividualResources = [];
34
+ boIndividuals.forEach(boIndividual => {
35
+ const { date_of_birth, start_date } = boIndividual, rest = __rest(boIndividual, ["date_of_birth", "start_date"]);
36
+ boIndividualResources.push(Object.assign(Object.assign({}, rest), { date_of_birth: convertDateToIsoDateString(date_of_birth.day, date_of_birth.month, date_of_birth.year), start_date: convertDateToIsoDateString(start_date.day, start_date.month, start_date.year) }));
37
+ });
38
+ return boIndividualResources;
39
+ };
40
+ /**
41
+ * Convert the BeneficialOwnerCorporate array data into the Resource format that the API expects
42
+ * (just converting dates currently)
43
+ * @param boCorporates Array of BeneficialOwnerCorporate objects
44
+ * @returns Array of BeneficialOwnerCorporateResource
45
+ */
46
+ const mapBeneficialOwnersCorporate = (boCorporates = []) => {
47
+ const boCorporateResources = [];
48
+ boCorporates.forEach(boCorporate => {
49
+ const { start_date } = boCorporate, rest = __rest(boCorporate, ["start_date"]);
50
+ boCorporateResources.push(Object.assign(Object.assign({}, rest), { start_date: convertDateToIsoDateString(start_date.day, start_date.month, start_date.year) }));
51
+ });
52
+ return boCorporateResources;
53
+ };
54
+ const convertDateToIsoDateString = (day, month, year) => {
55
+ return `${year}-${zeroPadNumber(month)}-${zeroPadNumber(day)}`;
56
+ };
57
+ const zeroPadNumber = (input = "") => {
58
+ if (input.length === 1) {
59
+ return "0" + input;
60
+ }
61
+ return input;
62
+ };
15
63
  //# sourceMappingURL=mapping.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mapping.js","sourceRoot":"","sources":["../../../src/services/overseas-entities/mapping.ts"],"names":[],"mappings":";;;AAEO,MAAM,iBAAiB,GAAG,CAAC,IAAoB,EAAkB,EAAE;IACtE,OAAO;QACH,SAAS,oBAAO,IAAI,CAAC,SAAS,CAAE;QAChC,MAAM,oBAAO,IAA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,CAAC,GAAG,EAAE,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,IAC3F,CAAA;IACN,CAAC,CAAC,CAAC;IACH,OAAO,qBAAqB,CAAC;AACjC,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,4BAA4B,GAAG,CAAC,eAA2C,EAAE,EAAsC,EAAE;IACvH,MAAM,oBAAoB,GAAuC,EAAE,CAAC;IACpE,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;QAC/B,MAAM,EAAE,UAAU,KAAc,WAAW,EAApB,IAAI,UAAK,WAAW,EAArC,cAAuB,CAAc,CAAC;QAC5C,oBAAoB,CAAC,IAAI,iCAClB,IAAI,KACP,UAAU,EAAE,0BAA0B,CAAC,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,IAC3F,CAAA;IACN,CAAC,CAAC,CAAC;IACH,OAAO,oBAAoB,CAAC;AAChC,CAAC,CAAA;AAED,MAAM,0BAA0B,GAAG,CAAC,GAAW,EAAE,KAAa,EAAE,IAAY,EAAU,EAAE;IACpF,OAAO,GAAG,IAAI,IAAI,aAAa,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC;AACnE,CAAC,CAAA;AAED,MAAM,aAAa,GAAG,CAAC,QAAgB,EAAE,EAAU,EAAE;IACjD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QACpB,OAAO,GAAG,GAAG,KAAK,CAAC;KACtB;IACD,OAAO,KAAK,CAAC;AACjB,CAAC,CAAA"}
@@ -9,6 +9,14 @@ export interface OverseasEntity {
9
9
  beneficial_owners_corporate?: BeneficialOwnerCorporate[];
10
10
  beneficial_owners_government_or_public_authority?: BeneficialOwnerGovernmentOrPublicAuthority[];
11
11
  }
12
+ export interface OverseasEntityResource {
13
+ presenter?: Presenter;
14
+ entity?: Entity;
15
+ beneficial_owners_statement?: BeneficialOwnersStatementType;
16
+ beneficial_owners_individual?: BeneficialOwnerIndividualResource[];
17
+ beneficial_owners_corporate?: BeneficialOwnerCorporateResource[];
18
+ beneficial_owners_government_or_public_authority?: BeneficialOwnerGovernmentOrPublicAuthority[];
19
+ }
12
20
  export interface OverseasEntityCreated {
13
21
  id: string;
14
22
  }
@@ -48,7 +56,37 @@ export interface BeneficialOwnerIndividual {
48
56
  non_legal_firm_members_nature_of_control_types?: NatureOfControlType[];
49
57
  is_on_sanctions_list?: yesNoResponse;
50
58
  }
59
+ export interface BeneficialOwnerIndividualResource {
60
+ first_name?: string;
61
+ last_name?: string;
62
+ date_of_birth?: string;
63
+ nationality?: string;
64
+ usual_residential_address?: Address;
65
+ service_address?: Address;
66
+ is_service_address_same_as_usual_residential_address?: yesNoResponse;
67
+ start_date?: string;
68
+ beneficial_owner_nature_of_control_types?: NatureOfControlType[];
69
+ trustees_nature_of_control_types?: NatureOfControlType[];
70
+ non_legal_firm_members_nature_of_control_types?: NatureOfControlType[];
71
+ is_on_sanctions_list?: yesNoResponse;
72
+ }
51
73
  export interface BeneficialOwnerCorporate {
74
+ name?: string;
75
+ principal_address?: Address;
76
+ service_address?: Address;
77
+ is_service_address_same_as_principal_address?: yesNoResponse;
78
+ legal_form?: string;
79
+ law_governed?: string;
80
+ is_on_register_in_country_formed_in?: yesNoResponse;
81
+ register_name?: string;
82
+ registration_number?: string;
83
+ start_date?: InputDate;
84
+ beneficial_owner_nature_of_control_types?: NatureOfControlType[];
85
+ trustees_nature_of_control_types?: NatureOfControlType[];
86
+ non_legal_firm_members_nature_of_control_types?: NatureOfControlType[];
87
+ is_on_sanctions_list?: yesNoResponse;
88
+ }
89
+ export interface BeneficialOwnerCorporateResource {
52
90
  name?: string;
53
91
  principal_address?: Address;
54
92
  service_address?: Address;
@@ -59,9 +97,9 @@ export interface BeneficialOwnerCorporate {
59
97
  register_name?: string;
60
98
  registration_number?: string;
61
99
  start_date?: string;
62
- beneficial_owner_nature_of_control_types?: NatureOfControlType;
63
- trustees_nature_of_control_types?: NatureOfControlType;
64
- non_legal_firm_members_nature_of_control_types?: NatureOfControlType;
100
+ beneficial_owner_nature_of_control_types?: NatureOfControlType[];
101
+ trustees_nature_of_control_types?: NatureOfControlType[];
102
+ non_legal_firm_members_nature_of_control_types?: NatureOfControlType[];
65
103
  is_on_sanctions_list?: yesNoResponse;
66
104
  }
67
105
  export interface BeneficialOwnerGovernmentOrPublicAuthority {
@@ -74,8 +112,8 @@ export interface BeneficialOwnerGovernmentOrPublicAuthority {
74
112
  is_on_register_in_country_formed_in?: yesNoResponse;
75
113
  register_name?: string;
76
114
  registration_number?: string;
77
- beneficial_owner_nature_of_control_types?: NatureOfControlType;
78
- non_legal_firm_members_nature_of_control_types?: NatureOfControlType;
115
+ beneficial_owner_nature_of_control_types?: NatureOfControlType[];
116
+ non_legal_firm_members_nature_of_control_types?: NatureOfControlType[];
79
117
  }
80
118
  /**
81
119
  * Shared Data Type
@@ -106,16 +144,16 @@ declare enum presenterRole {
106
144
  other = "other"
107
145
  }
108
146
  export declare enum BeneficialOwnersStatementType {
109
- all_identified_all_details = "all_identified_all_details",
110
- all_identified_some_details = "all_identified_some_details",
111
- some_identified_all_details = "some_identified_all_details",
112
- some_identified_some_details = "some_identified_some_details",
113
- none_identified = "none_identified"
147
+ ALL_IDENTIFIED_ALL_DETAILS = "ALL_IDENTIFIED_ALL_DETAILS",
148
+ ALL_IDENTIFIED_SOME_DETAILS = "ALL_IDENTIFIED_SOME_DETAILS",
149
+ SOME_IDENTIFIED_ALL_DETAILS = "SOME_IDENTIFIED_ALL_DETAILS",
150
+ SOME_IDENTIFIED_SOME_DETAILS = "SOME_IDENTIFIED_SOME_DETAILS",
151
+ NONE_IDENTIFIED = "NONE_IDENTIFIED"
114
152
  }
115
153
  export declare enum NatureOfControlType {
116
- over_25_percent_of_shares = "over_25_percent_of_shares",
117
- over_25_percent_of_voting_rights = "over_25_percent_of_voting_rights",
118
- appoint_or_remove_majority_board_directors = "appoint_or_remove_majority_board_directors",
119
- significant_influence_or_control = "significant_influence_or_control"
154
+ OVER_25_PERCENT_OF_SHARES = "OVER_25_PERCENT_OF_SHARES",
155
+ OVER_25_PERCENT_OF_VOTING_RIGHTS = "OVER_25_PERCENT_OF_VOTING_RIGHTS",
156
+ APPOINT_OR_REMOVE_MAJORITY_BOARD_DIRECTORS = "APPOINT_OR_REMOVE_MAJORITY_BOARD_DIRECTORS",
157
+ SIGNIFICANT_INFLUENCE_OR_CONTROL = "SIGNIFICANT_INFLUENCE_OR_CONTROL"
120
158
  }
121
159
  export {};
@@ -19,17 +19,17 @@ var presenterRole;
19
19
  })(presenterRole || (presenterRole = {}));
20
20
  var BeneficialOwnersStatementType;
21
21
  (function (BeneficialOwnersStatementType) {
22
- BeneficialOwnersStatementType["all_identified_all_details"] = "all_identified_all_details";
23
- BeneficialOwnersStatementType["all_identified_some_details"] = "all_identified_some_details";
24
- BeneficialOwnersStatementType["some_identified_all_details"] = "some_identified_all_details";
25
- BeneficialOwnersStatementType["some_identified_some_details"] = "some_identified_some_details";
26
- BeneficialOwnersStatementType["none_identified"] = "none_identified";
22
+ BeneficialOwnersStatementType["ALL_IDENTIFIED_ALL_DETAILS"] = "ALL_IDENTIFIED_ALL_DETAILS";
23
+ BeneficialOwnersStatementType["ALL_IDENTIFIED_SOME_DETAILS"] = "ALL_IDENTIFIED_SOME_DETAILS";
24
+ BeneficialOwnersStatementType["SOME_IDENTIFIED_ALL_DETAILS"] = "SOME_IDENTIFIED_ALL_DETAILS";
25
+ BeneficialOwnersStatementType["SOME_IDENTIFIED_SOME_DETAILS"] = "SOME_IDENTIFIED_SOME_DETAILS";
26
+ BeneficialOwnersStatementType["NONE_IDENTIFIED"] = "NONE_IDENTIFIED";
27
27
  })(BeneficialOwnersStatementType = exports.BeneficialOwnersStatementType || (exports.BeneficialOwnersStatementType = {}));
28
28
  var NatureOfControlType;
29
29
  (function (NatureOfControlType) {
30
- NatureOfControlType["over_25_percent_of_shares"] = "over_25_percent_of_shares";
31
- NatureOfControlType["over_25_percent_of_voting_rights"] = "over_25_percent_of_voting_rights";
32
- NatureOfControlType["appoint_or_remove_majority_board_directors"] = "appoint_or_remove_majority_board_directors";
33
- NatureOfControlType["significant_influence_or_control"] = "significant_influence_or_control";
30
+ NatureOfControlType["OVER_25_PERCENT_OF_SHARES"] = "OVER_25_PERCENT_OF_SHARES";
31
+ NatureOfControlType["OVER_25_PERCENT_OF_VOTING_RIGHTS"] = "OVER_25_PERCENT_OF_VOTING_RIGHTS";
32
+ NatureOfControlType["APPOINT_OR_REMOVE_MAJORITY_BOARD_DIRECTORS"] = "APPOINT_OR_REMOVE_MAJORITY_BOARD_DIRECTORS";
33
+ NatureOfControlType["SIGNIFICANT_INFLUENCE_OR_CONTROL"] = "SIGNIFICANT_INFLUENCE_OR_CONTROL";
34
34
  })(NatureOfControlType = exports.NatureOfControlType || (exports.NatureOfControlType = {}));
35
35
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/services/overseas-entities/types.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAiGH,IAAY,aAGX;AAHD,WAAY,aAAa;IACrB,6CAAM,CAAA;IACN,+CAAO,CAAA;AACX,CAAC,EAHW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAGxB;AAQD,IAAK,aAMJ;AAND,WAAK,aAAa;IACd,gDAA+B,CAAA;IAC/B,gCAAe,CAAA;IACf,wCAAuB,CAAA;IACvB,sDAAqC,CAAA;IACrC,gCAAe,CAAA;AACnB,CAAC,EANI,aAAa,KAAb,aAAa,QAMjB;AAED,IAAY,6BAMX;AAND,WAAY,6BAA6B;IACrC,0FAAyD,CAAA;IACzD,4FAA2D,CAAA;IAC3D,4FAA2D,CAAA;IAC3D,8FAA6D,CAAA;IAC7D,oEAAmC,CAAA;AACvC,CAAC,EANW,6BAA6B,GAA7B,qCAA6B,KAA7B,qCAA6B,QAMxC;AAED,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC3B,8EAAuD,CAAA;IACvD,4FAAqE,CAAA;IACrE,gHAAyF,CAAA;IACzF,4FAAqE,CAAA;AACzE,CAAC,EALW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAK9B"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/services/overseas-entities/types.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AA0IH,IAAY,aAGX;AAHD,WAAY,aAAa;IACrB,6CAAM,CAAA;IACN,+CAAO,CAAA;AACX,CAAC,EAHW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAGxB;AAQD,IAAK,aAMJ;AAND,WAAK,aAAa;IACd,gDAA+B,CAAA;IAC/B,gCAAe,CAAA;IACf,wCAAuB,CAAA;IACvB,sDAAqC,CAAA;IACrC,gCAAe,CAAA;AACnB,CAAC,EANI,aAAa,KAAb,aAAa,QAMjB;AAED,IAAY,6BAMX;AAND,WAAY,6BAA6B;IACrC,0FAAyD,CAAA;IACzD,4FAA2D,CAAA;IAC3D,4FAA2D,CAAA;IAC3D,8FAA6D,CAAA;IAC7D,oEAAmC,CAAA;AACvC,CAAC,EANW,6BAA6B,GAA7B,qCAA6B,KAA7B,qCAA6B,QAMxC;AAED,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC3B,8EAAuD,CAAA;IACvD,4FAAqE,CAAA;IACrE,gHAAyF,CAAA;IACzF,4FAAqE,CAAA;AACzE,CAAC,EALW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAK9B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@companieshouse/api-sdk-node",
3
- "version": "1.0.104",
3
+ "version": "1.0.107",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [