@tiboli/types 0.0.10 → 0.0.11
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 +117 -0
- package/dist/cjs/package.json +3 -0
- package/package.json +5 -5
- /package/dist/cjs/{index.cjs → index.js} +0 -0
- /package/dist/cjs/schemas/{book.schema.cjs → book.schema.js} +0 -0
- /package/dist/cjs/schemas/{copy.schema.cjs → copy.schema.js} +0 -0
- /package/dist/cjs/schemas/{customer.schema.cjs → customer.schema.js} +0 -0
- /package/dist/cjs/schemas/{group.schema.cjs → group.schema.js} +0 -0
- /package/dist/cjs/schemas/{index.cjs → index.js} +0 -0
- /package/dist/cjs/schemas/{loan.schema.cjs → loan.schema.js} +0 -0
- /package/dist/cjs/types/{book.type.cjs → book.type.js} +0 -0
- /package/dist/cjs/types/{copy.type.cjs → copy.type.js} +0 -0
- /package/dist/cjs/types/{customer.type.cjs → customer.type.js} +0 -0
- /package/dist/cjs/types/{group.types.cjs → group.types.js} +0 -0
- /package/dist/cjs/types/{index.cjs → index.js} +0 -0
- /package/dist/cjs/types/{loan.type.cjs → loan.type.js} +0 -0
package/README.md
CHANGED
|
@@ -5,3 +5,120 @@ Here you can find all the type definitions for [TiBoLi](https://tiboli.tech4web.
|
|
|
5
5
|
## Contributing
|
|
6
6
|
|
|
7
7
|
If you want to Contribute, make sure to follow the Guidelines highlighted in `CONTRIBUTING.md`
|
|
8
|
+
|
|
9
|
+
## Documentation
|
|
10
|
+
|
|
11
|
+
The following Zod schemas define the structure of the core data entities and their corresponding creation and update payloads.
|
|
12
|
+
|
|
13
|
+
### Book
|
|
14
|
+
|
|
15
|
+
Represents a book in the library.
|
|
16
|
+
|
|
17
|
+
| Field | Type | Description |
|
|
18
|
+
| -------- | --------- | ----------------------------- |
|
|
19
|
+
| `id` | `integer` | Unique identifier of the book |
|
|
20
|
+
| `title` | `string` | Title of the book |
|
|
21
|
+
| `author` | `string` | Author of the book |
|
|
22
|
+
|
|
23
|
+
#### Variants
|
|
24
|
+
|
|
25
|
+
* **`BookSchema`** — Complete book object.
|
|
26
|
+
* **`BookCreationSchema`** — Book data for creation. Omits `id`.
|
|
27
|
+
* **`BookUpdateSchema`** — Partial book update. Requires `id`; all other fields are optional.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
### Copy
|
|
32
|
+
|
|
33
|
+
Represents a physical copy of a book.
|
|
34
|
+
|
|
35
|
+
| Field | Type | Description |
|
|
36
|
+
| -------- | --------- | ----------------------------------- |
|
|
37
|
+
| `id` | `integer` | Unique identifier of the copy |
|
|
38
|
+
| `bookId` | `integer` | ID of the book this copy belongs to |
|
|
39
|
+
|
|
40
|
+
#### Variants
|
|
41
|
+
|
|
42
|
+
* **`CopySchema`** — Complete copy object.
|
|
43
|
+
* **`CopyCreationSchema`** — Copy data for creation. Omits `id`.
|
|
44
|
+
* **`CopyUpdateSchema`** — Partial copy update. Requires `id`; all other fields are optional.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
### Customer
|
|
49
|
+
|
|
50
|
+
Represents a customer or borrower in the library.
|
|
51
|
+
|
|
52
|
+
| Field | Type | Description |
|
|
53
|
+
| ---------- | --------- | ----------------------------------- |
|
|
54
|
+
| `id` | `integer` | Unique identifier of the customer |
|
|
55
|
+
| `name` | `string` | First name of the customer |
|
|
56
|
+
| `lastname` | `string` | Last name of the customer |
|
|
57
|
+
| `email` | `email` | Valid email address of the customer |
|
|
58
|
+
|
|
59
|
+
#### Variants
|
|
60
|
+
|
|
61
|
+
* **`CustomerSchema`** — Complete customer object.
|
|
62
|
+
* **`CustomerCreationSchema`** — Customer data for creation. Omits `id`.
|
|
63
|
+
* **`CustomerUpdateSchema`** — Partial customer update. Requires `id`; all other fields are optional.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
### Group
|
|
68
|
+
|
|
69
|
+
Represents a group of customers.
|
|
70
|
+
|
|
71
|
+
| Field | Type | Description |
|
|
72
|
+
| ------ | --------- | ------------------------------ |
|
|
73
|
+
| `id` | `integer` | Unique identifier of the group |
|
|
74
|
+
| `name` | `string` | Name of the group |
|
|
75
|
+
|
|
76
|
+
#### Variants
|
|
77
|
+
|
|
78
|
+
* **`GroupSchema`** — Complete group object.
|
|
79
|
+
* **`GroupCreationSchema`** — Group data for creation. Omits `id`.
|
|
80
|
+
* **`GroupUpdateSchema`** — Partial group update. Requires `id`; all other fields are optional.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
### Loan
|
|
85
|
+
|
|
86
|
+
Represents a loan of a physical book copy to a customer.
|
|
87
|
+
|
|
88
|
+
| Field | Type | Description |
|
|
89
|
+
| ------------ | --------- | ---------------------------------------- |
|
|
90
|
+
| `id` | `integer` | Unique identifier of the loan |
|
|
91
|
+
| `copyId` | `integer` | ID of the borrowed book copy |
|
|
92
|
+
| `customerId` | `integer` | ID of the customer who borrowed the copy |
|
|
93
|
+
| `lentDate` | `date` | Date on which the copy was lent |
|
|
94
|
+
| `dueDate` | `date` | Date on which the copy is due |
|
|
95
|
+
| `returnDate` | `date` | Date on which the copy was returned |
|
|
96
|
+
|
|
97
|
+
#### Variants
|
|
98
|
+
|
|
99
|
+
* **`LoanSchema`** — Complete loan object.
|
|
100
|
+
* **`LoanCreationSchema`** — Loan data for creation. Omits `id`.
|
|
101
|
+
* **`LoanUpdateSchema`** — Partial loan update. Requires `id`; all other fields are optional.
|
|
102
|
+
|
|
103
|
+
### Schema Variants
|
|
104
|
+
|
|
105
|
+
All entities follow the same pattern:
|
|
106
|
+
|
|
107
|
+
```text
|
|
108
|
+
EntitySchema
|
|
109
|
+
├── EntityCreationSchema
|
|
110
|
+
│ └── Omits `id`
|
|
111
|
+
└── EntityUpdateSchema
|
|
112
|
+
├── Requires `id`
|
|
113
|
+
└── Makes all other fields optional
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
This allows the schemas to be reused consistently for validating complete entities, creation requests, and partial update requests.
|
|
117
|
+
|
|
118
|
+
### Inferred types
|
|
119
|
+
|
|
120
|
+
Each of the Schemas get's a Type inferred using `z.infer`. The types are named `Attributes` instead of Schemas. For instance.
|
|
121
|
+
|
|
122
|
+
- `EntitySchema` -> `EntityAttributes`
|
|
123
|
+
- `EntityCreationSchema` -> `EntityCreationAttributes`
|
|
124
|
+
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiboli/types",
|
|
3
3
|
"scope": "@tiboli",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.11",
|
|
5
5
|
"description": "Typedefinitions for Tiboli",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiboli",
|
|
@@ -15,24 +15,24 @@
|
|
|
15
15
|
"files": [
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
18
|
-
"main": "./dist/cjs/index.
|
|
18
|
+
"main": "./dist/cjs/index.js",
|
|
19
19
|
"module": "./dist/esm/index.js",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"exports": {
|
|
22
22
|
".": {
|
|
23
23
|
"types": "./dist/types/index.d.ts",
|
|
24
24
|
"import": "./dist/esm/index.js",
|
|
25
|
-
"require": "./dist/cjs/index.
|
|
25
|
+
"require": "./dist/cjs/index.js"
|
|
26
26
|
},
|
|
27
27
|
"./schemas": {
|
|
28
28
|
"types": "./dist/types/schemas/index.d.ts",
|
|
29
29
|
"import": "./dist/esm/schemas/index.js",
|
|
30
|
-
"require": "./dist/cjs/schemas/index.
|
|
30
|
+
"require": "./dist/cjs/schemas/index.js"
|
|
31
31
|
},
|
|
32
32
|
"./types": {
|
|
33
33
|
"types": "./dist/types/types/index.d.ts",
|
|
34
34
|
"import": "./dist/esm/types/index.js",
|
|
35
|
-
"require": "./dist/cjs/types/index.
|
|
35
|
+
"require": "./dist/cjs/types/index.js"
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|