law-common 14.1.4-beta.2 → 14.1.4-beta.4

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,3 +1,4 @@
1
+ import type { IOfficeLocationAddress } from "../../api/v2";
1
2
  import { EntityEnum } from "../interface/entity.utils.interface";
2
3
  import { RelationConfigs } from "../interface/relation-config.interface";
3
4
  import { IUserEntity } from "../interface/user.entity.interface";
@@ -53,6 +54,7 @@ export declare class OfficeLocationEntityModel extends BaseEntityModel<EntityEnu
53
54
  vendorInvoices?: VendorInvoiceEntityModel[];
54
55
  static relationConfigs: RelationConfigs<[EntityEnum.ORGANIZATION, EntityEnum.COUNTRY, EntityEnum.VENDOR_INVOICE], EntityEnum.OFFICE_LOCATION>;
55
56
  static fromEntity(entity: IOfficeLocationEntity): OfficeLocationEntityModel;
57
+ static parseAddress(value: string): IOfficeLocationAddress;
56
58
  getRelationConfigs(): any[];
57
59
  get vendors(): VendorEntityModel[] | undefined;
58
60
  get states(): StateEntityModel[] | undefined;
@@ -29,6 +29,18 @@ class OfficeLocationEntityModel extends base_entity_model_1.BaseEntityModel {
29
29
  Object.assign(result, entity);
30
30
  return result;
31
31
  }
32
+ static parseAddress(value) {
33
+ try {
34
+ const parsed = JSON.parse(value);
35
+ if (parsed && typeof parsed === "object") {
36
+ return parsed;
37
+ }
38
+ }
39
+ catch (_a) {
40
+ // fall through to the legacy plain-string shape
41
+ }
42
+ return { addressLine1: value };
43
+ }
32
44
  getRelationConfigs() {
33
45
  return this.constructor.prototype.constructor.relationConfigs || [];
34
46
  }
@@ -464,7 +476,7 @@ OfficeLocationEntityModel.relationConfigs = [
464
476
  {
465
477
  name: entity_utils_interface_1.EntityEnum.COUNTRY,
466
478
  relation: entities_1.RelationType.ONE,
467
- key: "country",
479
+ key: "countryModel",
468
480
  mapKeyConfig: {
469
481
  relationKey: "name",
470
482
  key: "country",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "law-common",
3
- "version": "14.1.4-beta.2",
3
+ "version": "14.1.4-beta.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [