@ecogood/e-calculator-schemas 1.0.3 → 1.0.5
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/dist/company.facts.dto.js +25 -40
- package/dist/matrix.dto.d.ts +42 -19
- package/dist/matrix.dto.js +9 -4
- package/dist/shared.schemas.d.ts +3 -0
- package/dist/shared.schemas.js +16 -1
- package/dist/workbook.dto.d.ts +33 -0
- package/dist/workbook.dto.js +11 -0
- package/package.json +1 -1
|
@@ -3,48 +3,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CompanyFactsResponseBodySchema = exports.CompanyFactsPatchRequestBodySchema = exports.CompanyFactsCreateRequestBodySchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const shared_schemas_1 = require("./shared.schemas");
|
|
6
|
-
const isNumberCustomError = zod_1.z.number({
|
|
7
|
-
invalid_type_error: 'Number expected',
|
|
8
|
-
required_error: 'Number expected',
|
|
9
|
-
});
|
|
10
|
-
const isNumberWithDefaultZero = isNumberCustomError.default(0);
|
|
11
|
-
const isPositiveNumber = isNumberCustomError
|
|
12
|
-
.nonnegative('Number should be positive')
|
|
13
|
-
.default(0);
|
|
14
|
-
const isPercentage = zod_1.z
|
|
15
|
-
.number({
|
|
16
|
-
invalid_type_error: 'Percentage expected',
|
|
17
|
-
required_error: 'Percentage expected',
|
|
18
|
-
})
|
|
19
|
-
.min(0, 'Percentage should be between 0 and 100')
|
|
20
|
-
.max(100, 'Percentage should be between 0 and 100');
|
|
21
6
|
const SupplyFractionRequestBodySchema = zod_1.z.object({
|
|
22
7
|
countryCode: shared_schemas_1.isCountryCode.optional(),
|
|
23
8
|
industryCode: shared_schemas_1.isIndustryCode.optional(),
|
|
24
|
-
costs: isPositiveNumber,
|
|
9
|
+
costs: shared_schemas_1.isPositiveNumber,
|
|
25
10
|
});
|
|
26
11
|
const EmployeesFractionRequestBodySchema = zod_1.z.object({
|
|
27
12
|
countryCode: shared_schemas_1.isCountryCode.optional(),
|
|
28
|
-
percentage: isPercentage,
|
|
13
|
+
percentage: shared_schemas_1.isPercentage,
|
|
29
14
|
});
|
|
30
15
|
const IndustrySectorRequestBodySchema = zod_1.z.object({
|
|
31
16
|
industryCode: shared_schemas_1.isIndustryCode.optional(),
|
|
32
|
-
amountOfTotalTurnover: isPercentage,
|
|
17
|
+
amountOfTotalTurnover: shared_schemas_1.isPercentage,
|
|
33
18
|
description: zod_1.z.string().default(''),
|
|
34
19
|
});
|
|
35
20
|
const CompanyFactsRequestBodySchema = zod_1.z.object({
|
|
36
|
-
totalPurchaseFromSuppliers: isPositiveNumber,
|
|
37
|
-
totalStaffCosts: isPositiveNumber,
|
|
38
|
-
profit: isPositiveNumber,
|
|
39
|
-
financialCosts: isPositiveNumber,
|
|
40
|
-
incomeFromFinancialInvestments: isNumberWithDefaultZero,
|
|
41
|
-
additionsToFixedAssets: isNumberWithDefaultZero,
|
|
42
|
-
turnover: isPositiveNumber,
|
|
43
|
-
totalAssets: isPositiveNumber,
|
|
44
|
-
financialAssetsAndCashBalance: isPositiveNumber,
|
|
45
|
-
numberOfEmployees: isPositiveNumber,
|
|
21
|
+
totalPurchaseFromSuppliers: shared_schemas_1.isPositiveNumber,
|
|
22
|
+
totalStaffCosts: shared_schemas_1.isPositiveNumber,
|
|
23
|
+
profit: shared_schemas_1.isPositiveNumber,
|
|
24
|
+
financialCosts: shared_schemas_1.isPositiveNumber,
|
|
25
|
+
incomeFromFinancialInvestments: shared_schemas_1.isNumberWithDefaultZero,
|
|
26
|
+
additionsToFixedAssets: shared_schemas_1.isNumberWithDefaultZero,
|
|
27
|
+
turnover: shared_schemas_1.isPositiveNumber,
|
|
28
|
+
totalAssets: shared_schemas_1.isPositiveNumber,
|
|
29
|
+
financialAssetsAndCashBalance: shared_schemas_1.isPositiveNumber,
|
|
30
|
+
numberOfEmployees: shared_schemas_1.isPositiveNumber,
|
|
46
31
|
hasCanteen: zod_1.z.oboolean(),
|
|
47
|
-
averageJourneyToWorkForStaffInKm: isPositiveNumber,
|
|
32
|
+
averageJourneyToWorkForStaffInKm: shared_schemas_1.isPositiveNumber,
|
|
48
33
|
isB2B: zod_1.z.boolean().default(false),
|
|
49
34
|
supplyFractions: SupplyFractionRequestBodySchema.array().default([]),
|
|
50
35
|
employeesFractions: EmployeesFractionRequestBodySchema.array().default([]),
|
|
@@ -54,18 +39,18 @@ const CompanyFactsRequestBodySchema = zod_1.z.object({
|
|
|
54
39
|
exports.CompanyFactsCreateRequestBodySchema = CompanyFactsRequestBodySchema;
|
|
55
40
|
exports.CompanyFactsPatchRequestBodySchema = CompanyFactsRequestBodySchema.partial();
|
|
56
41
|
exports.CompanyFactsResponseBodySchema = zod_1.z.object({
|
|
57
|
-
totalPurchaseFromSuppliers: isPositiveNumber,
|
|
58
|
-
totalStaffCosts: isPositiveNumber,
|
|
59
|
-
profit: isPositiveNumber,
|
|
60
|
-
financialCosts: isPositiveNumber,
|
|
61
|
-
incomeFromFinancialInvestments: isNumberWithDefaultZero,
|
|
62
|
-
additionsToFixedAssets: isNumberWithDefaultZero,
|
|
63
|
-
turnover: isPositiveNumber,
|
|
64
|
-
totalAssets: isPositiveNumber,
|
|
65
|
-
financialAssetsAndCashBalance: isPositiveNumber,
|
|
66
|
-
numberOfEmployees: isPositiveNumber,
|
|
42
|
+
totalPurchaseFromSuppliers: shared_schemas_1.isPositiveNumber,
|
|
43
|
+
totalStaffCosts: shared_schemas_1.isPositiveNumber,
|
|
44
|
+
profit: shared_schemas_1.isPositiveNumber,
|
|
45
|
+
financialCosts: shared_schemas_1.isPositiveNumber,
|
|
46
|
+
incomeFromFinancialInvestments: shared_schemas_1.isNumberWithDefaultZero,
|
|
47
|
+
additionsToFixedAssets: shared_schemas_1.isNumberWithDefaultZero,
|
|
48
|
+
turnover: shared_schemas_1.isPositiveNumber,
|
|
49
|
+
totalAssets: shared_schemas_1.isPositiveNumber,
|
|
50
|
+
financialAssetsAndCashBalance: shared_schemas_1.isPositiveNumber,
|
|
51
|
+
numberOfEmployees: shared_schemas_1.isPositiveNumber,
|
|
67
52
|
hasCanteen: zod_1.z.oboolean(),
|
|
68
|
-
averageJourneyToWorkForStaffInKm: isPositiveNumber,
|
|
53
|
+
averageJourneyToWorkForStaffInKm: shared_schemas_1.isPositiveNumber,
|
|
69
54
|
isB2B: zod_1.z.boolean(),
|
|
70
55
|
supplyFractions: SupplyFractionRequestBodySchema.array(),
|
|
71
56
|
employeesFractions: EmployeesFractionRequestBodySchema.array(),
|
package/dist/matrix.dto.d.ts
CHANGED
|
@@ -1,23 +1,46 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
export declare const MatrixBodySchema: z.ZodObject<{
|
|
3
|
+
ratings: z.ZodArray<z.ZodObject<{
|
|
4
|
+
shortName: z.ZodString;
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
points: z.ZodNumber;
|
|
7
|
+
maxPoints: z.ZodDefault<z.ZodNumber>;
|
|
8
|
+
percentageReached: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
notApplicable: z.ZodBoolean;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
name: string;
|
|
12
|
+
shortName: string;
|
|
13
|
+
points: number;
|
|
14
|
+
maxPoints: number;
|
|
15
|
+
notApplicable: boolean;
|
|
16
|
+
percentageReached?: number | undefined;
|
|
17
|
+
}, {
|
|
18
|
+
name: string;
|
|
19
|
+
shortName: string;
|
|
20
|
+
points: number;
|
|
21
|
+
notApplicable: boolean;
|
|
22
|
+
maxPoints?: number | undefined;
|
|
23
|
+
percentageReached?: number | undefined;
|
|
24
|
+
}>, "many">;
|
|
25
|
+
totalPoints: z.ZodNumber;
|
|
9
26
|
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
27
|
+
ratings: {
|
|
28
|
+
name: string;
|
|
29
|
+
shortName: string;
|
|
30
|
+
points: number;
|
|
31
|
+
maxPoints: number;
|
|
32
|
+
notApplicable: boolean;
|
|
33
|
+
percentageReached?: number | undefined;
|
|
34
|
+
}[];
|
|
35
|
+
totalPoints: number;
|
|
16
36
|
}, {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
37
|
+
ratings: {
|
|
38
|
+
name: string;
|
|
39
|
+
shortName: string;
|
|
40
|
+
points: number;
|
|
41
|
+
notApplicable: boolean;
|
|
42
|
+
maxPoints?: number | undefined;
|
|
43
|
+
percentageReached?: number | undefined;
|
|
44
|
+
}[];
|
|
45
|
+
totalPoints: number;
|
|
23
46
|
}>;
|
package/dist/matrix.dto.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.MatrixBodySchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
|
|
5
|
+
const shared_schemas_1 = require("./shared.schemas");
|
|
6
|
+
const MatrixRatingBodySchema = zod_1.z.object({
|
|
6
7
|
shortName: zod_1.z.string(),
|
|
7
8
|
name: zod_1.z.string(),
|
|
8
9
|
points: zod_1.z.number(),
|
|
9
|
-
maxPoints:
|
|
10
|
-
percentageReached:
|
|
10
|
+
maxPoints: shared_schemas_1.isPositiveNumber,
|
|
11
|
+
percentageReached: shared_schemas_1.isPercentage.optional(),
|
|
11
12
|
notApplicable: zod_1.z.boolean(),
|
|
12
13
|
});
|
|
14
|
+
exports.MatrixBodySchema = zod_1.z.object({
|
|
15
|
+
ratings: MatrixRatingBodySchema.array(),
|
|
16
|
+
totalPoints: zod_1.z.number(),
|
|
17
|
+
});
|
package/dist/shared.schemas.d.ts
CHANGED
|
@@ -12,3 +12,6 @@ export declare enum BalanceSheetVersion {
|
|
|
12
12
|
v5_0_7 = "5.07",
|
|
13
13
|
v5_0_8 = "5.08"
|
|
14
14
|
}
|
|
15
|
+
export declare const isNumberWithDefaultZero: z.ZodDefault<z.ZodNumber>;
|
|
16
|
+
export declare const isPositiveNumber: z.ZodDefault<z.ZodNumber>;
|
|
17
|
+
export declare const isPercentage: z.ZodNumber;
|
package/dist/shared.schemas.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BalanceSheetVersion = exports.BalanceSheetType = exports.isIndustryCode = exports.isCountryCode = void 0;
|
|
3
|
+
exports.isPercentage = exports.isPositiveNumber = exports.isNumberWithDefaultZero = exports.BalanceSheetVersion = exports.BalanceSheetType = exports.isIndustryCode = exports.isCountryCode = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
exports.isCountryCode = zod_1.z.string().min(3).max(3);
|
|
6
6
|
exports.isIndustryCode = zod_1.z.string().min(1).max(4);
|
|
@@ -22,3 +22,18 @@ var BalanceSheetVersion;
|
|
|
22
22
|
// eslint-disable-next-line camelcase
|
|
23
23
|
BalanceSheetVersion["v5_0_8"] = "5.08";
|
|
24
24
|
})(BalanceSheetVersion = exports.BalanceSheetVersion || (exports.BalanceSheetVersion = {}));
|
|
25
|
+
const isNumberCustomError = zod_1.z.number({
|
|
26
|
+
invalid_type_error: 'Number expected',
|
|
27
|
+
required_error: 'Number expected',
|
|
28
|
+
});
|
|
29
|
+
exports.isNumberWithDefaultZero = isNumberCustomError.default(0);
|
|
30
|
+
exports.isPositiveNumber = isNumberCustomError
|
|
31
|
+
.nonnegative('Number should be positive')
|
|
32
|
+
.default(0);
|
|
33
|
+
exports.isPercentage = zod_1.z
|
|
34
|
+
.number({
|
|
35
|
+
invalid_type_error: 'Percentage expected',
|
|
36
|
+
required_error: 'Percentage expected',
|
|
37
|
+
})
|
|
38
|
+
.min(0, 'Percentage should be between 0 and 100')
|
|
39
|
+
.max(100, 'Percentage should be between 0 and 100');
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const SectionSchema: z.ZodObject<{
|
|
3
|
+
shortName: z.ZodString;
|
|
4
|
+
title: z.ZodString;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
title: string;
|
|
7
|
+
shortName: string;
|
|
8
|
+
}, {
|
|
9
|
+
title: string;
|
|
10
|
+
shortName: string;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const WorkbookResponseBodySchema: z.ZodObject<{
|
|
13
|
+
sections: z.ZodArray<z.ZodObject<{
|
|
14
|
+
shortName: z.ZodString;
|
|
15
|
+
title: z.ZodString;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
title: string;
|
|
18
|
+
shortName: string;
|
|
19
|
+
}, {
|
|
20
|
+
title: string;
|
|
21
|
+
shortName: string;
|
|
22
|
+
}>, "many">;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
sections: {
|
|
25
|
+
title: string;
|
|
26
|
+
shortName: string;
|
|
27
|
+
}[];
|
|
28
|
+
}, {
|
|
29
|
+
sections: {
|
|
30
|
+
title: string;
|
|
31
|
+
shortName: string;
|
|
32
|
+
}[];
|
|
33
|
+
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WorkbookResponseBodySchema = exports.SectionSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.SectionSchema = zod_1.z.object({
|
|
6
|
+
shortName: zod_1.z.string(),
|
|
7
|
+
title: zod_1.z.string(),
|
|
8
|
+
});
|
|
9
|
+
exports.WorkbookResponseBodySchema = zod_1.z.object({
|
|
10
|
+
sections: exports.SectionSchema.array(),
|
|
11
|
+
});
|
package/package.json
CHANGED