|
1 | | -<div align="center"> |
2 | | - <img src="Images/friendly_robot.png" width="120"/> |
3 | | - <h1 style="font-size:48px">Store5</h1> |
4 | | -</div> |
5 | | - |
6 | | -[](https://codecov.io/gh/MobileNativeFoundation/Store) |
7 | | - |
8 | | -<div align="center"> |
9 | | - <h4>Full documentation can be found on our <a href="https://mobilenativefoundation.github.io/Store/">website</a>!</h4> |
10 | | - <h4>Join our official Slack on <a href="https://kotlinlang.slack.com/archives/C06007Z01HU">kotlinlang</a>!</h4> |
11 | | -</div> |
12 | | - |
13 | | -### Concepts |
14 | | - |
15 | | -- [Store](https://mobilenativefoundation.github.io/Store/store/store/) is a typed repository that returns a flow |
16 | | - of [Data](https://github.com/MobileNativeFoundation/Store/blob/main/store/src/commonMain/kotlin/org/mobilenativefoundation/store/store5/StoreReadResponse.kt#L39) |
17 | | - /[Loading](https://github.com/MobileNativeFoundation/Store/blob/main/store/src/commonMain/kotlin/org/mobilenativefoundation/store/store5/StoreReadResponse.kt#L34) |
18 | | - /[Error](https://github.com/MobileNativeFoundation/Store/blob/main/store/src/commonMain/kotlin/org/mobilenativefoundation/store/store5/StoreReadResponse.kt#L51) |
19 | | - from local and network data sources |
20 | | -- [MutableStore](https://mobilenativefoundation.github.io/Store/mutable-store/building/overview/) is a mutable repository implementation that allows create **(C)**, read **(R)**, |
21 | | - update **(U)**, and delete **(D)** operations for local and network resources |
22 | | -- [SourceOfTruth](https://mobilenativefoundation.github.io/Store/mutable-store/building/implementations/source-of-truth/) persists items |
23 | | -- [Fetcher](https://mobilenativefoundation.github.io/Store/mutable-store/building/implementations/fetcher/) defines how data will be fetched over network |
24 | | -- [Updater](https://mobilenativefoundation.github.io/Store/mutable-store/building/implementations/updater/) defines how local changes will be pushed to network |
25 | | -- [Bookkeeper](https://mobilenativefoundation.github.io/Store/mutable-store/building/implementations/bookkeeper/) tracks metadata of local changes and records |
26 | | - synchronization failures |
27 | | -- [Validator](https://mobilenativefoundation.github.io/Store/mutable-store/building/implementations/validator/) returns whether an item is valid |
28 | | -- [Converter](https://mobilenativefoundation.github.io/Store/mutable-store/building/implementations/converter/) converts items |
29 | | - between [Network](https://mobilenativefoundation.github.io/Store/mutable-store/building/generics/network) |
30 | | - /[Local](https://mobilenativefoundation.github.io/Store/mutable-store/building/generics/sot) |
31 | | - /[Output](https://mobilenativefoundation.github.io/Store/mutable-store/building/generics/common) representations |
32 | | - |
33 | | -### Including Store In Your Project |
34 | | - |
35 | | -#### Android |
36 | | -```kotlin |
37 | | -implementation "org.mobilenativefoundation.store:store5:5.1.0-alpha05" |
38 | | -``` |
39 | | - |
40 | | -#### Multiplatform (Common, JVM, Native, JS) |
41 | | - |
42 | | -```kotlin |
43 | | -commonMain { |
44 | | - dependencies { |
45 | | - implementation("org.mobilenativefoundation.store:store5:5.1.0-alpha05") |
46 | | - } |
47 | | -} |
48 | | -``` |
49 | | - |
50 | | -### Getting Started |
51 | | - |
52 | | -#### Building Your First Store |
53 | | - |
54 | | -```kotlin |
55 | | -StoreBuilder |
56 | | - .from<Key, Network, Output, Local>(fetcher, sourceOfTruth) |
57 | | - .converter(converter) |
58 | | - .validator(validator) |
59 | | - .build(updater, bookkeeper) |
60 | | -``` |
61 | | - |
62 | | -#### Creating |
| 1 | +<img src=".github/images/hero-light.svg" width="100%"/> |
63 | 2 |
|
64 | | -##### Request |
| 3 | +# Store5 |
65 | 4 |
|
66 | | -```kotlin |
67 | | -store.write( |
68 | | - request = StoreWriteRequest.of<Key, Output, Response>( |
69 | | - key = key, |
70 | | - value = value |
71 | | - ) |
72 | | -) |
73 | | -``` |
74 | | - |
75 | | -##### Response |
76 | | - |
77 | | -```text |
78 | | -1. StoreWriteResponse.Success.Typed<Response>(response) |
79 | | -``` |
80 | | - |
81 | | -#### Reading |
82 | | - |
83 | | -##### Request |
84 | | - |
85 | | -```kotlin |
86 | | -store.stream<Response>(request = StoreReadRequest.cached(key, refresh = false)) |
87 | | -``` |
| 5 | +[](https://codecov.io/gh/MobileNativeFoundation/Store) |
88 | 6 |
|
89 | | -##### Response |
| 7 | +#### Documentation |
90 | 8 |
|
91 | | -```text |
92 | | -1. StoreReadResponse.Data(value, origin = StoreReadResponseOrigin.Cache) |
93 | | -``` |
| 9 | +Comprehensive guides, tutorials, and API reference: [store.mobilenativefoundation.org](https://store.mobilenativefoundation.org). |
94 | 10 |
|
95 | | -#### Updating |
| 11 | +#### Getting Started |
96 | 12 |
|
97 | | -##### Request |
| 13 | +1. Start with the [Quickstart](https://store.mobilenativefoundation.org/docs/quickstart) to build your first Store. |
| 14 | +2. Dive into [Store Foundations](https://store.mobilenativefoundation.org/docs/concepts) to learn how Store works. |
| 15 | +3. Check out [Handling CRUD](https://store.mobilenativefoundation.org/docs/use-cases/store5/setting-up-store-for-crud-operations) for an advanced guide on supporting create, read, update, and delete operations. |
98 | 16 |
|
99 | | -```kotlin |
100 | | -store.write( |
101 | | - request = StoreWriteRequest.of<Key, Output, Response>( |
102 | | - key = key, |
103 | | - value = newValue |
104 | | - ) |
105 | | -) |
106 | | -``` |
| 17 | +#### Getting Help |
107 | 18 |
|
108 | | -##### Response |
| 19 | +Join our community in the [#store](https://kotlinlang.slack.com/archives/C06007Z01HU) channel on the official Kotlin Slack. |
109 | 20 |
|
110 | | -```text |
111 | | -1. StoreWriteResponse.Success.Typed<Response>(response) |
112 | | -``` |
| 21 | +#### Getting Involved |
113 | 22 |
|
114 | | -#### Deleting |
| 23 | +Store has a vibrant community of contributors. We welcome contributions of all kinds. Please see our [Contributing Guidelines](CONTRIBUTING.md) for more information on how to get involved. |
115 | 24 |
|
116 | | -##### Request |
| 25 | +#### Backed By |
117 | 26 |
|
118 | | -```kotlin |
119 | | -store.clear(key) |
120 | | -``` |
| 27 | +<div style="display: flex; align-items: center; gap: 20px;"> |
| 28 | + <img src=".github/images/mobile-native-foundation.png" width="200"/> |
| 29 | + <img src=".github/images/kotlin-foundation.png" width="200"/> |
| 30 | +</div> |
121 | 31 |
|
122 | | -### License |
| 32 | +#### License |
123 | 33 |
|
124 | 34 | ```text |
125 | 35 | Copyright (c) 2024 Mobile Native Foundation. |
126 | 36 | Licensed under the Apache License, Version 2.0 (the "License"); |
127 | 37 | you may not use this file except in compliance with the License. |
128 | 38 | ``` |
129 | | - |
0 commit comments