@ecogood/e-calculator-schemas 2.4.5 → 2.5.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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2021 Michael Rudolph
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Michael Rudolph
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
package/README.md CHANGED
@@ -1,26 +1,26 @@
1
- # E-Calculator Schemas
2
-
3
- This project contains the data transfer objects which are used by the [E-Calculator REST API](https://git.ecogood.org/services/balance-sheet-calculator)
4
- and the [E-Calculator Frontend](https://git.ecogood.org/services/e-calculator-frontend).
5
-
6
- ## Install
7
-
8
- ```bash
9
- npm install e-calculator-schemas
10
- ```
11
-
12
- ## Usage
13
-
14
- ```typescript
15
- import { RegionResponseBodySchema } from 'e-calculator-schemas/dist/region.dto';
16
- const regionJson = {
17
- countryCode: 'DEU',
18
- countryName: 'Germany',
19
- };
20
- RegionResponseBodySchema.parse(regionJson);
21
- ```
22
-
23
- ## Publish
24
- ```bash
25
- npm publish
26
- ```
1
+ # E-Calculator Schemas
2
+
3
+ This project contains the data transfer objects which are used by the [E-Calculator REST API](https://git.ecogood.org/services/balance-sheet-calculator)
4
+ and the [E-Calculator Frontend](https://git.ecogood.org/services/e-calculator-frontend).
5
+
6
+ ## Install
7
+
8
+ ```bash
9
+ npm install e-calculator-schemas
10
+ ```
11
+
12
+ ## Usage
13
+
14
+ ```typescript
15
+ import { RegionResponseBodySchema } from 'e-calculator-schemas/dist/region.dto';
16
+ const regionJson = {
17
+ countryCode: 'DEU',
18
+ countryName: 'Germany',
19
+ };
20
+ RegionResponseBodySchema.parse(regionJson);
21
+ ```
22
+
23
+ ## Publish
24
+ ```bash
25
+ npm publish
26
+ ```
@@ -28,22 +28,6 @@ export declare const EmployeesFractionSchema: z.ZodEffects<z.ZodArray<z.ZodObjec
28
28
  percentage: number;
29
29
  countryCode?: string | undefined;
30
30
  }[]>;
31
- export declare const EmployeesFractionSchemaFrontEnd: z.ZodEffects<z.ZodArray<z.ZodObject<{
32
- countryCode: z.ZodOptional<z.ZodString>;
33
- percentage: z.ZodNumber;
34
- }, "strip", z.ZodTypeAny, {
35
- percentage: number;
36
- countryCode?: string | undefined;
37
- }, {
38
- percentage: number;
39
- countryCode?: string | undefined;
40
- }>, "many">, {
41
- percentage: number;
42
- countryCode?: string | undefined;
43
- }[], {
44
- percentage: number;
45
- countryCode?: string | undefined;
46
- }[]>;
47
31
  export declare const IndustrySectorSchema: z.ZodEffects<z.ZodArray<z.ZodObject<{
48
32
  industryCode: z.ZodOptional<z.ZodString>;
49
33
  amountOfTotalTurnover: z.ZodNumber;
@@ -65,27 +49,6 @@ export declare const IndustrySectorSchema: z.ZodEffects<z.ZodArray<z.ZodObject<{
65
49
  description?: string | undefined;
66
50
  industryCode?: string | undefined;
67
51
  }[]>;
68
- export declare const IndustrySectorSchemaFrontEnd: z.ZodEffects<z.ZodArray<z.ZodObject<{
69
- industryCode: z.ZodOptional<z.ZodString>;
70
- amountOfTotalTurnover: z.ZodNumber;
71
- description: z.ZodDefault<z.ZodString>;
72
- }, "strip", z.ZodTypeAny, {
73
- description: string;
74
- amountOfTotalTurnover: number;
75
- industryCode?: string | undefined;
76
- }, {
77
- amountOfTotalTurnover: number;
78
- description?: string | undefined;
79
- industryCode?: string | undefined;
80
- }>, "many">, {
81
- description: string;
82
- amountOfTotalTurnover: number;
83
- industryCode?: string | undefined;
84
- }[], {
85
- amountOfTotalTurnover: number;
86
- description?: string | undefined;
87
- industryCode?: string | undefined;
88
- }[]>;
89
52
  export declare const CompanyFactsCreateRequestBodySchema: z.ZodObject<{
90
53
  totalPurchaseFromSuppliers: z.ZodDefault<z.ZodNumber>;
91
54
  totalStaffCosts: z.ZodDefault<z.ZodNumber>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CompanyFactsResponseBodySchema = exports.CompanyFactsPatchRequestBodySchema = exports.CompanyFactsCreateRequestBodySchema = exports.IndustrySectorSchemaFrontEnd = exports.IndustrySectorSchema = exports.EmployeesFractionSchemaFrontEnd = exports.EmployeesFractionSchema = exports.SupplyFractionSchema = void 0;
3
+ exports.CompanyFactsResponseBodySchema = exports.CompanyFactsPatchRequestBodySchema = exports.CompanyFactsCreateRequestBodySchema = exports.IndustrySectorSchema = exports.EmployeesFractionSchema = exports.SupplyFractionSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const shared_schemas_1 = require("./shared.schemas");
6
6
  function isSumGreaterThan(array, value) {
@@ -18,15 +18,6 @@ exports.SupplyFractionSchema = zod_1.z
18
18
  })
19
19
  .array();
20
20
  exports.EmployeesFractionSchema = zod_1.z
21
- .object({
22
- countryCode: shared_schemas_1.isCountryCode.optional(),
23
- percentage: shared_schemas_1.isPercentage,
24
- })
25
- .array()
26
- .refine((efs) => !isSumGreaterThan(efs.map((ef) => ef.percentage), 100), {
27
- message: sumOfPercentagesSmallerEqual100Msg,
28
- });
29
- exports.EmployeesFractionSchemaFrontEnd = zod_1.z
30
21
  .object({
31
22
  countryCode: shared_schemas_1.isCountryCode.optional(),
32
23
  percentage: shared_schemas_1.isPercentageNotZero,
@@ -36,16 +27,6 @@ exports.EmployeesFractionSchemaFrontEnd = zod_1.z
36
27
  message: sumOfPercentagesSmallerEqual100Msg,
37
28
  });
38
29
  exports.IndustrySectorSchema = zod_1.z
39
- .object({
40
- industryCode: shared_schemas_1.isIndustryCode.optional(),
41
- amountOfTotalTurnover: shared_schemas_1.isPercentage,
42
- description: zod_1.z.string().default(''),
43
- })
44
- .array()
45
- .refine((is) => !isSumGreaterThan(is.map((is) => is.amountOfTotalTurnover), 100), {
46
- message: sumOfPercentagesSmallerEqual100Msg,
47
- });
48
- exports.IndustrySectorSchemaFrontEnd = zod_1.z
49
30
  .object({
50
31
  industryCode: shared_schemas_1.isIndustryCode.optional(),
51
32
  amountOfTotalTurnover: shared_schemas_1.isPercentageNotZero,
package/package.json CHANGED
@@ -1,52 +1,52 @@
1
- {
2
- "name": "@ecogood/e-calculator-schemas",
3
- "version": "2.4.5",
4
- "description": "A package providing the schemas for the e-calculator application.",
5
- "main": "dist/e-calculator-schemas",
6
- "types": "dist/e-calculator-schemas",
7
- "scripts": {
8
- "build": "tsc",
9
- "test": "jest --watch --runInBand",
10
- "test:ci": "jest --runInBand",
11
- "format": "prettier --write .",
12
- "lint": "eslint .",
13
- "lint-fix": "eslint . --fix",
14
- "update:to:latest": "ncu -u && yarn update && yarn install && yarn audit fix",
15
- "prepare": "rm -r dist || true && yarn run build && yarn run test:ci && yarn run lint"
16
- },
17
- "publishConfig": {
18
- "access": "public"
19
- },
20
- "files": [
21
- "dist",
22
- "LICENSE",
23
- "README.md"
24
- ],
25
- "repository": {
26
- "type": "git",
27
- "url": "https://git.ecogood.org/services/e-calculator-schemas"
28
- },
29
- "keywords": [
30
- "version",
31
- "compare"
32
- ],
33
- "author": "Michael Rudolph",
34
- "license": "MIT",
35
- "bugs": {
36
- "url": "https://git.ecogood.org/services/e-calculator-schemas/issues"
37
- },
38
- "devDependencies": {
39
- "@eslint/js": "^9.4.0",
40
- "@types/eslint__js": "^8.42.3",
41
- "@types/jest": "^28.1.6",
42
- "eslint": "^9.4.0",
43
- "jest": "^29.5.0",
44
- "prettier": "2.3.2",
45
- "ts-jest": "^29.0.5",
46
- "typescript": "^5.4.5",
47
- "typescript-eslint": "^7.13.0"
48
- },
49
- "dependencies": {
50
- "zod": "^3.23.8"
51
- }
52
- }
1
+ {
2
+ "name": "@ecogood/e-calculator-schemas",
3
+ "version": "2.5.0",
4
+ "description": "A package providing the schemas for the e-calculator application.",
5
+ "main": "dist/e-calculator-schemas",
6
+ "types": "dist/e-calculator-schemas",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "test": "jest --watch --runInBand",
10
+ "test:ci": "jest --runInBand",
11
+ "format": "prettier --write .",
12
+ "lint": "eslint .",
13
+ "lint-fix": "eslint . --fix",
14
+ "update:to:latest": "ncu -u && yarn update && yarn install && yarn audit fix",
15
+ "prepare": "rm -r dist || true && yarn run build && yarn run test:ci && yarn run lint"
16
+ },
17
+ "publishConfig": {
18
+ "access": "public"
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "LICENSE",
23
+ "README.md"
24
+ ],
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "https://git.ecogood.org/services/e-calculator-schemas"
28
+ },
29
+ "keywords": [
30
+ "version",
31
+ "compare"
32
+ ],
33
+ "author": "Michael Rudolph",
34
+ "license": "MIT",
35
+ "bugs": {
36
+ "url": "https://git.ecogood.org/services/e-calculator-schemas/issues"
37
+ },
38
+ "devDependencies": {
39
+ "@eslint/js": "^9.4.0",
40
+ "@types/eslint__js": "^8.42.3",
41
+ "@types/jest": "^28.1.6",
42
+ "eslint": "^9.4.0",
43
+ "jest": "^29.5.0",
44
+ "prettier": "2.3.2",
45
+ "ts-jest": "^29.0.5",
46
+ "typescript": "^5.4.5",
47
+ "typescript-eslint": "^7.13.0"
48
+ },
49
+ "dependencies": {
50
+ "zod": "^3.23.8"
51
+ }
52
+ }