Skip to content

Commit

Permalink
Update tests and types for package privacy and enums
Browse files Browse the repository at this point in the history
  • Loading branch information
alec-chernicki committed Jul 14, 2024
1 parent b2b1e2a commit ec3e4d6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/data-packages/src/get-package.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('getPackage', () => {
churn: 0.3,
complexity: 0.3,
license: 'MIT',
private: true,
privacy: 'PRIVATE',
});
});
});
18 changes: 18 additions & 0 deletions packages/types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import { z } from 'zod';

export const privacyEnum = z.enum(['PUBLIC', 'PRIVATE']);

export const dependencyTypeEnum = z.enum(['PRODUCTION', 'DEVELOPMENT', 'PEER']);

export const blockTypeEnum = z.enum(['REACT', 'NODE', 'NEXT']);

export type Constraint =
| {
allow: string[] | typeof AllPackagesWildcard;
Expand Down Expand Up @@ -59,6 +63,20 @@ export type Tag = string;

export type TagsData = { packageName: string; tags: Tag[] };

const blockSchema = z.object({
path: z.string(),
type: blockTypeEnum,
name: z.string(),
description: z.string().optional(),
version: z.string(),
churn: z.number(),
complexity: z.number(),
license: z.string().optional(),
privacy: privacyEnum,
});

export type Block = z.infer<typeof blockSchema>;

export type Package = {
path: string;
type: BlockType;
Expand Down

0 comments on commit ec3e4d6

Please sign in to comment.