@ecogood/e-calculator-schemas 1.1.0 → 1.2.1

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.
@@ -127,7 +127,7 @@ export declare const BalanceSheetCreateRequestBodySchema: z.ZodObject<{
127
127
  estimations?: number | undefined;
128
128
  }>, "many">>;
129
129
  stakeholderWeights: z.ZodDefault<z.ZodArray<z.ZodObject<{
130
- shortName: z.ZodString;
130
+ shortName: z.ZodEffects<z.ZodString, string, string>;
131
131
  weight: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
132
132
  }, "strip", z.ZodTypeAny, {
133
133
  shortName: string;
@@ -345,8 +345,8 @@ export declare const BalanceSheetPatchRequestBodySchema: z.ZodObject<{
345
345
  weight?: number | undefined;
346
346
  estimations?: number | undefined;
347
347
  }>, "many">>;
348
- stakeholderWeights: z.ZodDefault<z.ZodArray<z.ZodObject<{
349
- shortName: z.ZodString;
348
+ stakeholderWeights: z.ZodOptional<z.ZodArray<z.ZodObject<{
349
+ shortName: z.ZodEffects<z.ZodString, string, string>;
350
350
  weight: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
351
351
  }, "strip", z.ZodTypeAny, {
352
352
  shortName: string;
@@ -361,10 +361,6 @@ export declare const BalanceSheetPatchRequestBodySchema: z.ZodObject<{
361
361
  weight?: number | undefined;
362
362
  estimations?: number | undefined;
363
363
  }[];
364
- stakeholderWeights: {
365
- shortName: string;
366
- weight?: number | undefined;
367
- }[];
368
364
  companyFacts?: {
369
365
  totalPurchaseFromSuppliers?: number | undefined;
370
366
  totalStaffCosts?: number | undefined;
@@ -395,6 +391,10 @@ export declare const BalanceSheetPatchRequestBodySchema: z.ZodObject<{
395
391
  }[] | undefined;
396
392
  mainOriginOfOtherSuppliers?: string | undefined;
397
393
  } | undefined;
394
+ stakeholderWeights?: {
395
+ shortName: string;
396
+ weight?: number | undefined;
397
+ }[] | undefined;
398
398
  }, {
399
399
  companyFacts?: {
400
400
  totalPurchaseFromSuppliers?: number | undefined;
@@ -612,7 +612,7 @@ export declare const BalanceSheetResponseBodySchema: z.ZodObject<{
612
612
  averageJourneyToWorkForStaffInKm?: number | undefined;
613
613
  }>;
614
614
  stakeholderWeights: z.ZodArray<z.ZodObject<{
615
- shortName: z.ZodString;
615
+ shortName: z.ZodEffects<z.ZodString, string, string>;
616
616
  weight: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
617
617
  }, "strip", z.ZodTypeAny, {
618
618
  shortName: string;
@@ -16,7 +16,7 @@ exports.BalanceSheetCreateRequestBodySchema = zod_1.z.object({
16
16
  exports.BalanceSheetPatchRequestBodySchema = zod_1.z.object({
17
17
  companyFacts: company_facts_dto_1.CompanyFactsPatchRequestBodySchema.optional(),
18
18
  ratings: rating_dto_1.RatingRequestBodySchema.array().default([]),
19
- stakeholderWeights: stakeholder_weight_dto_1.StakeholderWeightSchema.array().default([]),
19
+ stakeholderWeights: stakeholder_weight_dto_1.StakeholderWeightSchema.array().optional(),
20
20
  });
21
21
  exports.BalanceSheetResponseBodySchema = zod_1.z.object({
22
22
  id: zod_1.z.number().optional(),
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  export declare const StakeholderWeightSchema: z.ZodObject<{
3
- shortName: z.ZodString;
3
+ shortName: z.ZodEffects<z.ZodString, string, string>;
4
4
  weight: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
5
5
  }, "strip", z.ZodTypeAny, {
6
6
  shortName: string;
@@ -3,7 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StakeholderWeightSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const shared_schemas_1 = require("./shared.schemas");
6
+ const STAKEHOLDER_NAMES = ['A', 'B', 'C', 'D', 'E'];
7
+ const isStakeholderShortName = zod_1.z
8
+ .string()
9
+ .refine((v) => STAKEHOLDER_NAMES.some((w) => w === v), {
10
+ message: `Short name has to be one of the following values ${STAKEHOLDER_NAMES}`,
11
+ });
6
12
  exports.StakeholderWeightSchema = zod_1.z.object({
7
- shortName: zod_1.z.string(),
13
+ shortName: isStakeholderShortName,
8
14
  weight: shared_schemas_1.isWeight,
9
15
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecogood/e-calculator-schemas",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
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",