korajs 1.0.0-beta.12 → 1.0.0-beta.13

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,11 +1,11 @@
1
1
  # korajs
2
2
 
3
- Offline-first application framework. Local-first storage, reactive queries, automatic conflict resolution, and real-time sync -- with zero distributed systems code.
3
+ Offline-first application framework: local storage, reactive queries, automatic conflict resolution and real-time sync, with zero distributed-systems code.
4
4
 
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- pnpm add korajs
8
+ pnpm add korajs@beta
9
9
  ```
10
10
 
11
11
  ## Quick Start
@@ -13,21 +13,22 @@ pnpm add korajs
13
13
  ```typescript
14
14
  import { createApp, defineSchema, t } from 'korajs'
15
15
 
16
- const app = createApp({
17
- schema: defineSchema({
18
- version: 1,
19
- collections: {
20
- todos: {
21
- fields: {
22
- title: t.string(),
23
- completed: t.boolean().default(false),
24
- createdAt: t.timestamp().auto(),
25
- },
16
+ const schema = defineSchema({
17
+ version: 1,
18
+ collections: {
19
+ todos: {
20
+ fields: {
21
+ title: t.string(),
22
+ completed: t.boolean().default(false),
23
+ createdAt: t.timestamp().auto(),
26
24
  },
27
25
  },
28
- }),
26
+ },
29
27
  })
30
28
 
29
+ const app = createApp({ schema })
30
+ await app.ready
31
+
31
32
  const todo = await app.todos.insert({ title: 'Ship Kora v1' })
32
33
  const active = await app.todos.where({ completed: false }).orderBy('createdAt').exec()
33
34
  await app.todos.update(todo.id, { completed: true })
@@ -36,20 +37,22 @@ app.todos.where({ completed: false }).subscribe((todos) => console.log(todos))
36
37
 
37
38
  ## Enable Sync
38
39
 
39
- Add one line to sync across devices:
40
+ Point the app at a [Kora sync server](https://korajs.dev/guide/production-server):
40
41
 
42
+ <!-- docs-check: continue -->
41
43
  ```typescript
42
- const app = createApp({
44
+ const syncedApp = createApp({
43
45
  schema,
44
- sync: { url: 'wss://my-server.com/kora' },
46
+ sync: { url: 'wss://sync.example.com/kora-sync', autoConnect: true },
45
47
  })
46
48
  ```
47
49
 
48
- Conflicts are resolved automatically. No distributed systems code required.
50
+ Writes still land locally first and upload when a connection exists; concurrent edits merge per
51
+ field the same way on every device.
49
52
 
50
53
  ## React Integration
51
54
 
52
- Install `@korajs/react` or import from `korajs/react`:
55
+ Install `@korajs/react@beta`, then import from it or from `korajs/react`:
53
56
 
54
57
  ```tsx
55
58
  import { KoraProvider, useQuery, useMutation } from 'korajs/react'
@@ -61,7 +64,7 @@ import { KoraProvider, useQuery, useMutation } from 'korajs/react'
61
64
  import { KoraProvider, useQuery, useMutation } from 'korajs/vue'
62
65
  ```
63
66
 
64
- Requires `vue` and `@korajs/vue` as peer dependencies.
67
+ Requires `vue` and `@korajs/vue` (peer dependencies).
65
68
 
66
69
  ## Svelte Integration
67
70
 
@@ -70,14 +73,14 @@ import { createQueryStore, useQuery, useMutation } from 'korajs/svelte'
70
73
  import KoraProvider from '@korajs/svelte/KoraProvider.svelte'
71
74
  ```
72
75
 
73
- Requires `svelte` and `@korajs/svelte` as peer dependencies. Wrap your app with `<KoraProvider app={kora}>` (see `@korajs/svelte` README).
76
+ Requires `svelte` and `@korajs/svelte` (peer dependencies). Wrap your app with `<KoraProvider app={kora}>` (see the `@korajs/svelte` README).
74
77
 
75
78
  ## Packages
76
79
 
77
- `@korajs/core` | `@korajs/store` | `@korajs/merge` | `@korajs/sync` | `@korajs/server` | `@korajs/react` | `@korajs/vue` | `@korajs/svelte` | `@korajs/devtools` | `@korajs/cli`
80
+ `@korajs/core` | `@korajs/store` | `@korajs/merge` | `@korajs/sync` | `@korajs/server` | `@korajs/auth` | `@korajs/react` | `@korajs/vue` | `@korajs/svelte` | `@korajs/tauri` | `@korajs/devtools` | `@korajs/cli` | `@korajs/test` | `create-kora-app`
78
81
 
79
82
  ## License
80
83
 
81
84
  MIT
82
85
 
83
- See the [full documentation](https://github.com/ehoneahobed/kora) for guides, API reference, and examples.
86
+ Documentation: [korajs.dev](https://korajs.dev).