All files / lib/packages/shared-types/events new-chip-submission.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 1/1
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55        186x                                                                             52x         186x            
import { z } from "zod";
 
import { attachmentArraySchema, attachmentArraySchemaOptional } from "../attachments";
 
export const baseSchema = z.object({
  event: z.literal("new-chip-submission").default("new-chip-submission"),
  additionalInformation: z.string().max(4000).nullable().default(null).optional(),
  attachments: z.object({
    currentStatePlan: z.object({
      files: attachmentArraySchema(),
      label: z.string().default("Current State Plan"),
    }),
    amendedLanguage: z.object({
      files: attachmentArraySchema(),
      label: z.string().default("Amended State Plan Language"),
    }),
    coverLetter: z.object({
      files: attachmentArraySchema(),
      label: z.string().default("Cover Letter"),
    }),
    budgetDocuments: z.object({
      files: attachmentArraySchemaOptional(),
      label: z.string().default("Budget Documents"),
    }),
    publicNotice: z.object({
      files: attachmentArraySchemaOptional(),
      label: z.string().default("Public Notice"),
    }),
    tribalConsultation: z.object({
      files: attachmentArraySchemaOptional(),
      label: z.string().default("Tribal Consultation"),
    }),
    other: z.object({
      files: attachmentArraySchemaOptional(),
      label: z.string().default("Other"),
    }),
  }),
  authority: z.string().default("CHIP SPA"),
  proposedEffectiveDate: z.number(),
  actionType: z.string().default("Amend"),
  id: z
    .string()
    .min(1, { message: "Required" })
    .refine((id) => /^[A-Z]{2}-\d{2}-\d{4}(-[A-Z0-9]{1,4})?$/.test(id), {
      message: "ID doesn't match format SS-YY-NNNN or SS-YY-NNNN-XXXX",
    }),
});
 
export const schema = baseSchema.extend({
  origin: z.literal("mako").default("mako"),
  submitterName: z.string(),
  submitterEmail: z.string().email(),
  timestamp: z.number(),
});