@ecogood/e-calculator-schemas 1.0.12 → 1.1.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.
@@ -126,6 +126,16 @@ export declare const BalanceSheetCreateRequestBodySchema: z.ZodObject<{
126
126
  weight?: number | undefined;
127
127
  estimations?: number | undefined;
128
128
  }>, "many">>;
129
+ stakeholderWeights: z.ZodDefault<z.ZodArray<z.ZodObject<{
130
+ shortName: z.ZodString;
131
+ weight: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
132
+ }, "strip", z.ZodTypeAny, {
133
+ shortName: string;
134
+ weight?: number | undefined;
135
+ }, {
136
+ shortName: string;
137
+ weight?: number | undefined;
138
+ }>, "many">>;
129
139
  }, "strip", z.ZodTypeAny, {
130
140
  type: BalanceSheetType;
131
141
  version: BalanceSheetVersion;
@@ -164,6 +174,10 @@ export declare const BalanceSheetCreateRequestBodySchema: z.ZodObject<{
164
174
  weight?: number | undefined;
165
175
  estimations?: number | undefined;
166
176
  }[];
177
+ stakeholderWeights: {
178
+ shortName: string;
179
+ weight?: number | undefined;
180
+ }[];
167
181
  }, {
168
182
  type: BalanceSheetType;
169
183
  version: BalanceSheetVersion;
@@ -202,6 +216,10 @@ export declare const BalanceSheetCreateRequestBodySchema: z.ZodObject<{
202
216
  weight?: number | undefined;
203
217
  estimations?: number | undefined;
204
218
  }[] | undefined;
219
+ stakeholderWeights?: {
220
+ shortName: string;
221
+ weight?: number | undefined;
222
+ }[] | undefined;
205
223
  }>;
206
224
  export declare const BalanceSheetPatchRequestBodySchema: z.ZodObject<{
207
225
  companyFacts: z.ZodOptional<z.ZodObject<{
@@ -327,12 +345,26 @@ export declare const BalanceSheetPatchRequestBodySchema: z.ZodObject<{
327
345
  weight?: number | undefined;
328
346
  estimations?: number | undefined;
329
347
  }>, "many">>;
348
+ stakeholderWeights: z.ZodDefault<z.ZodArray<z.ZodObject<{
349
+ shortName: z.ZodString;
350
+ weight: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
351
+ }, "strip", z.ZodTypeAny, {
352
+ shortName: string;
353
+ weight?: number | undefined;
354
+ }, {
355
+ shortName: string;
356
+ weight?: number | undefined;
357
+ }>, "many">>;
330
358
  }, "strip", z.ZodTypeAny, {
331
359
  ratings: {
332
360
  shortName: string;
333
361
  weight?: number | undefined;
334
362
  estimations?: number | undefined;
335
363
  }[];
364
+ stakeholderWeights: {
365
+ shortName: string;
366
+ weight?: number | undefined;
367
+ }[];
336
368
  companyFacts?: {
337
369
  totalPurchaseFromSuppliers?: number | undefined;
338
370
  totalStaffCosts?: number | undefined;
@@ -399,6 +431,10 @@ export declare const BalanceSheetPatchRequestBodySchema: z.ZodObject<{
399
431
  weight?: number | undefined;
400
432
  estimations?: number | undefined;
401
433
  }[] | undefined;
434
+ stakeholderWeights?: {
435
+ shortName: string;
436
+ weight?: number | undefined;
437
+ }[] | undefined;
402
438
  }>;
403
439
  export declare const BalanceSheetResponseBodySchema: z.ZodObject<{
404
440
  id: z.ZodOptional<z.ZodNumber>;
@@ -575,6 +611,16 @@ export declare const BalanceSheetResponseBodySchema: z.ZodObject<{
575
611
  hasCanteen?: boolean | undefined;
576
612
  averageJourneyToWorkForStaffInKm?: number | undefined;
577
613
  }>;
614
+ stakeholderWeights: z.ZodArray<z.ZodObject<{
615
+ shortName: z.ZodString;
616
+ weight: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
617
+ }, "strip", z.ZodTypeAny, {
618
+ shortName: string;
619
+ weight?: number | undefined;
620
+ }, {
621
+ shortName: string;
622
+ weight?: number | undefined;
623
+ }>, "many">;
578
624
  }, "strip", z.ZodTypeAny, {
579
625
  type: BalanceSheetType;
580
626
  version: BalanceSheetVersion;
@@ -621,6 +667,10 @@ export declare const BalanceSheetResponseBodySchema: z.ZodObject<{
621
667
  points: number;
622
668
  maxPoints: number;
623
669
  }[];
670
+ stakeholderWeights: {
671
+ shortName: string;
672
+ weight?: number | undefined;
673
+ }[];
624
674
  id?: number | undefined;
625
675
  }, {
626
676
  type: BalanceSheetType;
@@ -668,6 +718,10 @@ export declare const BalanceSheetResponseBodySchema: z.ZodObject<{
668
718
  points: number;
669
719
  maxPoints: number;
670
720
  }[];
721
+ stakeholderWeights: {
722
+ shortName: string;
723
+ weight?: number | undefined;
724
+ }[];
671
725
  id?: number | undefined;
672
726
  }>;
673
727
  export declare const BalanceSheetItemResponseSchema: z.ZodObject<{
@@ -5,15 +5,18 @@ const shared_schemas_1 = require("./shared.schemas");
5
5
  const zod_1 = require("zod");
6
6
  const company_facts_dto_1 = require("./company.facts.dto");
7
7
  const rating_dto_1 = require("./rating.dto");
8
+ const stakeholder_weight_dto_1 = require("./stakeholder.weight.dto");
8
9
  exports.BalanceSheetCreateRequestBodySchema = zod_1.z.object({
9
10
  type: zod_1.z.nativeEnum(shared_schemas_1.BalanceSheetType),
10
11
  version: zod_1.z.nativeEnum(shared_schemas_1.BalanceSheetVersion),
11
12
  companyFacts: company_facts_dto_1.CompanyFactsCreateRequestBodySchema.default({}),
12
13
  ratings: rating_dto_1.RatingRequestBodySchema.array().default([]),
14
+ stakeholderWeights: stakeholder_weight_dto_1.StakeholderWeightSchema.array().default([]),
13
15
  });
14
16
  exports.BalanceSheetPatchRequestBodySchema = zod_1.z.object({
15
17
  companyFacts: company_facts_dto_1.CompanyFactsPatchRequestBodySchema.optional(),
16
18
  ratings: rating_dto_1.RatingRequestBodySchema.array().default([]),
19
+ stakeholderWeights: stakeholder_weight_dto_1.StakeholderWeightSchema.array().default([]),
17
20
  });
18
21
  exports.BalanceSheetResponseBodySchema = zod_1.z.object({
19
22
  id: zod_1.z.number().optional(),
@@ -21,6 +24,7 @@ exports.BalanceSheetResponseBodySchema = zod_1.z.object({
21
24
  version: zod_1.z.nativeEnum(shared_schemas_1.BalanceSheetVersion),
22
25
  ratings: rating_dto_1.RatingResponseBodySchema.array(),
23
26
  companyFacts: company_facts_dto_1.CompanyFactsResponseBodySchema,
27
+ stakeholderWeights: stakeholder_weight_dto_1.StakeholderWeightSchema.array(),
24
28
  });
25
29
  exports.BalanceSheetItemResponseSchema = zod_1.z.object({
26
30
  id: zod_1.z.number(),
@@ -1,5 +1,4 @@
1
1
  import { z } from 'zod';
2
- export declare const WEIGHT_VALUES: number[];
3
2
  export declare const RatingRequestBodySchema: z.ZodObject<{
4
3
  shortName: z.ZodString;
5
4
  weight: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
@@ -1,16 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RatingResponseBodySchema = exports.RatingType = exports.RatingRequestBodySchema = exports.WEIGHT_VALUES = void 0;
3
+ exports.RatingResponseBodySchema = exports.RatingType = exports.RatingRequestBodySchema = void 0;
4
4
  const zod_1 = require("zod");
5
- exports.WEIGHT_VALUES = [0, 0.5, 1, 1.5, 2];
5
+ const shared_schemas_1 = require("./shared.schemas");
6
6
  exports.RatingRequestBodySchema = zod_1.z.object({
7
7
  shortName: zod_1.z.string(),
8
- weight: zod_1.z
9
- .number()
10
- .refine((v) => exports.WEIGHT_VALUES.some((w) => w === v), {
11
- message: `Weight has to be one of the following values ${exports.WEIGHT_VALUES}`,
12
- })
13
- .optional(),
8
+ weight: shared_schemas_1.isWeight,
14
9
  estimations: zod_1.z.number().min(-200).max(10).optional(),
15
10
  });
16
11
  var RatingType;
@@ -9,6 +9,7 @@ export declare enum BalanceSheetVersion {
9
9
  v5_0_6 = "5.06",
10
10
  v5_0_8 = "5.08"
11
11
  }
12
+ export declare const isWeight: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
12
13
  export declare const isNumberWithDefaultZero: z.ZodDefault<z.ZodNumber>;
13
14
  export declare const isPositiveNumber: z.ZodDefault<z.ZodNumber>;
14
15
  export declare const isPercentage: z.ZodNumber;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isPercentage = exports.isPositiveNumber = exports.isNumberWithDefaultZero = exports.BalanceSheetVersion = exports.BalanceSheetType = exports.isIndustryCode = exports.isCountryCode = void 0;
3
+ exports.isPercentage = exports.isPositiveNumber = exports.isNumberWithDefaultZero = exports.isWeight = 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);
@@ -20,6 +20,13 @@ const isNumberCustomError = zod_1.z.number({
20
20
  invalid_type_error: 'Number expected',
21
21
  required_error: 'Number expected',
22
22
  });
23
+ const WEIGHT_VALUES = [0, 0.5, 1, 1.5, 2];
24
+ exports.isWeight = zod_1.z
25
+ .number()
26
+ .refine((v) => WEIGHT_VALUES.some((w) => w === v), {
27
+ message: `Weight has to be one of the following values ${WEIGHT_VALUES}`,
28
+ })
29
+ .optional();
23
30
  exports.isNumberWithDefaultZero = isNumberCustomError.default(0);
24
31
  exports.isPositiveNumber = isNumberCustomError
25
32
  .nonnegative('Number should be positive')
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ export declare const StakeholderWeightSchema: z.ZodObject<{
3
+ shortName: z.ZodString;
4
+ weight: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
5
+ }, "strip", z.ZodTypeAny, {
6
+ shortName: string;
7
+ weight?: number | undefined;
8
+ }, {
9
+ shortName: string;
10
+ weight?: number | undefined;
11
+ }>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StakeholderWeightSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const shared_schemas_1 = require("./shared.schemas");
6
+ exports.StakeholderWeightSchema = zod_1.z.object({
7
+ shortName: zod_1.z.string(),
8
+ weight: shared_schemas_1.isWeight,
9
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecogood/e-calculator-schemas",
3
- "version": "1.0.12",
3
+ "version": "1.1.0",
4
4
  "description": "A package providing the schemas for the e-calculator application.",
5
5
  "main": "dist/e-calculator-schemas",
6
6
  "types": "dist/e-calculator-schemas",