@ecogood/e-calculator-schemas 1.2.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;
@@ -346,7 +346,7 @@ export declare const BalanceSheetPatchRequestBodySchema: z.ZodObject<{
346
346
  estimations?: number | undefined;
347
347
  }>, "many">>;
348
348
  stakeholderWeights: z.ZodOptional<z.ZodArray<z.ZodObject<{
349
- shortName: z.ZodString;
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;
@@ -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;
@@ -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.2.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",