@bpd-library/utilities 1.3.9-beta.0 → 1.3.9-beta.2

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.
@@ -3,7 +3,7 @@ import { INCLUDED_PROPERTIES } from '../extended-api-models/included-properties'
3
3
  import { ApartmentBuildingModel, AreaProjectModel, AreaStatus, ConstructionNumberModel, DistrictModel, ProjectPhaseModel, ProjectPhaseStatus, PropertyTypeModel } from '../generated';
4
4
  declare type PropertyTypeStatus = 'InPreparation' | 'SaleSoon' | 'SaleStarted' | 'AssigningOn' | 'AmountAvailable' | 'InOption' | 'Sold' | 'UnderConstruction' | 'ForRent' | 'Rented';
5
5
  declare type ApartmentBuildingStatus = 'InPreparation' | 'SaleSoon' | 'SaleStarted' | 'AssigningOn' | 'AmountAvailable' | 'Available' | 'ForRent' | 'InOption' | 'Sold' | 'Rented' | 'UnderConstruction';
6
- declare type GeneratedConstructionNumberStatus = 'InPreparation' | 'InOption' | 'Available' | 'Sold' | 'Rented' | 'Reserved' | 'UnderConstruction';
6
+ declare type GeneratedConstructionNumberStatus = 'InPreparation' | 'InOption' | 'Available' | 'AssigningOn' | 'Sold' | 'Rented' | 'Reserved' | 'UnderConstruction';
7
7
  interface ExtendedConstructionNumber extends Pick<ConstructionNumberModel, 'id' | typeof INCLUDED_PROPERTIES.constructionNumber[number]> {
8
8
  areaProject?: ExtendedAreaProject;
9
9
  propertyType?: ExtendedPropertyType;
@@ -1 +1 @@
1
- {"version":3,"file":"api-utilities.types.js","sourceRoot":"","sources":["../../src/api-utilities/api-utilities.types.ts"],"names":[],"mappings":"","sourcesContent":["import { MapDataItem } from '@bpd-library/types';\n\nimport { INCLUDED_PROPERTIES } from '../extended-api-models/included-properties';\nimport {\n ApartmentBuildingModel,\n AreaProjectModel,\n AreaStatus,\n ConstructionNumberModel,\n DistrictModel,\n ProjectPhaseModel,\n ProjectPhaseStatus,\n PropertyTypeModel,\n} from '../generated';\n\ntype PropertyTypeStatus =\n | 'InPreparation'\n | 'SaleSoon'\n | 'SaleStarted'\n | 'AssigningOn'\n | 'AmountAvailable'\n | 'InOption'\n | 'Sold'\n | 'UnderConstruction'\n | 'ForRent'\n | 'Rented';\n\ntype ApartmentBuildingStatus =\n | 'InPreparation'\n | 'SaleSoon'\n | 'SaleStarted'\n | 'AssigningOn'\n | 'AmountAvailable'\n | 'Available'\n | 'ForRent'\n | 'InOption'\n | 'Sold'\n | 'Rented'\n | 'UnderConstruction';\n\ntype GeneratedConstructionNumberStatus =\n | 'InPreparation'\n | 'InOption'\n | 'Available'\n | 'Sold'\n | 'Rented'\n | 'Reserved'\n | 'UnderConstruction';\n\ninterface ExtendedConstructionNumber\n extends Pick<\n ConstructionNumberModel,\n 'id' | typeof INCLUDED_PROPERTIES.constructionNumber[number]\n > {\n areaProject?: ExtendedAreaProject;\n propertyType?: ExtendedPropertyType;\n projectPhase?: ExtendedProjectPhase;\n mapDataItems?: MapDataItem[];\n apartmentBuilding?: ExtendedApartmentBuilding;\n status?: GeneratedConstructionNumberStatus;\n objectType: 'constructionNumber';\n}\n\ninterface ExtendedPropertyType\n extends Pick<PropertyTypeModel, 'id' | typeof INCLUDED_PROPERTIES.propertyType[number]> {\n constructionNumbers?: ExtendedConstructionNumber[];\n projectPhase?: ExtendedProjectPhase;\n mapDataItems?: MapDataItem[];\n status?: PropertyTypeStatus;\n apartmentBuildings?: ExtendedApartmentBuilding[];\n objectType: 'propertyType';\n}\n\ninterface ExtendedProjectPhase\n extends Pick<ProjectPhaseModel, 'id' | typeof INCLUDED_PROPERTIES.projectPhase[number]> {\n constructionNumbers?: ExtendedConstructionNumber[];\n propertyTypes?: ExtendedPropertyType[];\n mapDataItems?: MapDataItem[];\n objectType: 'projectPhase';\n}\n\ninterface ExtendedApartmentBuilding\n extends Pick<\n ApartmentBuildingModel,\n 'id' | typeof INCLUDED_PROPERTIES.apartmentBuilding[number]\n > {\n constructionNumbers?: ExtendedConstructionNumber[];\n propertyTypes?: ExtendedPropertyType[];\n projectPhase?: ExtendedProjectPhase;\n mapDataItems?: MapDataItem[];\n status?: ApartmentBuildingStatus;\n objectType: 'apartmentBuilding';\n}\n\ninterface ExtendedDistrict\n extends Pick<DistrictModel, 'id' | typeof INCLUDED_PROPERTIES.district[number]> {\n status?: ProjectPhaseStatus;\n mapDataItems?: MapDataItem[];\n objectType: 'district';\n}\n\ninterface ExtendedAreaProject\n extends Pick<AreaProjectModel, 'id' | typeof INCLUDED_PROPERTIES.areaProject[number]> {\n status?: AreaStatus;\n mapDataItems?: MapDataItem[];\n objectType: 'areaProject';\n}\n\ntype ExtendedApiObject =\n | ExtendedConstructionNumber\n | ExtendedApartmentBuilding\n | ExtendedPropertyType\n | ExtendedProjectPhase\n | ExtendedDistrict\n | ExtendedAreaProject;\n\nexport {\n ExtendedConstructionNumber,\n ExtendedPropertyType,\n ExtendedApartmentBuilding,\n ExtendedProjectPhase,\n ExtendedDistrict,\n ExtendedAreaProject,\n ExtendedApiObject,\n PropertyTypeStatus,\n ApartmentBuildingStatus,\n GeneratedConstructionNumberStatus,\n};\n"]}
1
+ {"version":3,"file":"api-utilities.types.js","sourceRoot":"","sources":["../../src/api-utilities/api-utilities.types.ts"],"names":[],"mappings":"","sourcesContent":["import { MapDataItem } from '@bpd-library/types';\n\nimport { INCLUDED_PROPERTIES } from '../extended-api-models/included-properties';\nimport {\n ApartmentBuildingModel,\n AreaProjectModel,\n AreaStatus,\n ConstructionNumberModel,\n DistrictModel,\n ProjectPhaseModel,\n ProjectPhaseStatus,\n PropertyTypeModel,\n} from '../generated';\n\ntype PropertyTypeStatus =\n | 'InPreparation'\n | 'SaleSoon'\n | 'SaleStarted'\n | 'AssigningOn'\n | 'AmountAvailable'\n | 'InOption'\n | 'Sold'\n | 'UnderConstruction'\n | 'ForRent'\n | 'Rented';\n\ntype ApartmentBuildingStatus =\n | 'InPreparation'\n | 'SaleSoon'\n | 'SaleStarted'\n | 'AssigningOn'\n | 'AmountAvailable'\n | 'Available'\n | 'ForRent'\n | 'InOption'\n | 'Sold'\n | 'Rented'\n | 'UnderConstruction';\n\ntype GeneratedConstructionNumberStatus =\n | 'InPreparation'\n | 'InOption'\n | 'Available'\n | 'AssigningOn'\n | 'Sold'\n | 'Rented'\n | 'Reserved'\n | 'UnderConstruction';\n\ninterface ExtendedConstructionNumber\n extends Pick<\n ConstructionNumberModel,\n 'id' | typeof INCLUDED_PROPERTIES.constructionNumber[number]\n > {\n areaProject?: ExtendedAreaProject;\n propertyType?: ExtendedPropertyType;\n projectPhase?: ExtendedProjectPhase;\n mapDataItems?: MapDataItem[];\n apartmentBuilding?: ExtendedApartmentBuilding;\n status?: GeneratedConstructionNumberStatus;\n objectType: 'constructionNumber';\n}\n\ninterface ExtendedPropertyType\n extends Pick<PropertyTypeModel, 'id' | typeof INCLUDED_PROPERTIES.propertyType[number]> {\n constructionNumbers?: ExtendedConstructionNumber[];\n projectPhase?: ExtendedProjectPhase;\n mapDataItems?: MapDataItem[];\n status?: PropertyTypeStatus;\n apartmentBuildings?: ExtendedApartmentBuilding[];\n objectType: 'propertyType';\n}\n\ninterface ExtendedProjectPhase\n extends Pick<ProjectPhaseModel, 'id' | typeof INCLUDED_PROPERTIES.projectPhase[number]> {\n constructionNumbers?: ExtendedConstructionNumber[];\n propertyTypes?: ExtendedPropertyType[];\n mapDataItems?: MapDataItem[];\n objectType: 'projectPhase';\n}\n\ninterface ExtendedApartmentBuilding\n extends Pick<\n ApartmentBuildingModel,\n 'id' | typeof INCLUDED_PROPERTIES.apartmentBuilding[number]\n > {\n constructionNumbers?: ExtendedConstructionNumber[];\n propertyTypes?: ExtendedPropertyType[];\n projectPhase?: ExtendedProjectPhase;\n mapDataItems?: MapDataItem[];\n status?: ApartmentBuildingStatus;\n objectType: 'apartmentBuilding';\n}\n\ninterface ExtendedDistrict\n extends Pick<DistrictModel, 'id' | typeof INCLUDED_PROPERTIES.district[number]> {\n status?: ProjectPhaseStatus;\n mapDataItems?: MapDataItem[];\n objectType: 'district';\n}\n\ninterface ExtendedAreaProject\n extends Pick<AreaProjectModel, 'id' | typeof INCLUDED_PROPERTIES.areaProject[number]> {\n status?: AreaStatus;\n mapDataItems?: MapDataItem[];\n objectType: 'areaProject';\n}\n\ntype ExtendedApiObject =\n | ExtendedConstructionNumber\n | ExtendedApartmentBuilding\n | ExtendedPropertyType\n | ExtendedProjectPhase\n | ExtendedDistrict\n | ExtendedAreaProject;\n\nexport {\n ExtendedConstructionNumber,\n ExtendedPropertyType,\n ExtendedApartmentBuilding,\n ExtendedProjectPhase,\n ExtendedDistrict,\n ExtendedAreaProject,\n ExtendedApiObject,\n PropertyTypeStatus,\n ApartmentBuildingStatus,\n GeneratedConstructionNumberStatus,\n};\n"]}
@@ -1,6 +1,12 @@
1
1
  import { hasDatePassed } from '../../date';
2
2
  const constructionNumberStatus = (constructionNumber) => {
3
- const { projectPhase, availabilityStatus } = constructionNumber;
3
+ const { projectPhase, availabilityStatus, propertyType, apartmentBuilding } = constructionNumber;
4
+ const { status: propertyTypeStatus } = propertyType || {};
5
+ if (propertyTypeStatus === 'AssigningOn')
6
+ return 'AssigningOn';
7
+ const { status: apartmentBuildingStatus } = apartmentBuilding || {};
8
+ if (apartmentBuildingStatus === 'AssigningOn')
9
+ return 'AssigningOn';
4
10
  const { isRental, status: projectPhaseStatus } = projectPhase || {};
5
11
  if (projectPhaseStatus === 'InPreparation')
6
12
  return availabilityStatus === 'Reserved' ? 'Reserved' : 'InPreparation';
@@ -1 +1 @@
1
- {"version":3,"file":"construction-number-status.js","sourceRoot":"","sources":["../../../src/extended-api-models/status/construction-number-status.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,wBAAwB,GAAG,CAC7B,kBAA8C,EACD,EAAE;IAC/C,MAAM,EAAE,YAAY,EAAE,kBAAkB,EAAE,GAAG,kBAAkB,CAAC;IAEhE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,kBAAkB,EAAE,GAAG,YAAY,IAAI,EAAE,CAAC;IAEpE,IAAI,kBAAkB,KAAK,eAAe;QACtC,OAAO,kBAAkB,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,eAAe,CAAC;IAC5E,IAAI,kBAAkB,KAAK,MAAM;QAAE,OAAO,mBAAmB,CAAC;IAE9D,QAAQ,kBAAkB,EAAE;QACxB,KAAK,UAAU;YACX,IACI,kBAAkB,KAAK,QAAQ,KAC/B,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,cAAc,CAAA;gBAC5B,aAAa,CAAC,YAAY,CAAC,cAAc,CAAC,EAC5C;gBACE,OAAO,UAAU,CAAC;aACrB;YACD,OAAO,UAAU,CAAC;QACtB,KAAK,UAAU;YACX,OAAO,UAAU,CAAC;QACtB,KAAK,WAAW;YACZ,OAAO,WAAW,CAAC;QACvB,KAAK,MAAM;YACP,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;KAC3C;IAED,OAAO;AACX,CAAC,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,CAAC","sourcesContent":["import {\n ExtendedConstructionNumber,\n GeneratedConstructionNumberStatus,\n} from '../../api-utilities/api-utilities.types';\nimport { hasDatePassed } from '../../date';\n\nconst constructionNumberStatus = (\n constructionNumber: ExtendedConstructionNumber,\n): GeneratedConstructionNumberStatus | undefined => {\n const { projectPhase, availabilityStatus } = constructionNumber;\n\n const { isRental, status: projectPhaseStatus } = projectPhase || {};\n\n if (projectPhaseStatus === 'InPreparation')\n return availabilityStatus === 'Reserved' ? 'Reserved' : 'InPreparation';\n if (projectPhaseStatus === 'Sold') return 'UnderConstruction';\n\n switch (availabilityStatus) {\n case 'Reserved':\n if (\n projectPhaseStatus === 'OnSale' &&\n projectPhase?.allocationDate &&\n hasDatePassed(projectPhase.allocationDate)\n ) {\n return 'InOption';\n }\n return 'Reserved';\n case 'InOption':\n return 'InOption';\n case 'Available':\n return 'Available';\n case 'Sold':\n return isRental ? 'Rented' : 'Sold';\n }\n\n return;\n};\n\nexport { constructionNumberStatus };\n"]}
1
+ {"version":3,"file":"construction-number-status.js","sourceRoot":"","sources":["../../../src/extended-api-models/status/construction-number-status.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,wBAAwB,GAAG,CAC7B,kBAA8C,EACD,EAAE;IAC/C,MAAM,EAAE,YAAY,EAAE,kBAAkB,EAAE,YAAY,EAAE,iBAAiB,EAAE,GAAG,kBAAkB,CAAC;IAEjG,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAE,GAAG,YAAY,IAAI,EAAE,CAAC;IAC1D,IAAI,kBAAkB,KAAK,aAAa;QAAE,OAAO,aAAa,CAAC;IAE/D,MAAM,EAAE,MAAM,EAAE,uBAAuB,EAAE,GAAG,iBAAiB,IAAI,EAAE,CAAC;IACpE,IAAI,uBAAuB,KAAK,aAAa;QAAE,OAAO,aAAa,CAAC;IAEpE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,kBAAkB,EAAE,GAAG,YAAY,IAAI,EAAE,CAAC;IAEpE,IAAI,kBAAkB,KAAK,eAAe;QACtC,OAAO,kBAAkB,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,eAAe,CAAC;IAC5E,IAAI,kBAAkB,KAAK,MAAM;QAAE,OAAO,mBAAmB,CAAC;IAE9D,QAAQ,kBAAkB,EAAE;QACxB,KAAK,UAAU;YACX,IACI,kBAAkB,KAAK,QAAQ,KAC/B,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,cAAc,CAAA;gBAC5B,aAAa,CAAC,YAAY,CAAC,cAAc,CAAC,EAC5C;gBACE,OAAO,UAAU,CAAC;aACrB;YACD,OAAO,UAAU,CAAC;QACtB,KAAK,UAAU;YACX,OAAO,UAAU,CAAC;QACtB,KAAK,WAAW;YACZ,OAAO,WAAW,CAAC;QACvB,KAAK,MAAM;YACP,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;KAC3C;IAED,OAAO;AACX,CAAC,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,CAAC","sourcesContent":["import {\n ExtendedConstructionNumber,\n GeneratedConstructionNumberStatus,\n} from '../../api-utilities/api-utilities.types';\nimport { hasDatePassed } from '../../date';\n\nconst constructionNumberStatus = (\n constructionNumber: ExtendedConstructionNumber,\n): GeneratedConstructionNumberStatus | undefined => {\n const { projectPhase, availabilityStatus, propertyType, apartmentBuilding } = constructionNumber;\n\n const { status: propertyTypeStatus } = propertyType || {};\n if (propertyTypeStatus === 'AssigningOn') return 'AssigningOn';\n\n const { status: apartmentBuildingStatus } = apartmentBuilding || {};\n if (apartmentBuildingStatus === 'AssigningOn') return 'AssigningOn';\n\n const { isRental, status: projectPhaseStatus } = projectPhase || {};\n\n if (projectPhaseStatus === 'InPreparation')\n return availabilityStatus === 'Reserved' ? 'Reserved' : 'InPreparation';\n if (projectPhaseStatus === 'Sold') return 'UnderConstruction';\n\n switch (availabilityStatus) {\n case 'Reserved':\n if (\n projectPhaseStatus === 'OnSale' &&\n projectPhase?.allocationDate &&\n hasDatePassed(projectPhase.allocationDate)\n ) {\n return 'InOption';\n }\n return 'Reserved';\n case 'InOption':\n return 'InOption';\n case 'Available':\n return 'Available';\n case 'Sold':\n return isRental ? 'Rented' : 'Sold';\n }\n\n return;\n};\n\nexport { constructionNumberStatus };\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpd-library/utilities",
3
- "version": "1.3.9-beta.0",
3
+ "version": "1.3.9-beta.2",
4
4
  "description": "Description",
5
5
  "url": "https://github.com/{repo name}",
6
6
  "license": "MIT",
@@ -45,13 +45,13 @@
45
45
  "publishConfig": {
46
46
  "access": "public"
47
47
  },
48
- "gitHead": "a38460d6b223473b96ed496bb9f34683fc9234b3",
48
+ "gitHead": "917dd608369b743026daaf12e7c7a2613df7aad5",
49
49
  "dependencies": {
50
50
  "@atomify/core": "2.4.1",
51
51
  "@atomify/hooks": "1.1.11",
52
52
  "@atomify/jsx": "1.7.1",
53
53
  "@atomify/kit": "1.1.11",
54
- "@bpd-library/types": "^1.3.9-beta.0",
54
+ "@bpd-library/types": "^1.3.9-beta.2",
55
55
  "qs": "^6.9.4",
56
56
  "query-string": "5"
57
57
  }