@samoa-house-lib/shl-types 1.5.0 → 1.6.1
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/package.json +1 -1
- package/readme.md +11 -0
- package/src/types.ts +6 -6
package/package.json
CHANGED
package/readme.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# SHL Types
|
|
2
|
+
This is the types package for shared types between Samoa House Libraries server and client applications.
|
|
3
|
+
|
|
4
|
+
## Usage
|
|
5
|
+
Include the package in your `package.json` file.
|
|
6
|
+
|
|
7
|
+
## Distribution
|
|
8
|
+
Use the following script to push the package upstream
|
|
9
|
+
```
|
|
10
|
+
npm publish
|
|
11
|
+
```
|
package/src/types.ts
CHANGED
|
@@ -34,27 +34,27 @@ export const textTypeSchema = unionFromEnum(TextVariant)
|
|
|
34
34
|
export const conditionSchema = unionFromEnum(ConditionVariant)
|
|
35
35
|
|
|
36
36
|
export const addBookRequest = z.object({
|
|
37
|
-
donor_first_name: nameSchema.
|
|
37
|
+
donor_first_name: nameSchema.default('*'),
|
|
38
38
|
donor_last_name: nameSchema.optional().nullable(),
|
|
39
|
-
terms: termsSchema.
|
|
39
|
+
terms: termsSchema.default('R'),
|
|
40
40
|
title: z.string().max(150),
|
|
41
|
-
author_first_name: nameSchema.
|
|
41
|
+
author_first_name: nameSchema.default('*'),
|
|
42
42
|
author_last_name: nameSchema.optional().nullable(),
|
|
43
43
|
isbn_issn: z.string().max(13).optional().nullable(),
|
|
44
44
|
recipient: z.string().max(2),
|
|
45
45
|
date_processed: z.string().max(27),
|
|
46
46
|
section: sectionSchema.optional().nullable(),
|
|
47
|
-
book_type: textTypeSchema.
|
|
47
|
+
book_type: textTypeSchema.default(TextVariant.DEFAULT),
|
|
48
48
|
publisher: z.string().optional().nullable(),
|
|
49
49
|
date_published: z.string().max(27).optional().nullable(),
|
|
50
50
|
notes: z.string().max(100).optional().nullable(),
|
|
51
51
|
special_conditions: z.string().optional().nullable(),
|
|
52
|
-
condition: conditionSchema.
|
|
52
|
+
condition: conditionSchema.default(ConditionVariant.GOOD)
|
|
53
53
|
})
|
|
54
54
|
|
|
55
55
|
export const newDbEntrySchema = addBookRequest.extend({
|
|
56
56
|
shl_id: shlIdSchema,
|
|
57
|
-
searchable_title: z.string()
|
|
57
|
+
searchable_title: z.string().toLowerCase()
|
|
58
58
|
})
|
|
59
59
|
|
|
60
60
|
export const dbEntrySchema = newDbEntrySchema.extend({
|