@rippledb/zod 0.1.1 → 0.1.2

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.
Files changed (2) hide show
  1. package/README.md +60 -0
  2. package/package.json +29 -12
package/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # @rippledb/zod
2
+
3
+ Zod schemas for runtime validation of RippleDB types.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @rippledb/zod zod
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import {
15
+ pullRequestSchema,
16
+ appendRequestSchema,
17
+ changeSchema,
18
+ createChangeSchema
19
+ } from '@rippledb/zod';
20
+ import { z } from 'zod';
21
+
22
+ // Validate a pull request
23
+ const result = pullRequestSchema.safeParse({
24
+ stream: 'my-stream',
25
+ cursor: null,
26
+ limit: 100,
27
+ });
28
+
29
+ if (result.success) {
30
+ console.log('Valid:', result.data);
31
+ } else {
32
+ console.error('Invalid:', result.error);
33
+ }
34
+
35
+ // Create a typed change schema for your entities
36
+ const todoSchema = z.object({
37
+ id: z.string(),
38
+ title: z.string(),
39
+ done: z.boolean(),
40
+ });
41
+
42
+ const todoChangeSchema = createChangeSchema(todoSchema);
43
+ ```
44
+
45
+ ## Available Schemas
46
+
47
+ | Schema | Description |
48
+ |--------|-------------|
49
+ | `hlcSchema` | HLC timestamp format validation |
50
+ | `changeKindSchema` | Change kind ('upsert' \| 'delete') |
51
+ | `changeSchema` | Generic change object |
52
+ | `createChangeSchema(schema)` | Create typed change schema |
53
+ | `pullRequestSchema` | Pull request validation |
54
+ | `pullResponseSchema` | Pull response validation |
55
+ | `appendRequestSchema` | Append request validation |
56
+ | `appendResultSchema` | Append result validation |
57
+
58
+ ## License
59
+
60
+ Proprietary
package/package.json CHANGED
@@ -1,9 +1,25 @@
1
1
  {
2
2
  "name": "@rippledb/zod",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
+ "description": "Zod schemas for runtime validation of RippleDB types",
4
5
  "private": false,
5
6
  "type": "module",
6
7
  "sideEffects": false,
8
+ "keywords": [
9
+ "rippledb",
10
+ "zod",
11
+ "validation",
12
+ "schema",
13
+ "sync",
14
+ "crdt",
15
+ "local-first",
16
+ "offline-first"
17
+ ],
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/eckerlein/rippledb.git",
21
+ "directory": "packages/zod"
22
+ },
7
23
  "exports": {
8
24
  ".": {
9
25
  "types": "./dist/index.d.ts",
@@ -11,27 +27,22 @@
11
27
  }
12
28
  },
13
29
  "files": [
14
- "dist"
30
+ "dist",
31
+ "README.md"
15
32
  ],
16
33
  "dependencies": {
17
- "@rippledb/core": "workspace:*"
34
+ "@rippledb/core": "0.1.0"
18
35
  },
19
36
  "peerDependencies": {
20
37
  "zod": "^3.0.0"
21
38
  },
22
39
  "devDependencies": {
23
- "@rippledb/server": "workspace:*",
24
40
  "eslint": "^9.37.0",
25
41
  "tsup": "^8.5.0",
26
42
  "typescript": "^5.9.3",
27
43
  "vitest": "^3.2.4",
28
- "zod": "^3.24.0"
29
- },
30
- "scripts": {
31
- "build": "tsup && tsc -p tsconfig.build.json",
32
- "test": "vitest run --pool=threads",
33
- "test:watch": "vitest --pool=threads",
34
- "lint": "eslint ."
44
+ "zod": "^3.24.0",
45
+ "@rippledb/server": "0.1.0"
35
46
  },
36
47
  "tsup": {
37
48
  "entry": [
@@ -43,5 +54,11 @@
43
54
  "dts": false,
44
55
  "sourcemap": true,
45
56
  "clean": true
57
+ },
58
+ "scripts": {
59
+ "build": "tsup && tsc -p tsconfig.build.json",
60
+ "test": "vitest run --pool=threads",
61
+ "test:watch": "vitest --pool=threads",
62
+ "lint": "eslint ."
46
63
  }
47
- }
64
+ }