Skip to content

Commit

Permalink
Release notes for Tile Loader an other runtime packages (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Le Cam authored Oct 29, 2021
1 parent 4684211 commit 581e9ff
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 3 deletions.
51 changes: 51 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
## 2021-10-29

### `@glazed/datamodel` v0.2.0

Added support for `TileLoader` from new `@glazed/tile-loader` package.

### `@glazed/did-datastore` v0.2.0

- Added support for `TileLoader` from new `@glazed/tile-loader` package.
- Added support for specifying an `id` in constructor, to use instead of authenticated DID from the Ceramic instance.
- Added support for specifying a custom controller in mutation methods.
- Added `getMultiple()` method to load a record for multiple DIDs at once.
- Improved internal logic for pinning streams.

### `@glazed/tile-loader` v0.1.0

Initial release.

## 2021-08-26

### `@glazed/cli` v0.1.0

Initial release.

### `@glazed/constants` v0.1.0

Initial release.

### `@glazed/datamodel` v0.1.0

Initial release.

### `@glazed/devtools` v0.1.0

Initial release.

### `@glazed/did-datastore` v0.1.0

Initial release.

### `@glazed/types` v0.1.0

Initial release.

### `jest-environment-ceramic` v0.14.0

Updated dependencies.

### `jest-environment-glaze` v0.1.0

Initial release.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ This monorepo uses Yarn workspaces, make sure to install it first if you don't a
| Name | Description | Version |
| ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| **Runtime libraries** |
| [`@glazed/tile-loader`](./packages/tile-loader) | [Batching and caching for Ceramic streams](https://developers.ceramic.network/tools/glaze/tile-loader/) | ![npm version](https://img.shields.io/npm/v/@glazed/tile-loader.svg) |
| [`@glazed/datamodel`](./packages/datamodel) | [Aliases for Ceramic stream references](https://developers.ceramic.network/tools/glaze/datamodel/) | ![npm version](https://img.shields.io/npm/v/@glazed/datamodel.svg) |
| [`@glazed/did-datastore`](./packages/did-datastore) | [Associate data records to a DID](https://developers.ceramic.network/tools/glaze/did-datastore/) | ![npm version](https://img.shields.io/npm/v/@glazed/did-datastore.svg) |
| **Developer tools** |
Expand Down
11 changes: 10 additions & 1 deletion docs/modules/tile_loader.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,16 @@ npm install @glazed/tile-loader

### TileCache

Ƭ **TileCache**: `CacheMap`<`string`, `Promise`<`TileDocument`\>\>
Ƭ **TileCache**: `Object`

#### Type declaration

| Name | Type |
| :------ | :------ |
| `clear` | () => `any` |
| `delete` | (`id`: `string`) => `any` |
| `get` | (`id`: `string`) => `void` \| `Promise`<`TileDocument`<`Record`<`string`, `any`\>\>\> |
| `set` | (`id`: `string`, `value`: `Promise`<`TileDocument`<`Record`<`string`, `any`\>\>\>) => `any` |

___

Expand Down
21 changes: 19 additions & 2 deletions packages/tile-loader/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { TileDocument } from '@ceramicnetwork/stream-tile'
import type { TileMetadataArgs } from '@ceramicnetwork/stream-tile'
import { CommitID, StreamID, StreamRef } from '@ceramicnetwork/streamid'
import DataLoader from 'dataloader'
import type { CacheMap } from 'dataloader'

/**
* Omit `path` and `atTime` from [MultiQuery](https://developers.ceramic.network/reference/typescript/interfaces/_ceramicnetwork_common.multiquery-1.html) as the cache needs to be deterministic based on the ID.
Expand All @@ -20,7 +19,25 @@ export type TileQuery = Omit<MultiQuery, 'paths' | 'atTime'>

export type TileKey = CommitID | StreamID | TileQuery | string

export type TileCache = CacheMap<string, Promise<TileDocument>>
// Implements CacheMap from dataloader, copied here to generate docs
export type TileCache = {
/**
* get a Promise of a TileDocument by its stream ID
*/
get(id: string): Promise<TileDocument> | void
/**
* set a Promise of a TileDocument by its stream ID
*/
set(id: string, value: Promise<TileDocument>): any
/**
* remove a specific entry from the cache
*/
delete(id: string): any
/**
* remove all entries from the cache
*/
clear(): any
}

export type TileLoaderParams = {
/**
Expand Down

0 comments on commit 581e9ff

Please sign in to comment.