Skip to content

Commit

Permalink
v0.11
Browse files Browse the repository at this point in the history
  • Loading branch information
aboodman committed Jan 14, 2025
1 parent 219fbe7 commit db165ca
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 4 deletions.
16 changes: 16 additions & 0 deletions contents/docs/permissions/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,22 @@ Each operation on a policy has a _ruleset_ containing zero or more _rules_.

A rule is just a TypeScript function that receives the logged in user's `AuthData` and generates a ZQL [where expression](reading-data#compound-filters). At least one rule in a ruleset must return a row for the operation to be allowed.

<Note type="warning">
Although they look like normal TypeScript functions, permission rules are "compiled" into a [JSON/ZQL format](zero-cache-config#schema-file) at compile-time. Those JSON rules are uploaded to zero-cache and *that's* what is evaluated.

These functions aren't really ever run against a real auth token. They are instead run against a "placeholder" auth token at compile time. We track which fields are accessed and create a ZQL expression that extracts the right fields out of the real auth token at runtime.

This is confusing and we will be reworking it to make what's really happening more clear.

In the meantime, what you need to understand is that the only JS that is supported in these rules is accessing fields and subfields.

Specifically:

* Iterate over properties or array elements in the auth token
* Use any JS features beyond property access
* Use any conditional or global state
</Note>

## Select Permissions

You can limit the data a user can read by specifying a `select` ruleset.
Expand Down
4 changes: 0 additions & 4 deletions contents/docs/reading-data/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,6 @@ if (issueResult.type === 'complete') {
}
```

<Note type="warning" heading="`resultType` is only implemented for React.">
Sorry about that. Ping us in Discord if you need this in SolidJS.
</Note>

The possible values of `result.type` are currently `complete` and `unknown`.

The `complete` value is currently only returned when Zero has received the server result. But in the future, Zero will be able to return this result type when it _knows_ that all possible data for this query is already available locally. Additionally, we plan to add a `prefix` result for when the data is known to be a prefix of the complete result. See [Consistency](/docs/preloading#consistency) for more information.
Expand Down
34 changes: 34 additions & 0 deletions contents/docs/release-notes/0.11/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: Zero 0.11
description: Windows
---

## Install

```bash
npm install @rocicorp/zero@0.11
```

## Features

- Windows should work a lot better now. Thank you very much to [aexylus](https://aexylus.com/) and [Sergio Leon](https://www.cbnsndwch.io/) for the testing and contributions here.
- Support nested property access in JWT auth tokens ([docs](/docs/permissions#rules)).
- Make initial sync configurable ([docs](/docs/zero-cache-config#initial-sync-table-copy-workers)).
- Add query result type to SolidJS ([docs](/docs/reading-data#completeness))
- Docker image now contains native amd64 and arm64 binaries.
- Add `storageKey` constructor parameter to enable multiple `Zero` instances for same `userID`.

## Fixes

Many, many fixes, including:

- Fix downstream replication of primitive values
- Fix replication of `TRUNCATE` messages
- Fix large storage use for idle pg instances
- Add runtime sanity checks for when a table is referenced but not synced
- Fix `zero-cache-dev` for multitenant


## Breaking Changes

- The addition of result types to SolidJS is a breaking API change. See the changes to [`hello-zero-solid`](https://github.com/rocicorp/hello-zero-solid/commit/7c6c3a47479f037f8323b102013244881c74fe9e) for upgrade example.
1 change: 1 addition & 0 deletions contents/docs/release-notes/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Release Notes
---

- [Zero 0.11: Windows](/docs/release-notes/0.11)
- [Zero 0.10: Remove Top-Level Await](/docs/release-notes/0.10)
- [Zero 0.9: JWK Support](/docs/release-notes/0.9)
- [Zero 0.8: Schema Autobuild, Result Types, and Enums](/docs/release-notes/0.8)
Expand Down
16 changes: 16 additions & 0 deletions contents/docs/zero-cache-config/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,22 @@ flag: `--storage-db-tmp-dir`<br/>
env: `ZERO_STORAGE_DB_TMP_DIR`<br/>
optional: `true`

## Initial Sync Table Copy Workers

The number of parallel workers used to copy tables during initial sync. Each worker copies a single table at a time, fetching rows in batches of `initial-sync-row-batch-size`.

flag: `--initial-sync-table-copy-workers`<br/>
env: `ZERO_INITIAL_SYNC_TABLE_COPY_WORKERS`<br/>
default: `5`

## Initial Sync Row Batch Size

The number of rows each table copy worker fetches at a time during initial sync. This can be increased to speed up initial sync, or decreased to reduce the amount of heap memory used during initial sync (e.g. for tables with large rows).

flag: `--initial-sync-row-batch-size`<br/>
env: `ZERO_INITIAL_SYNC_ROW_BATCH_SIZE`<br/>
default: `10000`

## Tenants JSON

JSON encoding of per-tenant configs for running the server in multi-tenant mode:
Expand Down

0 comments on commit db165ca

Please sign in to comment.