@weser/schema 0.0.13 → 0.0.15

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.
package/README.md CHANGED
@@ -1,53 +1,3 @@
1
- # @weser/context
1
+ # @weser/schema
2
2
 
3
- <img alt="npm version" src="https://badge.fury.io/js/@weser%2Fcontext.svg"> <img alt="npm downloads" src="https://img.shields.io/npm/dm/@weser/context.svg"> <a href="https://bundlephobia.com/result?p=@weser/context@latest"><img alt="Bundlephobia" src="https://img.shields.io/bundlephobia/minzip/@weser/context.svg"></a>
4
-
5
- ## Installation
6
-
7
- ```sh
8
- # npm
9
- npm i --save @weser/context
10
- # yarn
11
- yarn add @weser/context
12
- # pnpm
13
- pnpm add @weser/context
14
- ```
15
-
16
- ## Documentation
17
-
18
- ### `createContext<T>`
19
-
20
- #### Parameters
21
-
22
- | Parameter | Type | Default | Description |
23
- | ------------ | --------- | ------- | -------------------------------------------------------- |
24
- | defaultValue | `T` | `null` | The default value for when no provider is used |
25
- | name |  `string` | `""` | (Optional) A name for the context used in error messages |
26
-
27
- ```tsx
28
- import { createContext } from '@weser/context'
29
-
30
- type Theme = 'light' | 'dark'
31
-
32
- const [useTheme, ThemeProvider] = createContext<Theme>('light', 'theme')
33
-
34
- function App({ children }) {
35
- return <ThemeProvider value="dark">{children}</ThemeProvider>
36
- }
37
-
38
- function Component() {
39
- const theme = useTheme()
40
-
41
- return (
42
- <div style={{ backgroundColor: theme === 'dark' ? 'black' : 'white' }}>
43
- Hello
44
- </div>
45
- )
46
- }
47
- ```
48
-
49
- ## License
50
-
51
- @weser/context is licensed under the [MIT License](http://opensource.org/licenses/MIT).<br>
52
- Documentation is licensed under [Creative Common License](http://creativecommons.org/licenses/by/4.0/).<br>
53
- Created with ♥ by [@robinweser](http://weser.io).
3
+ [Documentation](https://packages.weser.io/schema)
@@ -6,7 +6,7 @@ export declare function createEnumSchema(values: ReadonlyArray<string>, options?
6
6
  export declare function createStringSchema(options?: {
7
7
  minLength?: number;
8
8
  maxLength?: number;
9
- format?: 'date' | 'uri';
9
+ format?: 'date' | 'uri' | 'email';
10
10
  description?: string;
11
11
  default?: string;
12
12
  }): T_JSONSchemaString;
package/dist/toZod.js CHANGED
@@ -29,6 +29,9 @@ export function toZodString({ minLength, maxLength, description, default: _defau
29
29
  else if (format === 'date') {
30
30
  type = type.date();
31
31
  }
32
+ else if (format === 'email') {
33
+ type = type.email();
34
+ }
32
35
  type = type.meta({ ...meta, ...(format ? { format } : {}) });
33
36
  if (description) {
34
37
  type = type.describe(description);
package/dist/types.d.ts CHANGED
@@ -14,7 +14,7 @@ export type T_JSONSchemaString = T_JSONSchemaRaw & {
14
14
  type: 'string';
15
15
  minLength?: number;
16
16
  maxLength?: number;
17
- format?: 'date' | 'uri';
17
+ format?: 'date' | 'uri' | 'email';
18
18
  default?: string;
19
19
  };
20
20
  export type T_JSONSchemaNumber = T_JSONSchemaRaw & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weser/schema",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "Helpers for working with Zod and JSON Schema",
5
5
  "author": "Robin Weser <robin@weser.io>",
6
6
  "license": "MIT",
@@ -51,5 +51,5 @@
51
51
  "typescript": "^5.4.5",
52
52
  "zod": "4.0.0-beta.20250505T195954"
53
53
  },
54
- "gitHead": "2e5430bd1d2f421a9ab85dff0918b89023f8039b"
54
+ "gitHead": "09f1d19b11a34e519fd35cf91cede2b75f38356c"
55
55
  }